]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
ctdb-tests: Dump logs on shutdown failure
authorMartin Schwenke <martin@meltin.net>
Fri, 6 Dec 2019 05:11:45 +0000 (16:11 +1100)
committerAmitay Isaacs <amitay@samba.org>
Tue, 18 Feb 2020 02:56:38 +0000 (02:56 +0000)
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
ctdb/tests/scripts/integration_local_daemons.bash

index a2b4e2aee67452d9e7baf722a2750d9c7c37818d..643fc5ef8469270bd25dbb237aac95129b6861c7 100644 (file)
@@ -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
 }