summaryrefslogtreecommitdiffstats
path: root/ctdb/tests/run_tests.sh
diff options
context:
space:
mode:
authorMartin Schwenke <martin@meltin.net>2012-05-14 11:57:20 +1000
committerMartin Schwenke <martin@meltin.net>2012-05-14 15:02:19 +1000
commit594601bdad81f0211e5c9f844e81262ede06c3b6 (patch)
tree76f77b7cde5d63138180768a352e689540fdbc13 /ctdb/tests/run_tests.sh
parentb8e9a3e54d5e524df6a1c08a2cbbe1ce894fbf58 (diff)
downloadsamba-594601bdad81f0211e5c9f844e81262ede06c3b6.tar.gz
samba-594601bdad81f0211e5c9f844e81262ede06c3b6.tar.xz
samba-594601bdad81f0211e5c9f844e81262ede06c3b6.zip
tests: Fix wrapper scripts to handle options and tests without breakage
If the -V option is given and no tests are supplied, the "cd" command in run_tests.sh cause scripts/run_tests to interpret the argument to -V incorrectly. Therefore, the wrapper scripts can't use "cd" because they don't know what the options are doing! Instead scripts/run_tests searches for each test relative to the current directory and, if not previously found, then searches relative to the top-level tests directory. This is a much better way of doing things. Given that run_tests.sh and run_cluster_tests.sh were starting to contain duplicate complex logic, remove run_cluster_tests.sh and replace it with a symlink to run_tests.sh. Run_tests.sh checks $0 to see what options/defaults to use. Update INSTALL to deal with this. Signed-off-by: Martin Schwenke <martin@meltin.net> (This used to be ctdb commit ed2db1f4e8d2b222d7f912a4a007ce48a23e83b0)
Diffstat (limited to 'ctdb/tests/run_tests.sh')
-rwxr-xr-xctdb/tests/run_tests.sh30
1 files changed, 19 insertions, 11 deletions
diff --git a/ctdb/tests/run_tests.sh b/ctdb/tests/run_tests.sh
index cd90bbbb97..50924fcf25 100755
--- a/ctdb/tests/run_tests.sh
+++ b/ctdb/tests/run_tests.sh
@@ -2,10 +2,25 @@
test_dir=$(dirname "$0")
+case $(basename "$0") in
+ *run_cluster_tests*)
+ # Running on a cluster:
+ # * print summary, run any integration tests against cluster
+ # * default to running: all integration tests, no unit tests
+ opts="-s"
+ tests="simple complex"
+ ;;
+ *)
+ # Running on local machine:
+ # * print summary, run any integration tests against local daemons
+ # * default to running: all unit tests, simple integration tests
+ opts="-s -l"
+ tests="onnode takeover tool eventscripts simple"
+esac
+
# Allow options to be passed to this script. However, if any options
# are passed there must be a "--" between the options and the tests.
# This makes it easy to handle options that take arguments.
-opts=""
case "$1" in
-*)
while [ -n "$1" ] ; do
@@ -16,17 +31,10 @@ case "$1" in
done
esac
-if [ -n "$1" ] ; then
- "${test_dir}/scripts/run_tests" -l -s $opts "$@" || exit 1
-else
- cd "$test_dir"
-
- # By default, run all unit tests and the tests against local
- # daemons
- dirs="onnode takeover tool eventscripts simple"
+# If no tests specified them run the defaults.
+[ -n "$1" ] || set -- $tests
- ./scripts/run_tests -l -s $opts $dirs || exit 1
-fi
+"${test_dir}/scripts/run_tests" $opts "$@" || exit 1
echo "All OK"
exit 0