]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
tests/tcg: fix diff-out pass to properly report failure
authorAlex Bennée <alex.bennee@linaro.org>
Fri, 5 Jul 2019 11:56:35 +0000 (12:56 +0100)
committerAlex Bennée <alex.bennee@linaro.org>
Wed, 10 Jul 2019 09:31:22 +0000 (10:31 +0100)
A side effect of piping the output to head is squash the exit status
of the diff command. Fix this by only doing the pipe if the diff
failed and then ensuring the status is non-zero.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
tests/tcg/Makefile

index 6fa63cc8d53a07c35f6b270428c11907b29efd18..9f567686240642be30b151a4ef07491d1bec1396 100644 (file)
@@ -45,7 +45,11 @@ 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")
+# to work around the pipe squashing the status we only pipe the result if
+# we know it failed and then force failure at the end.
+diff-out = $(call quiet-command, diff -q $1.out $2 || \
+                                 (diff -u $1.out $2 | head -n 10 && false), \
+                                 "DIFF","$1.out with $2")
 
 # $1 = test name, $2 = reason
 skip-test = @printf "  SKIPPED %s on $(TARGET_NAME) because %s\n" $1 $2