rtfb / riscv-hobby-os

Other
27 stars 5 forks source link

Unbreak integration tests #43

Closed rtfb closed 2 years ago

rtfb commented 2 years ago

The integration tests introduced in 10628f998f0cd67c2443e2af10513b1f0793e26f seem to be broken now. qemu-launcher.py fails to capture the stdout from qemu on the github test machines, while it works as expected on my dev box.

The failure looks like this:

Run make out/test-output-u64.txt
ls: cannot access 'sifive-freedom-toolchain': No such file or directory
riscv64-linux-gnu-gcc -march=rv64g -mabi=lp64 -static -mcmodel=medany -fvisibility=hidden -nostdlib -nostartfiles -ffreestanding -Tsrc/baremetal.ld -Iinclude \
    src/boot.s src/baremetal-print.s src/baremetal-poweroff.s src/userland.c src/kernel.c src/syscalls.c src/pmp.c src/riscv.c src/fdt.c src/string.c src/proc_test.c -o out/user_sifive_u
./scripts/qemu-launcher.py:131: RuntimeWarning: line buffering (buffering=1) isn't supported in binary mode, the default buffer size will be used
  with io.open(filename, 'wb') as writer, io.open(filename, 'rb', 1) as reader:
--- testdata/want-output-u64.txt    2021-12-06 20:10:40.225999287 +0000
+++ out/test-output-u64.txt 2021-12-06 20:11:47.642941334 +0000
make: *** [Makefile:87: out/test-output-u64.txt] Error 1
@@ -1,8 +1,3 @@
-Hello from M-mode!
-kinit
-Reading FDT...
-FDT ok
-bootargs: dry-run
-000000000000f10a
-KKKK
+q
 qemu-launcher: killing qemu due to timeout
+emu-system-riscv64: terminating on signal 15 from pid 3995 (python3)
Error: Process completed with exit code 2.

Qemu seems to produce none of the expected output, and prints an unexpected string qemu-system-riscv64: terminating on signal 15 from pid 3995 (python3) instead, which is interlaced with qemu-launcher: killing qemu due to timeout, which is printf'ed directly from qemu-launcher.py.

rtfb commented 2 years ago

Actually, the failure is not consistent, sometimes there is some of the expected output, but not all of it:

--- testdata/want-output-u64.txt    2022-01-02 11:17:31.788702043 +0000
+++ out/test-output-u64.txt 2022-01-02 11:18:11.257047491 +0000
@@ -1,8 +1,5 @@
 kinit: cpu 0000000000000000
 Reading FDT...
-FDT ok
-bootargs: dry-run
-000000000000f10a
-cpu parked: 0000000000000001
-KKKK
+q
 qemu-launcher: killing qemu due to timeout
+emu-system-riscv64: terminating on signal 15 from pid 4061 (python3)
make: *** [Makefile:94: out/test-output-u64.txt] Error 1
Error: Process completed with exit code 2.