CI: add avd test

This commit is contained in:
vvb2060 2023-04-25 04:54:46 +08:00 committed by John Wu
parent e9f32e4f68
commit 3733c9a091
3 changed files with 15 additions and 9 deletions

View File

@ -106,3 +106,9 @@ jobs:
with:
name: ${{ github.sha }}-symbols
path: app/build/outputs
- name: AVD test
if: runner.os == 'macOS'
run: |
brew install coreutils
scripts/avd_test.sh

View File

@ -52,7 +52,7 @@ done
./magiskboot decompress ramdisk.cpio.tmp ramdisk.cpio
cp ramdisk.cpio ramdisk.cpio.orig
export KEEPVERITY=false
export KEEPVERITY=true
export KEEPFORCEENCRYPT=true
echo "KEEPVERITY=$KEEPVERITY" > config
@ -67,6 +67,7 @@ fi
[ $API = "28" ] && echo 'RECOVERYMODE=true' >> config
RANDOMSEED=$(tr -dc 'a-f0-9' < /dev/urandom | head -c 16)
echo "RANDOMSEED=0x$RANDOMSEED" >> config
cat config
./magiskboot compress=xz magisk32 magisk32.xz
./magiskboot compress=xz magisk64 magisk64.xz
@ -86,4 +87,3 @@ echo "RANDOMSEED=0x$RANDOMSEED" >> config
rm -f ramdisk.cpio.orig config magisk*.xz stub.xz
./magiskboot compress=gzip ramdisk.cpio ramdisk.cpio.gz
pm install magisk.apk || true

View File

@ -3,7 +3,7 @@
emu="$ANDROID_SDK_ROOT/emulator/emulator"
avd="$ANDROID_SDK_ROOT/cmdline-tools/latest/bin/avdmanager"
sdk="$ANDROID_SDK_ROOT/cmdline-tools/latest/bin/sdkmanager"
emu_args='-no-window -gpu swiftshader_indirect -no-snapshot -noaudio -no-boot-anim'
emu_args='-no-window -gpu swiftshader_indirect -no-snapshot -noaudio -no-boot-anim -show-kernel'
# Should be either 'google_apis' or 'default'
type='google_apis'
@ -33,7 +33,7 @@ cleanup() {
wait_for_boot() {
while true; do
if [ -n "$(adb shell getprop sys.boot_completed)" ]; then
if [ "stopped" = "$(adb exec-out getprop init.svc.bootanim)" ]; then
break
fi
sleep 2
@ -68,7 +68,8 @@ run_test() {
restore_avd
"$emu" @test $emu_args &
pid=$!
timeout 60 adb wait-for-device
timeout 180 bash -c wait_for_boot
./build.py avd_patch -s "$ramdisk"
kill -INT $pid
wait $pid
@ -76,8 +77,7 @@ run_test() {
# Test if it boots properly
"$emu" @test $emu_args &
pid=$!
timeout 60 adb wait-for-device
timeout 60 bash -c wait_for_boot
timeout 180 bash -c wait_for_boot
adb shell magisk -v
kill -INT $pid
@ -101,8 +101,8 @@ case $(uname -m) in
;;
esac
# Build our executables
./build.py all
yes | "$sdk" --licenses
"$sdk" --channel=3 --update
for api in $api_list; do
set_api_env $api