Add unit tests for ZipExtractor

Implement AppTest with unit tests for ZipExtractor verifying
remote boot image extraction from both factory image packages
and OTA update packages using HTTP range requests.

Also add an app-test sub-command to scripts/avd.sh to run AppTest
via instrumentation on connected emulators.

Assisted-by: Gemini 3.8 Flash
This commit is contained in:
topjohnwu
2026-10-07 07:44:31 +00:00
parent 33c1f83562
commit 53d66fb847
2 changed files with 100 additions and 0 deletions
+19
View File
@@ -315,6 +315,20 @@ live_test_main() {
done
}
app_test_main() {
local apks=($(print_apks "$@"))
local pkg='com.topjohnwu.magisk.test'
local app="$pkg/$pkg.AppTestRunner"
for apk in "${apks[@]}"; do
# Cleanup
adb shell pm uninstall com.topjohnwu.magisk || true
adb install -r -g $apk
adb install -r -g out/test.apk
am_instrument '.AppTest' $app
done
}
case "$1" in
test )
shift
@@ -327,6 +341,11 @@ case "$1" in
set -x
live_test_main "$@"
;;
app-test )
shift
set -x
app_test_main "$@"
;;
run )
shift
trap cleanup EXIT