1
# Hey Emacs, this is a -*- shell-script -*- !!! :-)
3
# Set indirectly by run_tests at top level.
4
unset CTDB_NODES_SOCKETS
6
# Default to just "onnode".
9
# Augment PATH with relevant stubs/ directories.
11
if [ -d "${ONNODE_TESTS_DIR}/stubs" ] ; then
12
PATH="${ONNODE_TESTS_DIR}/stubs:$PATH"
15
export ONNODE_TESTCASE_DIR=$(dirname "$0")
16
if [ $(basename "$ONNODE_TESTCASE_DIR") = "onnode" ] ; then
17
# Just a test script, no testcase subdirectory.
18
ONNODE_TESTCASE_DIR="$ONNODE_TESTS_DIR"
20
if [ -d "${ONNODE_TESTCASE_DIR}/stubs" ] ; then
21
PATH="${ONNODE_TESTCASE_DIR}/stubs:$PATH"
25
# Find CTDB nodes file.
26
if [ -z "$CTDB_NODES_FILE" ] ; then
27
if [ -r "${ONNODE_TESTCASE_DIR}/nodes" ] ; then
28
CTDB_NODES_FILE="${ONNODE_TESTCASE_DIR}/nodes"
29
elif [ -r "${ONNODE_TESTS_DIR}/nodes" ] ; then
30
CTDB_NODES_FILE="${ONNODE_TESTS_DIR}/nodes"
32
CTDB_NODES_FILE="${CTDB_BASE:-/etc/ctdb}/nodes"
36
export CTDB_NODES_FILE
38
export ONNODE_TESTS_VAR_DIR="${ONNODE_TESTS_DIR}/var"
39
mkdir -p "$ONNODE_TESTS_VAR_DIR"
41
if [ -z "$CTDB_BASE" ] ; then
42
export CTDB_BASE=$(dirname "$CTDB_NODES_FILE")
48
_f="${_f#./}" # strip leading ./
49
_f="${_f%%/*}" # if subdir, strip off file
50
_f="${_f%.sh}" # strip off .sh suffix if any
55
# Set output for ctdb command. Option 1st argument is return code.
58
_out="$ONNODE_TESTS_VAR_DIR/ctdb.out"
61
_rc="$ONNODE_TESTS_VAR_DIR/ctdb.rc"
62
echo "${1:-0}" >"$_rc"
64
trap "rm -f $_out $_rc" 0
70
required_output=$(cat)
76
if [ "$1" = "-s" ] ; then
82
_out=$(echo "$_out" | $_sort )
84
if [ "$_out" = "$required_output" -a $_rc = $required_rc ] ; then
88
CTDB_NODES_FILE="${CTDB_NODES_FILE}"
89
CTDB_BASE="$CTDB_BASE"
92
##################################################
93
Required output (Exit status: ${required_rc}):
94
##################################################
96
##################################################
97
Actual output (Exit status: ${_rc}):
98
##################################################