blob: 5b830c876974717cba87d673a2813bbc5e91e298 (
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
57
58
59
60
61
62
63
64
|
# Hey Emacs, this is a -*- shell-script -*- !!! :-)
# Default to just "onnode".
: ${ONNODE:=onnode}
# Augment PATH with relevant stubs/ directory
stubs_dir="${CTDB_TEST_SUITE_DIR}/stubs"
[ -d "${stubs_dir}" ] || die "Failed to locate stubs/ subdirectory"
PATH="${stubs_dir}:${PATH}"
setup_ctdb_base "$CTDB_TEST_TMP_DIR" "etc-ctdb" \
functions
define_test ()
{
_f=$(basename "$0")
echo "$_f $1 - $2"
}
# Set output for ctdb command. Option 1st argument is return code.
ctdb_set_output ()
{
_out="${CTDB_TEST_TMP_DIR}/ctdb.out"
cat >"$_out"
_rc="${CTDB_TEST_TMP_DIR}/ctdb.rc"
echo "${1:-0}" >"$_rc"
test_cleanup "rm -f $_out $_rc"
}
extra_footer ()
{
cat <<EOF
--------------------------------------------------
CTDB_BASE="$CTDB_BASE"
ctdb client is $(which ctdb)
--------------------------------------------------
EOF
}
simple_test ()
{
_sort="cat"
if [ "$1" = "-s" ] ; then
shift
_sort="sort"
fi
if $CTDB_TEST_COMMAND_TRACE ; then
_onnode=$(which "$1") ; shift
_out=$(bash -x "$_onnode" "$@" 2>&1)
else
_out=$("$@" 2>&1)
fi
_rc=$?
_out=$(echo "$_out" | $_sort )
# Get the return code back into $?
(exit $_rc)
result_check
}
|