Install and test LSPosed through test app

This commit is contained in:
topjohnwu
2024-12-24 17:11:08 -08:00
committed by John Wu
parent 32faa4ced6
commit 2baedf74d1
8 changed files with 136 additions and 49 deletions

View File

@ -36,8 +36,7 @@ am_instrument() {
else
test_pkg=com.topjohnwu.magisk.test
fi
local out=$(adb shell am instrument -w --user 0 \
-e class "com.topjohnwu.magisk.test.$1" \
local out=$(adb shell am instrument -w --user 0 -e class "$1" \
"$test_pkg/com.topjohnwu.magisk.test.TestRunner")
grep -q 'OK (' <<< "$out"
}
@ -59,34 +58,36 @@ run_setup() {
adb install -r -g out/test.apk
# Run setup through the test app
am_instrument 'Environment#setupMagisk'
am_instrument '.Environment#setupMagisk'
# Install LSPosed
am_instrument '.Environment#setupLsposed'
}
run_tests() {
# Run app tests
am_instrument 'MagiskAppTest'
am_instrument '.MagiskAppTest,.AdditionalTest'
# Test shell su request
am_instrument 'Environment#setupShellGrantTest'
am_instrument '.Environment#setupShellGrantTest'
adb shell /system/xbin/su 2000 su -c id | tee /dev/fd/2 | grep -q 'uid=0'
adb shell am force-stop com.topjohnwu.magisk
# Test app hiding
am_instrument 'Environment#setupAppHide'
am_instrument '.Environment#setupAppHide'
wait_for_pm com.topjohnwu.magisk
# Make sure it still works
am_instrument 'MagiskAppTest' true
am_instrument '.MagiskAppTest' true
# Test shell su request
am_instrument 'Environment#setupShellGrantTest' true
am_instrument '.Environment#setupShellGrantTest' true
adb shell /system/xbin/su 2000 su -c id | tee /dev/fd/2 | grep -q 'uid=0'
adb shell am force-stop repackaged.com.topjohnwu.magisk
# Test app restore
am_instrument 'Environment#setupAppRestore' true
am_instrument '.Environment#setupAppRestore' true
wait_for_pm repackaged.com.topjohnwu.magisk
# Make sure it still works
am_instrument 'MagiskAppTest'
am_instrument '.MagiskAppTest'
}