]> git.samba.org - bbaumbach/samba-autobuild/.git/commitdiff
ctdb-tests: Capture output in $out on failure as well
authorMartin Schwenke <martin@meltin.net>
Mon, 13 May 2019 07:40:15 +0000 (17:40 +1000)
committerAmitay Isaacs <amitay@samba.org>
Tue, 14 May 2019 07:25:37 +0000 (07:25 +0000)
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13924

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
ctdb/tests/scripts/integration.bash

index 32a729d02495011159c6a85945140c35a2987f29..30725c48e5367bfe884e373efc5a898c61f3b56c 100644 (file)
@@ -104,7 +104,11 @@ try_command_on_node ()
 
     local cmd="$*"
 
-    if ! onnode -q $onnode_opts "$nodespec" "$cmd" >"$outfile" 2>&1 ; then
+    local status=0
+    onnode -q $onnode_opts "$nodespec" "$cmd" >"$outfile" 2>&1 || status=$?
+    out=$(dd if="$outfile" bs=1k count=1 2>/dev/null)
+
+    if [ $status -ne 0 ] ; then
        echo "Failed to execute \"$cmd\" on node(s) \"$nodespec\""
        cat "$outfile"
        return 1
@@ -114,8 +118,6 @@ try_command_on_node ()
        echo "Output of \"$cmd\":"
        cat "$outfile"
     fi
-
-    out=$(dd if="$outfile" bs=1k count=1 2>/dev/null)
 }
 
 sanity_check_output ()