ctdb-tests: Add "ctdb listnodes" and "ctdb xpnn" stub tests
[Samba.git] / ctdb / tests / tool / scripts / local.sh
blob8d7d56c0c622dd8af8061613698406a36cf91bb8
1 # Hey Emacs, this is a -*- shell-script -*- !!! :-)
3 if "$TEST_VERBOSE" ; then
4 debug () { echo "$@" ; }
5 else
6 debug () { : ; }
7 fi
9 define_test ()
11 _f=$(basename "$0" ".sh")
13 case "$_f" in
14 func.*)
15 _func="${_f#func.}"
16 _func="${_func%.*}" # Strip test number
17 test_prog="ctdb_functest ${_func}"
19 stubby.*)
20 _cmd="${_f#stubby.}"
21 _cmd="${_cmd%.*}" # Strip test number
22 test_prog="ctdb_stubtest ${_cmd}"
25 die "Unknown pattern for testcase \"$_f\""
26 esac
28 printf "%-28s - %s\n" "$_f" "$1"
31 setup_natgw ()
33 debug "Setting up NAT gateway"
35 natgw_config_dir="${TEST_VAR_DIR}/natgw_config"
36 mkdir -p "$natgw_config_dir"
38 # These will accumulate, 1 per test... but will be cleaned up at
39 # the end.
40 export CTDB_NATGW_NODES=$(mktemp --tmpdir="$natgw_config_dir")
42 cat >"$CTDB_NATGW_NODES"
45 setup_nodes ()
47 debug "Setting up CTDB_NODES"
49 # These will accumulate, 1 per test... but will be cleaned up at
50 # the end.
51 export CTDB_NODES=$(mktemp --tmpdir="$TEST_VAR_DIR")
53 cat >"$CTDB_NODES"
56 simple_test ()
58 _out=$($VALGRIND $test_prog "$@" 2>&1)
60 result_check