diff mbox series

[PULL,09/26] tests/tcg: split run-test into user and system variants

Message ID 20190312170931.25013-10-alex.bennee@linaro.org
State New
Headers show
Series [PULL,01/26] travis: Bump Xcode 10 image to 10.2 | expand

Commit Message

Alex Bennée March 12, 2019, 5:09 p.m. UTC
We can't rely on shell redirect magic to get things right so lets
setup a common output chardev that is expecting to write to files. As
we have split run-test up we might as well move the default monitor
bits into the call.

Finally a little make sophistry is required to correctly quote
$(COMMA) and as we don't inherit common rules we have our own little
copy here.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
diff mbox series

Patch

diff --git a/tests/tcg/Makefile b/tests/tcg/Makefile
index 454d0a4119..d26a36df61 100644
--- a/tests/tcg/Makefile
+++ b/tests/tcg/Makefile
@@ -32,10 +32,17 @@ 
 -include ../../config-host.mak
 -include ../config-target.mak
 
+# for including , in command strings
+COMMA := ,
+
 quiet-command = $(if $(V),$1,$(if $(2),@printf "  %-7s %s\n" $2 $3 && $1, @$1))
 
 # $1 = test name, $2 = cmd, $3 = desc
+ifdef CONFIG_USER_ONLY
 run-test = $(call quiet-command, timeout $(TIMEOUT) $2 > $1.out,"TEST",$3)
+else
+run-test = $(call quiet-command, timeout $(TIMEOUT) $2,"TEST",$3)
+endif
 
 # $1 = test name, $2 = reference
 diff-out = $(call quiet-command, diff -u $1.out $2 | head -n 10,"DIFF","$1.out with $2")
@@ -54,11 +61,10 @@  LDFLAGS=
 # The QEMU for this TARGET
 ifdef CONFIG_USER_ONLY
 QEMU=../qemu-$(TARGET_NAME)
-QEMU_OPTS=
 else
 QEMU=../qemu-system-$(TARGET_NAME)
-QEMU_OPTS=-monitor none -display none
 endif
+QEMU_OPTS=
 
 
 # If TCG debugging is enabled things are a lot slower
@@ -110,8 +116,17 @@  all: $(TESTS)
 RUN_TESTS=$(patsubst %,run-%, $(TESTS))
 RUN_TESTS+=$(EXTRA_RUNS)
 
+ifdef CONFIG_USER_ONLY
 run-%: %
 	$(call run-test, $<, $(QEMU) $(QEMU_OPTS) $<, "$< on $(TARGET_NAME)")
+else
+run-%: %
+	$(call run-test, $<, \
+	  $(QEMU) -monitor none -display none \
+		  -chardev file$(COMMA)path=$<.out$(COMMA)id=output \
+	   	  $(QEMU_OPTS) $<, \
+	  "$< on $(TARGET_NAME)")
+endif
 
 .PHONY: run
 run: $(RUN_TESTS)