From: Martin Schwenke Date: Mon, 13 May 2019 07:40:15 +0000 (+1000) Subject: ctdb-tests: Capture output in $out on failure as well X-Git-Tag: tdb-1.4.1~63 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=cf00db40355b49443263187f9d97934f91287e51;p=thirdparty%2Fsamba.git ctdb-tests: Capture output in $out on failure as well BUG: https://bugzilla.samba.org/show_bug.cgi?id=13924 Signed-off-by: Martin Schwenke Reviewed-by: Amitay Isaacs --- diff --git a/ctdb/tests/scripts/integration.bash b/ctdb/tests/scripts/integration.bash index 32a729d0249..30725c48e53 100644 --- a/ctdb/tests/scripts/integration.bash +++ b/ctdb/tests/scripts/integration.bash @@ -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 ()