blob: 385e2ad64b4d997f11e3c5a7eff760593de11f98 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
# Hey Emacs, this is a -*- shell-script -*- !!! :-)
if "$TEST_VERBOSE" ; then
debug () { echo "$@" ; }
else
debug () { : ; }
fi
define_test ()
{
_f=$(basename "$0" ".sh")
case "$_f" in
func.*)
_func="${_f#func.}"
_func="${_func%.*}" # Strip test number
test_prog="ctdb_functest ${_func}"
;;
stubby.*)
_cmd="${_f#stubby.}"
_cmd="${_cmd%.*}" # Strip test number
test_prog="ctdb_stubtest ${_cmd}"
;;
*)
die "Unknown pattern for testcase \"$_f\""
esac
printf "%-28s - %s\n" "$_f" "$1"
}
setup_natgw ()
{
debug "Setting up NAT gateway"
natgw_config_dir="${TEST_VAR_DIR}/natgw_config"
mkdir -p "$natgw_config_dir"
# These will accumulate, 1 per test... but will be cleaned up at
# the end.
export CTDB_NATGW_NODES=$(mktemp --tmpdir="$natgw_config_dir")
cat >"$CTDB_NATGW_NODES"
}
simple_test ()
{
# Most of the tests when the tool fails will have a date/time/pid
# prefix. Strip that because it isn't possible to match it.
if [ $required_rc -ne 0 ] ; then
OUT_FILTER='s@^[0-9/]+\ [0-9:\.]+\ \[[\ 0-9]+\]:@DATE\ TIME\ \[PID\]:@'
fi
_out=$($VALGRIND $test_prog "$@" 2>&1)
result_check
}
|