summaryrefslogtreecommitdiffstats
path: root/ctdb/tests/onnode
diff options
context:
space:
mode:
authorMartin Schwenke <martin@meltin.net>2012-04-18 10:37:45 +1000
committerMartin Schwenke <martin@meltin.net>2012-04-18 10:37:45 +1000
commit116f19b808ace4a74bcf56a638923dcd1e1e975d (patch)
tree7ede5873ee56d35ac12483e44a365438acb9e171 /ctdb/tests/onnode
parent6e05811c28730e604c4ef7dab4b701214f61e51a (diff)
downloadsamba-116f19b808ace4a74bcf56a638923dcd1e1e975d.tar.gz
samba-116f19b808ace4a74bcf56a638923dcd1e1e975d.tar.xz
samba-116f19b808ace4a74bcf56a638923dcd1e1e975d.zip
tests: More unit test factoring/rationalisation and bug fixes
Move some options from eventscripts/run_tests.sh to scripts/run_tests. Remove the former. Move some functions from eventscripts/scripts/local.sh to scripts/unit.sh. Both of these are modified during move so they are no longer eventscript-specific. Tweak */local.sh so that the new functions in unit.sh are used. Signed-off-by: Martin Schwenke <martin@meltin.net> (This used to be ctdb commit 7ff485687891732074c9fc9998502ca197663d02)
Diffstat (limited to 'ctdb/tests/onnode')
-rw-r--r--ctdb/tests/onnode/scripts/local.sh35
1 files changed, 14 insertions, 21 deletions
diff --git a/ctdb/tests/onnode/scripts/local.sh b/ctdb/tests/onnode/scripts/local.sh
index a990c695f8..d6dd41c293 100644
--- a/ctdb/tests/onnode/scripts/local.sh
+++ b/ctdb/tests/onnode/scripts/local.sh
@@ -49,10 +49,14 @@ ctdb_set_output ()
trap "rm -f $_out $_rc" 0
}
-required_result ()
+_extra_header ()
{
- required_rc="${1:-0}"
- required_output=$(cat)
+ cat <<EOF
+CTDB_NODES_FILE="${CTDB_NODES_FILE}"
+CTDB_BASE="$CTDB_BASE"
+$(which ctdb)
+
+EOF
}
simple_test ()
@@ -62,27 +66,16 @@ simple_test ()
shift
_sort="sort"
fi
+
_out=$("$@" 2>&1)
_rc=$?
_out=$(echo "$_out" | $_sort )
- if [ "$_out" = "$required_output" -a $_rc = $required_rc ] ; then
- echo "PASSED"
- else
- cat <<EOF
-CTDB_NODES_FILE="${CTDB_NODES_FILE}"
-CTDB_BASE="$CTDB_BASE"
-$(which ctdb)
+ # Can't do this inline or it affects return code
+ _extra_header="$(_extra_header)"
-##################################################
-Required output (Exit status: ${required_rc}):
-##################################################
-$required_output
-##################################################
-Actual output (Exit status: ${_rc}):
-##################################################
-$_out
-EOF
- return 1
- fi
+ # Get the return code back into $?
+ (exit $_rc)
+
+ result_check "$_extra_header"
}