summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Schwenke <martin@meltin.net>2012-04-24 10:25:50 +1000
committerMartin Schwenke <martin@meltin.net>2012-04-27 15:42:42 +1000
commit5b590dfa19bf49faf3d667fee7bfa04df3fcbbe5 (patch)
treef2cc4fc64c3449d835b1e9d08e126d80220c7421
parent7ed438799044c186b55f9575415faa8fb702e521 (diff)
downloadsamba-5b590dfa19bf49faf3d667fee7bfa04df3fcbbe5.tar.gz
samba-5b590dfa19bf49faf3d667fee7bfa04df3fcbbe5.tar.xz
samba-5b590dfa19bf49faf3d667fee7bfa04df3fcbbe5.zip
tests: Add a -V option to set new variable TEST_VAR_DIR
Part of preparation to be able to install the tests. The current var/ subdirectories will end up somewhere in /usr/local/ or /usr/ and we don't want to put temporary files there. This creates a temporary TEST_VAR_DIR by default. If -V is specified then the given directory will be used as TEST_VAR_DIR. This allows the current behaviour where individual integration tests can be run against already-running daemons 9with sockets and other stuff already created) to save time and trouble. Yes, there are plans for a clean-up option... ;-) Signed-off-by: Martin Schwenke <martin@meltin.net> (This used to be ctdb commit 8e4ec9a40bb7d392d7474b067a74fa121c069007)
-rwxr-xr-xctdb/tests/scripts/run_tests33
1 files changed, 21 insertions, 12 deletions
diff --git a/ctdb/tests/scripts/run_tests b/ctdb/tests/scripts/run_tests
index d4eab4d847..ced884837d 100755
--- a/ctdb/tests/scripts/run_tests
+++ b/ctdb/tests/scripts/run_tests
@@ -5,17 +5,18 @@ usage() {
Usage: run_tests [OPTIONS] [TESTS]
Options:
- -s Print a summary of tests results after running all tests
- -l Use local daemons for integration tests
- -e Exit on the first test failure
- -v Verbose - print test output for non-failures (only some tests)
- -A Use "cat -A" to print test output (only some tests)
- -D Show diff between failed/expected test output (some tests only)
- -X Trace certain scripts run by tests using -x (only some tests)
- -d Print descriptions of tests instead of filenames (dodgy!)
- -H No headers - for running single test with other wrapper
- -q Quiet - don't show tests being run (hint: use with -s)
- -x Trace this script with the -x option
+ -s Print a summary of tests results after running all tests
+ -l Use local daemons for integration tests
+ -e Exit on the first test failure
+ -V <dir> Use <dir> as $TEST_VAR_DIR
+ -v Verbose - print test output for non-failures (only some tests)
+ -A Use "cat -A" to print test output (only some tests)
+ -D Show diff between failed/expected test output (some tests only)
+ -X Trace certain scripts run by tests using -x (only some tests)
+ -d Print descriptions of tests instead of filenames (dodgy!)
+ -H No headers - for running single test with other wrapper
+ -q Quiet - don't show tests being run (hint: use with -s)
+ -x Trace this script with the -x option
EOF
exit 1
}
@@ -39,8 +40,9 @@ export TEST_COMMAND_TRACE=false
export TEST_CAT_RESULTS_OPTS=""
export TEST_DIFF_RESULTS=false
export TEST_LOCAL_DAEMONS # No default, developer can "override"!
+export TEST_VAR_DIR=""
-temp=$(getopt -n "$prog" -o "xdehlqsvXADH" -l help -- "$@")
+temp=$(getopt -n "$prog" -o "xdehlqsvV:XADH" -l help -- "$@")
[ $? != 0 ] && usage
@@ -55,6 +57,7 @@ while true ; do
-q) quiet=true ; shift ;;
-s) with_summary=true ; shift ;;
-v) TEST_VERBOSE=true ; shift ;;
+ -V) TEST_VAR_DIR="$2" ; shift 2 ;;
-X) TEST_COMMAND_TRACE=true ; shift ;;
-A) TEST_CAT_RESULTS_OPTS="-A" ; shift ;;
-D) TEST_DIFF_RESULTS=true ; shift ;;
@@ -169,6 +172,12 @@ run_one_test ()
fi
}
+[ -n "$TEST_VAR_DIR" ] || TEST_VAR_DIR=$(mktemp -d)
+mkdir -p "$TEST_VAR_DIR"
+# Must be absolute
+TEST_VAR_DIR=$(cd "$TEST_VAR_DIR"; echo "$PWD")
+echo "TEST_VAR_DIR=$TEST_VAR_DIR"
+
for f ; do
if [ -d "$f" ] ; then
for i in $(ls "${f%/}/"*".sh" 2>/dev/null) ; do