From: Dmitry V. Levin Date: Sat, 13 Aug 2016 22:05:20 +0000 (+0000) Subject: tests/init.sh: print exit code of failed commands X-Git-Tag: v4.14~200 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e4e9df22597e8a58a47e01beddc76077ea62a447;p=strace tests/init.sh: print exit code of failed commands * init.sh (run_prog, run_prog_skip_if_failed): When the program fails, add its exit code to the diagnostic message. (run_strace): When strace fails, add its exit code to the diagnostic message. (run_strace_merge): When strace-log-merge fails, add its exit code to the diagnostic message. --- diff --git a/tests/init.sh b/tests/init.sh index b6fa522f..46a08f95 100644 --- a/tests/init.sh +++ b/tests/init.sh @@ -56,10 +56,11 @@ run_prog() fi args="$*" "$@" || { - if [ $? -eq 77 ]; then + rc=$? + if [ $rc -eq 77 ]; then skip_ "$args exited with code 77" else - fail_ "$args failed" + fail_ "$args failed with code $rc" fi } } @@ -68,7 +69,7 @@ run_prog() run_prog_skip_if_failed() { args="$*" - "$@" || framework_skip_ "$args failed" + "$@" || framework_skip_ "$args failed with code $?" } run_strace() @@ -76,7 +77,7 @@ run_strace() > "$LOG" || fail_ "failed to write $LOG" args="$*" $STRACE -o "$LOG" "$@" || - dump_log_and_fail_with "$STRACE $args failed" + dump_log_and_fail_with "$STRACE $args failed with code $?" } run_strace_merge() @@ -84,7 +85,7 @@ run_strace_merge() rm -f -- "$LOG".[0-9]* run_strace -ff -tt "$@" "$srcdir"/../strace-log-merge "$LOG" > "$LOG" || - dump_log_and_fail_with 'strace-log-merge failed' + dump_log_and_fail_with 'strace-log-merge failed with code $?' rm -f -- "$LOG".[0-9]* }