ctdb-tests: Move setting of CTDB_TEST_SUITE_DIR to run_tests.sh
authorMartin Schwenke <martin@meltin.net>
Mon, 9 Sep 2019 06:19:52 +0000 (16:19 +1000)
committerAmitay Isaacs <amitay@samba.org>
Tue, 24 Sep 2019 02:27:29 +0000 (02:27 +0000)
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
ctdb/tests/local_daemons.sh
ctdb/tests/run_tests.sh
ctdb/tests/scripts/common.sh

index 2efa91f76f40d265d6f6ca3858e2a88e2b803e0b..6217e54332d2aa7375548eb598544438323b58a8 100755 (executable)
@@ -197,12 +197,9 @@ local_daemons_setup ()
        fi
 
        for _n in $(seq 0 $((_num_nodes - 1))) ; do
-               # common.sh will set CTDB_TEST_SUITE_DIR to a stupid
-               # value when installed because common.sh is usually
-               # sourced by a test.  CTDB_TEST_SUITE_DIR needs to be
-               # correctly set so setup_ctdb_base() finds the
-               # etc-ctdb/ subdirectory and the test event script is
-               # correctly installed, so fix it.
+               # CTDB_TEST_SUITE_DIR needs to be correctly set so
+               # setup_ctdb_base() finds the etc-ctdb/ subdirectory
+               # and the test event script is correctly installed
                # shellcheck disable=SC2034
                CTDB_TEST_SUITE_DIR="$CTDB_TEST_DIR" \
                           setup_ctdb_base "$directory" "node.${_n}" \
index b74d7c5f19369dc137ad61032cd1d2975afd319f..5cca297fd64b21d1d73e2ae4d1932995e004ac66 100755 (executable)
@@ -181,6 +181,13 @@ run_one_test ()
 {
     local f="$1"
 
+    CTDB_TEST_SUITE_DIR=$(dirname "$f")
+    export CTDB_TEST_SUITE_DIR
+    # This expands the most probable problem cases like "." and "..".
+    if [ "$(dirname "$CTDB_TEST_SUITE_DIR")" = "." ] ; then
+           CTDB_TEST_SUITE_DIR=$(cd "$CTDB_TEST_SUITE_DIR" && pwd)
+    fi
+
     tests_total=$((tests_total + 1))
 
     ctdb_test_run "$f" | show_progress
index 2998df3cb98cd51bfdc3e595de6959ffc546fc18..de117e90caa6de96dcf72cd2034d71646afc72ae 100644 (file)
@@ -13,12 +13,6 @@ die ()
        echo "$1" >&2 ; exit "${2:-1}"
 }
 
-# This expands the most probable problem cases like "." and "..".
-CTDB_TEST_SUITE_DIR=$(dirname "$0")
-if [ "$(dirname "$CTDB_TEST_SUITE_DIR")" = "." ] ; then
-       CTDB_TEST_SUITE_DIR=$(cd "$CTDB_TEST_SUITE_DIR" && pwd)
-fi
-
 . "${TEST_SCRIPTS_DIR}/script_install_paths.sh"
 
 if [ -d "$CTDB_SCRIPTS_TOOLS_BIN_DIR" ] ; then