Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
M
Magisk
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
Magisk
Commits
1257ba41
Commit
1257ba41
authored
Mar 18, 2022
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add MagiskInit AVD automation test
parent
2cc71ac7
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
78 additions
and
2 deletions
+78
-2
avd_patch.sh
scripts/avd_patch.sh
+0
-2
avd_test.sh
scripts/avd_test.sh
+78
-0
No files found.
scripts/avd_patch.sh
View file @
1257ba41
...
...
@@ -43,8 +43,6 @@ if [ -z "$FIRST_STAGE" ]; then
exec
./busybox sh
$0
fi
pm
install
-r
$(
pwd
)
/app-debug.apk
# Extract files from APK
unzip
-oj
app-debug.apk
'assets/util_functions.sh'
.
./util_functions.sh
...
...
scripts/avd_test.sh
0 → 100755
View file @
1257ba41
#!/usr/bin/env bash
set
-xe
cleanup
()
{
echo
-e
'\n\033[41m! An error occurred\033[0m\n'
pkill
-INT
-P
$$
wait
}
trap
cleanup EXIT
emu
=
"
$ANDROID_SDK_ROOT
/emulator/emulator"
avd
=
"
$ANDROID_SDK_ROOT
"
/cmdline-tools/latest/bin/avdmanager
sdk
=
"
$ANDROID_SDK_ROOT
"
/cmdline-tools/latest/bin/sdkmanager
type
=
'google_apis'
emu_args
=
'-no-window -gpu swiftshader_indirect -no-snapshot -noaudio -no-boot-anim'
wait_for_boot
()
{
while
true
;
do
if
[
-n
"
$(
adb shell getprop sys.boot_completed
)
"
]
;
then
break
fi
sleep
2
done
}
export
-f
wait_for_boot
test_api
()
{
local
pkg pid ramdisk
# Setup emulator
pkg
=
"system-images;android-
$1
;
$type
;x86_64"
echo
-e
"
\n\0
33[44m* Testing
$pkg
\0
33[0m
\n
"
"
$sdk
"
$pkg
echo
no |
"
$avd
"
create avd
-f
-n
test
-k
$pkg
# Launch emulator and patch
ramdisk
=
"
$ANDROID_SDK_ROOT
/system-images/android-
$1
/
$type
/x86_64/ramdisk.img"
if
[
-f
"
${
ramdisk
}
.bak"
]
;
then
cp
"
${
ramdisk
}
.bak"
"
$ramdisk
"
fi
$emu
@test
$emu_args
&
pid
=
$!
timeout
60 adb wait-for-device
./build.py avd_patch
-s
$ramdisk
kill
-INT
$pid
wait
$pid
# Test if it boots properly
$emu
@test
$emu_args
&
pid
=
$!
timeout
60 adb wait-for-device
timeout
60 bash
-c
wait_for_boot
adb shell magisk
-v
kill
-INT
$pid
wait
$pid
}
# Build our executables
./build.py binary
./build.py app
# We test the following API levels for the following reason:
# API 23: legacy rootfs w/o Treble
# API 26: legacy rootfs with Treble
# API 28: legacy system-as-root
# API 32: 2 Stage Init
for
api
in
23 26 28 32
;
do
test_api
$api
done
trap
- EXIT
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment