]> granicus.if.org Git - strace/commitdiff
tests/init.sh: print exit code of failed commands
authorDmitry V. Levin <ldv@altlinux.org>
Sat, 13 Aug 2016 22:05:20 +0000 (22:05 +0000)
committerDmitry V. Levin <ldv@altlinux.org>
Sat, 13 Aug 2016 22:05:20 +0000 (22:05 +0000)
* 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.

tests/init.sh

index b6fa522f292bd39a8014fee3bf93eca991844df0..46a08f95ea6aeca84f12627b6ed30cfabadcd636 100644 (file)
@@ -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]*
 }