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 - name: Run AVD test
timeout-minutes: 10 timeout-minutes: 10
env: env:
AVD_TEST_VERBOSE: 1 AVD_TEST_LOG: 1
run: scripts/avd_test.sh ${{ matrix.version }} ${{ matrix.type }} 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: avd-test-32:
name: Test API ${{ matrix.version }} (x86) name: Test API ${{ matrix.version }} (x86)
runs-on: ubuntu-latest runs-on: ubuntu-latest
@ -148,9 +157,18 @@ jobs:
timeout-minutes: 10 timeout-minutes: 10
env: env:
FORCE_32_BIT: 1 FORCE_32_BIT: 1
AVD_TEST_VERBOSE: 1 AVD_TEST_LOG: 1
run: scripts/avd_test.sh ${{ matrix.version }} 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: cf_test:
name: Test ${{ matrix.branch }} (${{ matrix.target }}) name: Test ${{ matrix.branch }} (${{ matrix.target }})
runs-on: ubuntu-24.04 runs-on: ubuntu-24.04

View File

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