qemu: add 'check' and 'check-only' targets
Adds an Expect script to launch QEMU, run xtest and return a pass/fail
status. This makes it even easier to launch non-regression tests and
possibly integrate into a CI loop.
The script may be invoked through 'make check' or 'make check-only'.
The former considers dependencies, while the latter just runs the script.
The output of serial ports 0 and 1 are saved to serial0.log and
serial1.log, respectively.
Expect may be installed with 'sudo apt-get install expect' on Debian/
Ubuntu distributions.
Sample output:
$ make -j9 check
<snip>
expect qemu-check.exp -- \
--bios /home/jerome/work/optee_repo/out/bios-qemu/bios.bin
Starting QEMU... done, guest is booted.
Loading OP-TEE driver and tee-supplicant... done.
Running: xtest...
##########################################<snip>
Status: PASS (404 test cases)
Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>
Reviewed-by: Pascal Brand <pascal.brand@linaro.org>
diff --git a/qemu.mk b/qemu.mk
index 800f398..1b1930e 100644
--- a/qemu.mk
+++ b/qemu.mk
@@ -39,7 +39,8 @@
################################################################################
all: bios-qemu linux optee-os optee-client optee-linuxdriver qemu soc-term xtest
all-clean: bios-qemu-clean busybox-clean linux-clean optee-os-clean \
- optee-client-clean optee-linuxdriver-clean qemu-clean soc-term-clean
+ optee-client-clean optee-linuxdriver-clean qemu-clean soc-term-clean \
+ check-clean
-include toolchain.mk
@@ -265,3 +266,16 @@
-m 1057 \
-bios $(ROOT)/out/bios-qemu/bios.bin
+
+ifneq ($(filter check,$(MAKECMDGOALS)),)
+CHECK_DEPS := all
+endif
+
+check: $(CHECK_DEPS)
+ expect qemu-check.exp -- \
+ --bios $(ROOT)/out/bios-qemu/bios.bin
+
+check-only: check
+
+check-clean:
+ rm -f serial0.log serial1.log