[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [XEN PATCH] CI: Rework RISCV smoke test
Currently, the test rely on QEMU and Xen finishing the boot in under two seconds. That's both very long and very short. Xen usually managed to print "All set up" under a second. Unless for some reason we try to run the test on a machine that's busy doing something else. Rework the test to exit as soon as Xen is done. There's two `tail -f`, the first one is there simply to monitor test progress in GitLab console. The second one is used to detect the test result as soon as QEMU add it to the file. Both `tail` exit as soon as QEMU exit. If QEMU fails at start, and exit early, both `tail` will simply exit, resulting in a failure. If the line we are looking for is never printed, the `timeout` on the second `tail` will force the test to exit with an error. Signed-off-by: Anthony PERARD <anthony.perard@xxxxxxxxxx> --- Notes: The "machine might be busy" bits refere to having a gitlab-runner running two jobs, one been a build with no restriction on CPU resource use. We could use "-daemonize" with "-pidfile" to more easly detect qemu's initialisation failure, but needs "-display none" instead of "-nographic" automation/scripts/qemu-smoke-riscv64.sh | 32 ++++++++++++++++++------ 1 file changed, 24 insertions(+), 8 deletions(-) diff --git a/automation/scripts/qemu-smoke-riscv64.sh b/automation/scripts/qemu-smoke-riscv64.sh index 4008191302..ba7b61db8b 100755 --- a/automation/scripts/qemu-smoke-riscv64.sh +++ b/automation/scripts/qemu-smoke-riscv64.sh @@ -2,19 +2,35 @@ set -ex -# Run the test -rm -f smoke.serial -set +e +# Truncate or create serial output file +echo -n > smoke.serial -timeout -k 1 2 \ +# cleanup: kill QEMU when the script exit for any reason +qemu_pid= +cleanup() { + if [ "$qemu_pid" ]; then + kill -s SIGKILL "$qemu_pid" + fi +} + +trap 'cleanup' EXIT + +# Run the test qemu-system-riscv64 \ -M virt \ -smp 1 \ -nographic \ -m 2g \ + -monitor none \ + -chardev file,id=serial-out,path=smoke.serial \ + -serial chardev:serial-out \ -kernel binaries/xen \ - |& tee smoke.serial + & +qemu_pid=$! -set -e -(grep -q "All set up" smoke.serial) || exit 1 -exit 0 +# Monitor test progression until QEMU exit +tail --pid=$qemu_pid -f smoke.serial & + +# Check boot test result +timeout 60 tail --pid=$qemu_pid -f smoke.serial | \ + grep -a -q "All set up" -- Anthony PERARD
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |