Better printouts for unit test runs
- Prints whether a test crashed or timed out
- Prints the configuration used for the test
Signed-off-by: Fuad Tabba <tabba@google.com>
diff --git a/aarch64-unit-tests/run_emu.sh b/aarch64-unit-tests/run_emu.sh
index 73ed673..3975587 100755
--- a/aarch64-unit-tests/run_emu.sh
+++ b/aarch64-unit-tests/run_emu.sh
@@ -25,6 +25,8 @@
ROOTFS=$3
QEMU=$4
VHE=$5
+LOG_FILE=$6
+TEST_NAME=$7
CPU=""
# Assume that the roms are located with the disk image.
@@ -70,5 +72,14 @@
-drive file="${ROOTFS}",readonly,if=virtio,format=raw \
-drive file="${TEST_FILE}",readonly,if=virtio,format=raw \
-object rng-random,filename=/dev/urandom,id=rng0 \
- -device virtio-rng-pci,rng=rng0
+ -device virtio-rng-pci,rng=rng0 &> "${LOG_FILE}"
+EXIT_STATUS=$?
+RESULT=$(grep -E -h --color=never "[^ ](PASS|FAIL|SKIP)[^:]" "${LOG_FILE}")
+if [ -z "${RESULT}" ]; then
+ RESULT="\e[31;1mTIMEOUT/CRASH\e[0m"
+ EXIT_STATUS=1
+fi
+
+echo -e "${TEST_NAME}: ${RESULT}"
+exit ${EXIT_STATUS}
diff --git a/aarch64-unit-tests/run_tests.sh b/aarch64-unit-tests/run_tests.sh
index 19e4a53..3d6090d 100755
--- a/aarch64-unit-tests/run_tests.sh
+++ b/aarch64-unit-tests/run_tests.sh
@@ -168,7 +168,7 @@
fi
# Redirect output instead of pipe to preserve exit status.
- run_job "${script_dir}/run_emu.sh ${test} ${linux} ${rootfs} ${qemu} ${VHE} &> >(tee $log_dir/logs/vhe/${test_name}.log | grep -E -h --color=never \"[^ ](PASS|FAIL|SKIP)[^:]\")"
- run_job "${script_dir}/run_emu.sh ${test} ${linux} ${rootfs} ${qemu} ${NVHE} &> >(tee $log_dir/logs/nvhe/${test_name}.log | grep -E -h --color=never \"[^ ](PASS|FAIL|SKIP)[^:]\")"
+ run_job "${script_dir}/run_emu.sh ${test} ${linux} ${rootfs} ${qemu} ${VHE} ${log_dir}/logs/vhe/${test_name}.log \"${test_name} (vhe)\" &> >(tail -1)"
+ run_job "${script_dir}/run_emu.sh ${test} ${linux} ${rootfs} ${qemu} ${NVHE} ${log_dir}/logs/nvhe/${test_name}.log \"${test_name} (nvhe)\" &> >(tail -1)"
done
wait