Message ID | 20190705160421.19015-4-alex.bennee@linaro.org |
---|---|
State | Superseded |
Headers | show |
Series | tcg tests and gdbstub fixes | expand |
On 7/5/19 6:04 PM, Alex Bennée wrote: > +diff-out = $(call quiet-command, diff -q $1.out $2 || \ > + (diff -u $1.out $2 | head -n 10 && false), \ What about (set -o pipefail; diff ... | head) ? I think we already rely on bash, right? r~
Richard Henderson <richard.henderson@linaro.org> writes: > On 7/5/19 6:04 PM, Alex Bennée wrote: >> +diff-out = $(call quiet-command, diff -q $1.out $2 || \ >> + (diff -u $1.out $2 | head -n 10 && false), \ > > What about (set -o pipefail; diff ... | head) ? > I think we already rely on bash, right? I don't think so - we assume POSIX shell for configure and AFAICT we don't do anything special in the make system to set the shell type to bash. -- Alex Bennée
diff --git a/tests/tcg/Makefile b/tests/tcg/Makefile index 6fa63cc8d5..7973cd1ba2 100644 --- a/tests/tcg/Makefile +++ b/tests/tcg/Makefile @@ -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
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 | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) -- 2.20.1