From: Martin Schwenke Date: Fri, 6 Dec 2019 05:11:45 +0000 (+1100) Subject: ctdb-tests: Dump logs on shutdown failure X-Git-Tag: ldb-2.1.1~73 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=455d931a16815f3b8ee47e2b1d5aeb13e76568b2;p=thirdparty%2Fsamba.git ctdb-tests: Dump logs on shutdown failure Signed-off-by: Martin Schwenke Reviewed-by: Amitay Isaacs --- diff --git a/ctdb/tests/scripts/integration_local_daemons.bash b/ctdb/tests/scripts/integration_local_daemons.bash index a2b4e2aee67..643fc5ef846 100644 --- a/ctdb/tests/scripts/integration_local_daemons.bash +++ b/ctdb/tests/scripts/integration_local_daemons.bash @@ -56,7 +56,17 @@ ctdb_nodes_stop () { local nodespec="${1:-all}" - $ctdb_local_daemons stop "$nodespec" + if $ctdb_local_daemons stop "$nodespec" ; then + return 0 + fi + + # Failed, dump logs? + if $CTDB_TEST_PRINT_LOGS_ON_ERROR ; then + _print_logs + fi + + # Next level up can log the error... + return 1 } onnode () @@ -64,6 +74,15 @@ onnode () $ctdb_local_daemons onnode "$@" } + + +_print_logs () +{ + echo "*** LOG START --------------------" + $ctdb_local_daemons print-log all | tail -n 500 + echo "*** LOG END --------------------" +} + _print_logs_on_test_failure () { # This is called from ctdb_test_exit() where $status is available @@ -72,7 +91,5 @@ _print_logs_on_test_failure () return fi - echo "*** LOG START --------------------" - $ctdb_local_daemons print-log all | tail -n 500 - echo "*** LOG END --------------------" + _print_logs }