mirror of
https://github.com/topjohnwu/Magisk.git
synced 2025-02-17 13:08:28 +00:00
Make avd_test less flaky
This commit is contained in:
parent
985454afd4
commit
d2f2a9e4c8
10
.github/workflows/build.yml
vendored
10
.github/workflows/build.yml
vendored
@ -22,7 +22,7 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
os: [ubuntu-latest, windows-latest, macos-latest]
|
os: [ubuntu-latest, windows-latest, macos-13]
|
||||||
steps:
|
steps:
|
||||||
- name: Check out
|
- name: Check out
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
@ -98,7 +98,7 @@ jobs:
|
|||||||
|
|
||||||
test:
|
test:
|
||||||
name: Test on ${{ matrix.api }}
|
name: Test on ${{ matrix.api }}
|
||||||
runs-on: macos-latest
|
runs-on: macos-13
|
||||||
needs: build
|
needs: build
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
@ -111,12 +111,6 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
- name: Set up JDK 17
|
|
||||||
uses: actions/setup-java@v3
|
|
||||||
with:
|
|
||||||
distribution: "temurin"
|
|
||||||
java-version: "17"
|
|
||||||
|
|
||||||
- name: Set up Python 3
|
- name: Set up Python 3
|
||||||
uses: actions/setup-python@v4
|
uses: actions/setup-python@v4
|
||||||
with:
|
with:
|
||||||
|
@ -92,11 +92,24 @@ wait_emu() {
|
|||||||
timeout $boot_timeout bash -c $wait_fn &
|
timeout $boot_timeout bash -c $wait_fn &
|
||||||
local wait_pid=$!
|
local wait_pid=$!
|
||||||
|
|
||||||
# Handle the case when emulator dies earlier than wait
|
# Handle the case when emulator dies earlier than timeout
|
||||||
wait -p which_pid -n $emu_pid $wait_pid
|
wait -p which_pid -n $emu_pid $wait_pid
|
||||||
[ $which_pid -eq $wait_pid ]
|
[ $which_pid -eq $wait_pid ]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
run_content_cmd() {
|
||||||
|
while true; do
|
||||||
|
local out=$(adb shell echo "'content call --uri content://com.topjohnwu.magisk.provider --method $1'" \| /system/xbin/su | tee /dev/fd/2)
|
||||||
|
if ! grep -q 'Bundle\[' <<< "$out"; then
|
||||||
|
# The call failed, wait a while and retry later
|
||||||
|
sleep 30
|
||||||
|
else
|
||||||
|
grep -q 'result=true' <<< "$out"
|
||||||
|
return $?
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
test_emu() {
|
test_emu() {
|
||||||
local variant=$1
|
local variant=$1
|
||||||
|
|
||||||
@ -110,17 +123,14 @@ test_emu() {
|
|||||||
|
|
||||||
# Install the Magisk app
|
# Install the Magisk app
|
||||||
adb install -r -g out/app-${variant}.apk
|
adb install -r -g out/app-${variant}.apk
|
||||||
adb shell appops set com.topjohnwu.magisk REQUEST_INSTALL_PACKAGES allow
|
|
||||||
|
|
||||||
# Use the app to run setup and reboot
|
# Use the app to run setup and reboot
|
||||||
adb shell echo "'content call --uri content://com.topjohnwu.magisk.provider --method setup'" \| /system/xbin/su \
|
run_content_cmd setup
|
||||||
| tee /dev/fd/2 | grep -q 'result=true'
|
|
||||||
adb reboot
|
adb reboot
|
||||||
wait_emu wait_for_boot
|
wait_emu wait_for_boot
|
||||||
|
|
||||||
# Run app tests
|
# Run app tests
|
||||||
adb shell echo "'content call --uri content://com.topjohnwu.magisk.provider --method test'" \| /system/xbin/su \
|
run_content_cmd test
|
||||||
| tee /dev/fd/2 | grep -q 'result=true'
|
|
||||||
adb shell echo "'su -c id'" \| /system/xbin/su 2000 | tee /dev/fd/2 | grep -q 'uid=0'
|
adb shell echo "'su -c id'" \| /system/xbin/su 2000 | tee /dev/fd/2 | grep -q 'uid=0'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user