Output logs to files

This commit is contained in:
topjohnwu 2024-07-25 03:48:13 -07:00
parent 939bfac920
commit 3b27de3715
2 changed files with 30 additions and 16 deletions

View File

@ -114,9 +114,18 @@ jobs:
- name: Run AVD test
timeout-minutes: 10
env:
AVD_TEST_VERBOSE: 1
AVD_TEST_LOG: 1
run: scripts/avd_test.sh ${{ matrix.version }} ${{ matrix.type }}
- name: Upload logs on error
if: ${{ failure() }}
uses: actions/upload-artifact@v4
with:
name: "avd-logs-${{ matrix.version }}"
path: |
kernel.log
logcat.log
avd-test-32:
name: Test API ${{ matrix.version }} (x86)
runs-on: ubuntu-latest
@ -148,9 +157,18 @@ jobs:
timeout-minutes: 10
env:
FORCE_32_BIT: 1
AVD_TEST_VERBOSE: 1
AVD_TEST_LOG: 1
run: scripts/avd_test.sh ${{ matrix.version }}
- name: Upload logs on error
if: ${{ failure() }}
uses: actions/upload-artifact@v4
with:
name: "avd32-logs-${{ matrix.version }}"
path: |
kernel.log
logcat.log
cf_test:
name: Test ${{ matrix.branch }} (${{ matrix.target }})
runs-on: ubuntu-24.04

View File

@ -10,6 +10,7 @@ emu_pid=
atd_min_api=30
atd_max_api=34
lsposed_min_api=27
lsposed_max_api=34
huge_ram_min_api=26
cleanup() {
@ -67,29 +68,24 @@ test_emu() {
print_title "* Testing $pkg ($variant)"
if [ -n "$AVD_TEST_VERBOSE" ]; then
"$emu" @test $emu_args &
emu_pid=$!
adb logcat &
if [ -n "$AVD_TEST_LOG" ]; then
"$emu" @test $emu_args > kernel.log 2>&1 &
else
"$emu" @test $emu_args 2>/dev/null &
emu_pid=$!
"$emu" @test $emu_args > /dev/null 2>&1 &
fi
emu_pid=$!
wait_emu wait_for_boot
test_setup $variant
# Install LSPosed
if [ $api -ge $lsposed_min_api -a $api -le $atd_max_api ]; then
if [ $api -ge $lsposed_min_api -a $api -le $lsposed_max_api ]; then
adb push out/lsposed.zip /data/local/tmp/lsposed.zip
echo 'PATH=$PATH:/debug_ramdisk magisk --install-module /data/local/tmp/lsposed.zip' | adb shell /system/xbin/su
fi
adb reboot
if [ -n "$AVD_TEST_VERBOSE" ]; then
adb logcat &
fi
wait_emu wait_for_boot
test_app
@ -147,9 +143,6 @@ run_test() {
fi
emu_args="$emu_args_base -memory $memory"
if [ -n "$AVD_TEST_VERBOSE" ]; then
emu_args="$emu_args -show-kernel"
fi
# Setup emulator
"$sdk" --channel=3 $pkg
@ -157,12 +150,15 @@ run_test() {
# Launch stock emulator
print_title "* Launching $pkg"
"$emu" @test $emu_args 2>/dev/null &
"$emu" @test $emu_args >/dev/null 2>&1 &
emu_pid=$!
wait_emu wait_for_bootanim
# Update arguments for Magisk runs
emu_args="$emu_args -ramdisk magisk_patched.img -feature -SystemAsRoot"
if [ -n "$AVD_TEST_LOG" ]; then
emu_args="$emu_args -show-kernel -logcat '' -logcat-output logcat.log"
fi
# Patch and test debug build
./build.py avd_patch -s "$ramdisk" magisk_patched.img