mirror of
https://github.com/topjohnwu/Magisk.git
synced 2025-07-28 11:33:38 +00:00
Add regression test for #9179
This commit is contained in:
parent
9ca469898c
commit
cd9851a1fe
@ -15,6 +15,7 @@ import com.topjohnwu.magisk.test.Environment.Companion.SEPOLICY_RULE
|
|||||||
import com.topjohnwu.superuser.Shell
|
import com.topjohnwu.superuser.Shell
|
||||||
import kotlinx.coroutines.runBlocking
|
import kotlinx.coroutines.runBlocking
|
||||||
import org.junit.After
|
import org.junit.After
|
||||||
|
import org.junit.Assert.assertArrayEquals
|
||||||
import org.junit.Assert.assertEquals
|
import org.junit.Assert.assertEquals
|
||||||
import org.junit.Assert.assertFalse
|
import org.junit.Assert.assertFalse
|
||||||
import org.junit.Assert.assertNotNull
|
import org.junit.Assert.assertNotNull
|
||||||
@ -98,9 +99,10 @@ class AdditionalTest : BaseTest {
|
|||||||
RootUtils.fs.getFile("/system/bin/screenrecord").exists()
|
RootUtils.fs.getFile("/system/bin/screenrecord").exists()
|
||||||
)
|
)
|
||||||
val egg = RootUtils.fs.getFile("/system/app/EasterEgg").list() ?: arrayOf()
|
val egg = RootUtils.fs.getFile("/system/app/EasterEgg").list() ?: arrayOf()
|
||||||
assertTrue(
|
assertArrayEquals(
|
||||||
"/system/app/EasterEgg should be empty",
|
"/system/app/EasterEgg should be replaced",
|
||||||
egg.isEmpty()
|
egg,
|
||||||
|
arrayOf("newfile")
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -108,6 +108,9 @@ class Environment : BaseTest {
|
|||||||
assertTrue(error, egg.mkdirs())
|
assertTrue(error, egg.mkdirs())
|
||||||
assertTrue(error, egg.getChildFile(".replace").createNewFile())
|
assertTrue(error, egg.getChildFile(".replace").createNewFile())
|
||||||
|
|
||||||
|
// Create /system/app/EasterEgg/newfile
|
||||||
|
assertTrue(error, egg.getChildFile("newfile").createNewFile())
|
||||||
|
|
||||||
// Delete /system/bin/screenrecord
|
// Delete /system/bin/screenrecord
|
||||||
val bin = path.getChildFile("system").getChildFile("bin")
|
val bin = path.getChildFile("system").getChildFile("bin")
|
||||||
assertTrue(error, bin.mkdirs())
|
assertTrue(error, bin.mkdirs())
|
||||||
|
@ -292,7 +292,7 @@ impl FsNode {
|
|||||||
&src,
|
&src,
|
||||||
path.worker(),
|
path.worker(),
|
||||||
matches!(node, FsNode::Directory { .. }),
|
matches!(node, FsNode::Directory { .. }),
|
||||||
);
|
)?;
|
||||||
}
|
}
|
||||||
_ => node.commit_tmpfs(path)?,
|
_ => node.commit_tmpfs(path)?,
|
||||||
}
|
}
|
||||||
|
@ -30,8 +30,16 @@ print_error() {
|
|||||||
# $1 = TestClass#method
|
# $1 = TestClass#method
|
||||||
# $2 = component
|
# $2 = component
|
||||||
am_instrument() {
|
am_instrument() {
|
||||||
|
set +x
|
||||||
local out=$(adb shell am instrument -w --user 0 -e class "$1" "$2")
|
local out=$(adb shell am instrument -w --user 0 -e class "$1" "$2")
|
||||||
grep -q 'OK (' <<< "$out"
|
echo "$out"
|
||||||
|
if grep -q 'OK (' <<< "$out"; then
|
||||||
|
set -x
|
||||||
|
return 0
|
||||||
|
else
|
||||||
|
set -x
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# $1 = pkg
|
# $1 = pkg
|
||||||
|
Loading…
x
Reference in New Issue
Block a user