diff options
author | Martin Schwenke <martin@meltin.net> | 2012-04-16 15:29:44 +1000 |
---|---|---|
committer | Martin Schwenke <martin@meltin.net> | 2012-04-16 15:57:16 +1000 |
commit | 8c5fdb40cf950552fd094820b998bda9a580ed03 (patch) | |
tree | bcee48500201a63531b466ec4f162af02fb1e018 | |
parent | 006b18dec4d9781fc7c64b249e47aa3cf2b99d0c (diff) | |
download | samba-8c5fdb40cf950552fd094820b998bda9a580ed03.tar.gz samba-8c5fdb40cf950552fd094820b998bda9a580ed03.tar.xz samba-8c5fdb40cf950552fd094820b998bda9a580ed03.zip |
tests/onnode - Restructure according to new convention
Signed-off-by: Martin Schwenke <martin@meltin.net>
(This used to be ctdb commit 4c87888b2a559c0d1f285919a42de450a537a02f)
-rwxr-xr-x | ctdb/tests/onnode/0001.sh | 2 | ||||
-rwxr-xr-x | ctdb/tests/onnode/0002.sh | 2 | ||||
-rwxr-xr-x | ctdb/tests/onnode/0003.sh | 2 | ||||
-rwxr-xr-x | ctdb/tests/onnode/0004.sh | 2 | ||||
-rwxr-xr-x | ctdb/tests/onnode/0005.sh | 2 | ||||
-rwxr-xr-x | ctdb/tests/onnode/0006.sh | 2 | ||||
-rwxr-xr-x | ctdb/tests/onnode/0070.sh | 2 | ||||
-rwxr-xr-x | ctdb/tests/onnode/0071.sh | 2 | ||||
-rwxr-xr-x | ctdb/tests/onnode/0072.sh | 2 | ||||
-rwxr-xr-x | ctdb/tests/onnode/0075.sh | 2 | ||||
-rwxr-xr-x | ctdb/tests/onnode/0080.sh | 2 | ||||
-rwxr-xr-x | ctdb/tests/onnode/0081.sh | 2 | ||||
-rwxr-xr-x | ctdb/tests/onnode/0090.sh | 2 | ||||
-rwxr-xr-x | ctdb/tests/onnode/0091.sh | 2 | ||||
-rwxr-xr-x | ctdb/tests/onnode/run_tests.sh | 31 | ||||
-rw-r--r-- | ctdb/tests/onnode/scripts/local.sh (renamed from ctdb/tests/onnode/common.sh) | 27 |
16 files changed, 20 insertions, 66 deletions
diff --git a/ctdb/tests/onnode/0001.sh b/ctdb/tests/onnode/0001.sh index 3c2d541ef4..28533748f2 100755 --- a/ctdb/tests/onnode/0001.sh +++ b/ctdb/tests/onnode/0001.sh @@ -1,6 +1,6 @@ #!/bin/sh -. "${ONNODE_TESTS_DIR}/common.sh" +. "${TEST_SCRIPTS_DIR}/unit.sh" cmd="$ONNODE all hostname" diff --git a/ctdb/tests/onnode/0002.sh b/ctdb/tests/onnode/0002.sh index b18d91efa2..c3c8c77a0e 100755 --- a/ctdb/tests/onnode/0002.sh +++ b/ctdb/tests/onnode/0002.sh @@ -1,6 +1,6 @@ #!/bin/sh -. "${ONNODE_TESTS_DIR}/common.sh" +. "${TEST_SCRIPTS_DIR}/unit.sh" cmd="$ONNODE -q all hostname" diff --git a/ctdb/tests/onnode/0003.sh b/ctdb/tests/onnode/0003.sh index d925799261..d79bca2806 100755 --- a/ctdb/tests/onnode/0003.sh +++ b/ctdb/tests/onnode/0003.sh @@ -1,6 +1,6 @@ #!/bin/sh -. "${ONNODE_TESTS_DIR}/common.sh" +. "${TEST_SCRIPTS_DIR}/unit.sh" cmd="$ONNODE -p all hostname" diff --git a/ctdb/tests/onnode/0004.sh b/ctdb/tests/onnode/0004.sh index a6e6424ace..d0986b2ffd 100755 --- a/ctdb/tests/onnode/0004.sh +++ b/ctdb/tests/onnode/0004.sh @@ -1,6 +1,6 @@ #!/bin/sh -. "${ONNODE_TESTS_DIR}/common.sh" +. "${TEST_SCRIPTS_DIR}/unit.sh" cmd="$ONNODE -pq all hostname" diff --git a/ctdb/tests/onnode/0005.sh b/ctdb/tests/onnode/0005.sh index af237da9a3..0eccbb04a3 100755 --- a/ctdb/tests/onnode/0005.sh +++ b/ctdb/tests/onnode/0005.sh @@ -1,6 +1,6 @@ #!/bin/sh -. "${ONNODE_TESTS_DIR}/common.sh" +. "${TEST_SCRIPTS_DIR}/unit.sh" cmd="$ONNODE 3 hostname" diff --git a/ctdb/tests/onnode/0006.sh b/ctdb/tests/onnode/0006.sh index aa6eeba89e..b027850240 100755 --- a/ctdb/tests/onnode/0006.sh +++ b/ctdb/tests/onnode/0006.sh @@ -1,6 +1,6 @@ #!/bin/sh -. "${ONNODE_TESTS_DIR}/common.sh" +. "${TEST_SCRIPTS_DIR}/unit.sh" cmd="$ONNODE -v 3 hostname" diff --git a/ctdb/tests/onnode/0070.sh b/ctdb/tests/onnode/0070.sh index f38c95f5fd..902d78b231 100755 --- a/ctdb/tests/onnode/0070.sh +++ b/ctdb/tests/onnode/0070.sh @@ -1,6 +1,6 @@ #!/bin/sh -. "${ONNODE_TESTS_DIR}/common.sh" +. "${TEST_SCRIPTS_DIR}/unit.sh" cmd="$ONNODE ok hostname" diff --git a/ctdb/tests/onnode/0071.sh b/ctdb/tests/onnode/0071.sh index 8a1cb59dd7..ebf2f61fcd 100755 --- a/ctdb/tests/onnode/0071.sh +++ b/ctdb/tests/onnode/0071.sh @@ -1,6 +1,6 @@ #!/bin/sh -. "${ONNODE_TESTS_DIR}/common.sh" +. "${TEST_SCRIPTS_DIR}/unit.sh" cmd="$ONNODE ok hostname" diff --git a/ctdb/tests/onnode/0072.sh b/ctdb/tests/onnode/0072.sh index d80361a435..cb29e3b9a2 100755 --- a/ctdb/tests/onnode/0072.sh +++ b/ctdb/tests/onnode/0072.sh @@ -1,6 +1,6 @@ #!/bin/sh -. "${ONNODE_TESTS_DIR}/common.sh" +. "${TEST_SCRIPTS_DIR}/unit.sh" cmd="$ONNODE ok hostname" diff --git a/ctdb/tests/onnode/0075.sh b/ctdb/tests/onnode/0075.sh index aa2e8be0ba..6ce9b9b190 100755 --- a/ctdb/tests/onnode/0075.sh +++ b/ctdb/tests/onnode/0075.sh @@ -1,6 +1,6 @@ #!/bin/sh -. "${ONNODE_TESTS_DIR}/common.sh" +. "${TEST_SCRIPTS_DIR}/unit.sh" cmd="$ONNODE con hostname" diff --git a/ctdb/tests/onnode/0080.sh b/ctdb/tests/onnode/0080.sh index 095f65b224..bca478ada5 100755 --- a/ctdb/tests/onnode/0080.sh +++ b/ctdb/tests/onnode/0080.sh @@ -1,6 +1,6 @@ #!/bin/sh -. "${ONNODE_TESTS_DIR}/common.sh" +. "${TEST_SCRIPTS_DIR}/unit.sh" cmd="$ONNODE recmaster hostname" diff --git a/ctdb/tests/onnode/0081.sh b/ctdb/tests/onnode/0081.sh index e593934f66..412db87e4c 100755 --- a/ctdb/tests/onnode/0081.sh +++ b/ctdb/tests/onnode/0081.sh @@ -1,6 +1,6 @@ #!/bin/sh -. "${ONNODE_TESTS_DIR}/common.sh" +. "${TEST_SCRIPTS_DIR}/unit.sh" cmd="$ONNODE lvsmaster hostname" diff --git a/ctdb/tests/onnode/0090.sh b/ctdb/tests/onnode/0090.sh index 1147e34c10..dd50c51b70 100755 --- a/ctdb/tests/onnode/0090.sh +++ b/ctdb/tests/onnode/0090.sh @@ -1,6 +1,6 @@ #!/bin/sh -. "${ONNODE_TESTS_DIR}/common.sh" +. "${TEST_SCRIPTS_DIR}/unit.sh" cmd="$ONNODE natgw hostname" diff --git a/ctdb/tests/onnode/0091.sh b/ctdb/tests/onnode/0091.sh index 5239eef1b4..528eec16df 100755 --- a/ctdb/tests/onnode/0091.sh +++ b/ctdb/tests/onnode/0091.sh @@ -1,6 +1,6 @@ #!/bin/sh -. "${ONNODE_TESTS_DIR}/common.sh" +. "${TEST_SCRIPTS_DIR}/unit.sh" cmd="$ONNODE natgw hostname" diff --git a/ctdb/tests/onnode/run_tests.sh b/ctdb/tests/onnode/run_tests.sh deleted file mode 100755 index e5fa7e28c2..0000000000 --- a/ctdb/tests/onnode/run_tests.sh +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/sh - -# Run some onnode unit tests. - -cd $(dirname "$0") -export ONNODE_TESTS_DIR=$(pwd) - -test_dir=$(dirname "$ONNODE_TESTS_DIR") - -opts="-d" - -for i ; do - case "$i" in - -*) - opts="$opts $i" - shift - ;; - *) - break - esac -done - -tests="" -if [ -z "$*" ] ; then - tests=$(ls ./[0-9][0-9][0-9][0-9].sh ./[0-9][0-9][0-9][0-9]/run_test.sh 2>/dev/null) -fi - -"$test_dir/scripts/run_tests" $opts "$@" $tests || exit 1 - -echo "All OK" -exit 0 diff --git a/ctdb/tests/onnode/common.sh b/ctdb/tests/onnode/scripts/local.sh index f920bc398a..a990c695f8 100644 --- a/ctdb/tests/onnode/common.sh +++ b/ctdb/tests/onnode/scripts/local.sh @@ -8,26 +8,14 @@ unset CTDB_NODES_SOCKETS # Augment PATH with relevant stubs/ directories. -if [ -d "${ONNODE_TESTS_DIR}/stubs" ] ; then - PATH="${ONNODE_TESTS_DIR}/stubs:$PATH" -fi - -export ONNODE_TESTCASE_DIR=$(dirname "$0") -if [ $(basename "$ONNODE_TESTCASE_DIR") = "onnode" ] ; then - # Just a test script, no testcase subdirectory. - ONNODE_TESTCASE_DIR="$ONNODE_TESTS_DIR" -else - if [ -d "${ONNODE_TESTCASE_DIR}/stubs" ] ; then - PATH="${ONNODE_TESTCASE_DIR}/stubs:$PATH" - fi +if [ -d "${TEST_SUBDIR}/stubs" ] ; then + PATH="${TEST_SUBDIR}/stubs:$PATH" fi # Find CTDB nodes file. if [ -z "$CTDB_NODES_FILE" ] ; then - if [ -r "${ONNODE_TESTCASE_DIR}/nodes" ] ; then - CTDB_NODES_FILE="${ONNODE_TESTCASE_DIR}/nodes" - elif [ -r "${ONNODE_TESTS_DIR}/nodes" ] ; then - CTDB_NODES_FILE="${ONNODE_TESTS_DIR}/nodes" + if [ -r "${TEST_SUBDIR}/nodes" ] ; then + CTDB_NODES_FILE="${TEST_SUBDIR}/nodes" else CTDB_NODES_FILE="${CTDB_BASE:-/etc/ctdb}/nodes" fi @@ -35,7 +23,7 @@ fi export CTDB_NODES_FILE -export ONNODE_TESTS_VAR_DIR="${ONNODE_TESTS_DIR}/var" +export ONNODE_TESTS_VAR_DIR="${TEST_SUBDIR}/var" mkdir -p "$ONNODE_TESTS_VAR_DIR" if [ -z "$CTDB_BASE" ] ; then @@ -44,10 +32,7 @@ fi define_test () { - _f="$0" - _f="${_f#./}" # strip leading ./ - _f="${_f%%/*}" # if subdir, strip off file - _f="${_f%.sh}" # strip off .sh suffix if any + _f=$(basename "$0") echo "$_f $1 - $2" } |