1 # Hey Emacs, this is a -*- shell-script -*- !!! :-)
3 hdir
="$CTDB_SCRIPTS_HELPER_BINDIR"
4 export CTDB_EVENT_HELPER
="${hdir}/ctdb-event"
6 if $CTDB_TESTS_ARE_INSTALLED ; then
8 helper
="ctdb_local_daemons"
10 helper
="${CTDB_TEST_DIR}/local_daemons.sh"
13 ctdb_local_daemons
="${helper} ${CTDB_TEST_TMP_DIR}"
15 #######################################
19 local no_event_scripts
=false
21 # All other options are passed through to local_daemons.sh setup
23 --no-event-scripts) no_event_scripts
=true
; shift ;;
26 $ctdb_local_daemons setup
"$@" \
27 -n "$CTDB_TEST_LOCAL_DAEMONS" \
28 ${CTDB_USE_IPV6:+-6} \
29 ${CTDB_TEST_SWRAP_SO_PATH:+-S ${CTDB_TEST_SWRAP_SO_PATH}}
30 # Burying the above in an if-statement condition reduces readability.
31 # shellcheck disable=SC2181
32 if [ $?
-ne 0 ] ; then
36 if $no_event_scripts ; then
37 # Want CTDB_BASE expanded when executed under onnode
38 # shellcheck disable=SC2016
39 $ctdb_local_daemons onnode
-q all \
40 'rm "${CTDB_BASE}/events/legacy/"*'
43 if $CTDB_TEST_PRINT_LOGS_ON_ERROR ; then
44 ctdb_test_exit_hook_add _print_logs_on_test_failure
50 local nodespec
="${1:-all}"
52 $ctdb_local_daemons start
"$nodespec"
57 local nodespec
="${1:-all}"
59 if $ctdb_local_daemons stop
"$nodespec" ; then
64 if $CTDB_TEST_PRINT_LOGS_ON_ERROR ; then
68 # Next level up can log the error...
74 $ctdb_local_daemons onnode
"$@"
81 echo "*** LOG START --------------------"
82 $ctdb_local_daemons print-log all |
tail -n 500
83 echo "*** LOG END --------------------"
86 _print_logs_on_test_failure
()
88 # This is called from ctdb_test_exit() where $status is available
89 # shellcheck disable=SC2154
90 if [ "$status" -eq 0 ] ; then