mirror of
https://github.com/kvorschk/Magisk.git
synced 2026-12-04 19:10:47 -05:00
Setup userspace Magisk tests
The existing test infrastructure relies on the full Magisk setup before it can test any functionality. However for most of the time, we just want to test the core Magisk functionality without the need of involving MagiskInit.
This commit is contained in:
@@ -259,6 +259,28 @@ dl_main() {
|
||||
dl_emu "$avd_pkg"
|
||||
}
|
||||
|
||||
live_test_main() {
|
||||
local apks=($(print_apks "$@"))
|
||||
for apk in "${apks[@]}"; do
|
||||
# Cleanup
|
||||
adb shell pm uninstall com.topjohnwu.magisk || true
|
||||
adb shell pm uninstall repackaged.com.topjohnwu.magisk.test || true
|
||||
adb shell /system/xbin/su 0 rm -rf /data/adb/modules
|
||||
|
||||
# "Install" Magisk
|
||||
./build.py -v emulator $apk
|
||||
timeout $boot_timeout bash -c wait_for_boot
|
||||
|
||||
run_setup $apk
|
||||
|
||||
# Trigger Magisk soft reboot
|
||||
./build.py -v emulator $apk
|
||||
timeout $boot_timeout bash -c wait_for_boot
|
||||
|
||||
run_tests
|
||||
done
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
test )
|
||||
shift
|
||||
@@ -267,6 +289,12 @@ case "$1" in
|
||||
set -x
|
||||
test_main "$@"
|
||||
;;
|
||||
live-test )
|
||||
shift
|
||||
export -f wait_for_boot
|
||||
set -x
|
||||
live_test_main "$@"
|
||||
;;
|
||||
run )
|
||||
shift
|
||||
trap cleanup EXIT
|
||||
|
||||
@@ -149,6 +149,8 @@ mkdir -p $MAGISKTMP/.magisk/worker
|
||||
mount_tmpfs $MAGISKTMP/.magisk/worker
|
||||
mount --make-private $MAGISKTMP/.magisk/worker
|
||||
touch $MAGISKTMP/.magisk/config
|
||||
# Create a marker file to understand it is a live setup
|
||||
touch $MAGISKTMP/.magisk/live
|
||||
|
||||
export MAGISKTMP
|
||||
MAKEDEV=1 $MAGISKTMP/magisk --preinit-device 2>&1
|
||||
|
||||
Reference in New Issue
Block a user