mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-19 04:46:08 +00:00
cleanup (#764)
This commit is contained in:
1 parent
5fd47421f9
commit
aecd2ebe1d
852 files changed
+4844
-46144
No files matched your search
@@ -16,7 +16,6 @@ class AppImageManagerTest {
|
||||
@Before fun setUp() { dir = Files.createTempDirectory("appimage").toFile() }
|
||||
@After fun tearDown() { dir.deleteRecursively() }
|
||||
|
||||
/** An ELF header with the AppImage magic at byte 8 and [machine] at byte 18. */
|
||||
private fun image(machine: Int, type: Int = 2, magic: Boolean = true): File {
|
||||
val b = ByteArray(64)
|
||||
b[0] = 0x7f; b[1] = 'E'.code.toByte(); b[2] = 'L'.code.toByte(); b[3] = 'F'.code.toByte()
|
||||
|
||||
@@ -68,7 +68,6 @@ class BwrapSpawnerTest {
|
||||
}
|
||||
}
|
||||
|
||||
/** The sandbox a Flatpak request describes, built on disk under a temporary directory. */
|
||||
@RunWith(RobolectricTestRunner::class)
|
||||
class BwrapSpawnerPlanTest {
|
||||
private lateinit var dir: File
|
||||
@@ -76,7 +75,6 @@ class BwrapSpawnerPlanTest {
|
||||
|
||||
@Before fun setUp() {
|
||||
dir = Files.createTempDirectory("bwrap-plan").toFile()
|
||||
// Flatpak names the runtime by its path inside the rootfs.
|
||||
runtime = File(LinuxRuntime.rootDir(RuntimeEnvironment.getApplication()), "runtime-files")
|
||||
File(runtime, "lib").mkdirs()
|
||||
}
|
||||
@@ -107,18 +105,14 @@ class BwrapSpawnerPlanTest {
|
||||
op("t" to "bind", "src" to "/nonexistent-${System.nanoTime()}", "dest" to "/run/x", "try" to true),
|
||||
), dir)
|
||||
|
||||
// The runtime is bound at /usr, not written into.
|
||||
assertTrue(plan.binds.any { it.guest == "/usr" && File(it.host).canonicalPath == runtime.canonicalPath })
|
||||
assertFalse(File(runtime, "lib/GL").exists())
|
||||
// The tmpfs under /usr is a directory of ours, and the link Flatpak makes inside it lands there.
|
||||
val gl = plan.binds.single { it.guest == "/usr/lib/GL" }
|
||||
assertTrue(gl.host.startsWith(dir.path))
|
||||
assertEquals("default/lib/libEGL.so", Files.readSymbolicLink(File(gl.host, "libEGL.so").toPath()).toString())
|
||||
// Top-level links, directories and files are made in the sandbox root itself.
|
||||
assertEquals("usr/lib", Files.readSymbolicLink(File(plan.root, "lib").toPath()).toString())
|
||||
assertTrue(File(plan.root, "tmp").isDirectory)
|
||||
assertEquals("[Application]\nname=org.example.Game\n", File(plan.root, ".flatpak-info").readText())
|
||||
// A --bind-try whose source is missing is left out.
|
||||
assertFalse(plan.binds.any { it.guest == "/run/x" })
|
||||
assertEquals(listOf("/app/bin/game"), plan.argv)
|
||||
assertEquals("/app", plan.cwd)
|
||||
|
||||
@@ -69,7 +69,6 @@ class DeckyPluginInstallTest {
|
||||
val plugins = temporary.newFolder()
|
||||
val old = plugin(plugins, "Unifideck", "Unifideck")
|
||||
File(old, "old-version").writeText("keep")
|
||||
// An empty staged directory makes the plugin activation fail after backing up the old one.
|
||||
val staged = plugin(temporary.newFolder(), "Unifideck", "Unifideck")
|
||||
staged.deleteRecursively()
|
||||
val settings = File(temporary.newFolder(), "loader.json").apply { writeText("{}") }
|
||||
|
||||
@@ -9,7 +9,6 @@ class ProotFastPathTest {
|
||||
private val root = File("/data/data/com.droiddeck.launcher/files/linuxfs")
|
||||
|
||||
@Test fun aSessionsUsualBindsGetAKey() {
|
||||
// 87 on a device with two Games folders: past the old limit of 64, which dropped them.
|
||||
val binds = (1..87).map { "/host/$it:/guest/$it" }
|
||||
assertNotNull(ProotFastPath.key(root, binds))
|
||||
}
|
||||
|
||||
@@ -107,7 +107,6 @@ class RuntimeRemovalTest {
|
||||
follower.join(5000)
|
||||
assertEquals(true, result.get())
|
||||
assertEquals(true, followerResult.get())
|
||||
// The last stage is "Linux runtime removed", the only one reported at 100.
|
||||
assertEquals(100, percents.last())
|
||||
assertFalse(root.exists())
|
||||
assertFalse(File(dir, "linuxfs.removing").exists())
|
||||
@@ -131,7 +130,6 @@ class RuntimeRemovalTest {
|
||||
val root = runtime()
|
||||
try {
|
||||
val removal = LinuxRuntimeInstaller.beginUninstall(null, root)!!
|
||||
// The first stage names the removal, the second counts its first entry.
|
||||
var stages = 0
|
||||
assertFalse(removal.run { _, _ ->
|
||||
if (++stages == 2)
|
||||
@@ -170,12 +168,10 @@ class RuntimeRemovalTest {
|
||||
assertNull(LinuxRuntimeInstaller.removalError())
|
||||
assertFalse(root.exists())
|
||||
assertFalse(File(dir, "linuxfs.removing").exists())
|
||||
// Only the undeletable entry and its parents remain, out of the way.
|
||||
val trash = File(dir, LinuxRuntimeInstaller.TRASH)
|
||||
assertEquals(listOf(".steampath"), trash.walk().filter { it.isFile }.map { it.name }.toList())
|
||||
assertEquals(setOf(LinuxRuntimeInstaller.TRASH), dir.list()!!.toSet())
|
||||
|
||||
// Once it can be deleted, the next removal clears the trash too.
|
||||
RuntimeFileTree.refuseForTest = null
|
||||
assertTrue(LinuxRuntimeInstaller.beginUninstall(null, root)!!.run(null))
|
||||
assertFalse(trash.exists())
|
||||
|
||||
@@ -35,7 +35,6 @@ class RuntimeRemovalUiTest {
|
||||
try {
|
||||
val activity = Robolectric.buildActivity(SessionActivity::class.java).create()
|
||||
assertTrue(activity.get().isFinishing)
|
||||
// Even lifecycle callbacks delivered after finish must not touch uninitialised UI.
|
||||
activity.start().resume().pause().stop().destroy()
|
||||
assertFalse(SessionState.running)
|
||||
assertEquals(SessionPhase.IDLE, SessionState.phase)
|
||||
|
||||
Reference in new issue
Block a user