From e9ce035c2d2ef6fd177a3bb10031162586b696bd Mon Sep 17 00:00:00 2001 From: Martin Schwenke Date: Mon, 9 Sep 2019 16:19:52 +1000 Subject: ctdb-tests: Move setting of CTDB_TEST_SUITE_DIR to run_tests.sh Signed-off-by: Martin Schwenke Reviewed-by: Amitay Isaacs --- ctdb/tests/local_daemons.sh | 9 +++------ ctdb/tests/run_tests.sh | 7 +++++++ ctdb/tests/scripts/common.sh | 6 ------ 3 files changed, 10 insertions(+), 12 deletions(-) (limited to 'ctdb') diff --git a/ctdb/tests/local_daemons.sh b/ctdb/tests/local_daemons.sh index 2efa91f76f4..6217e54332d 100755 --- a/ctdb/tests/local_daemons.sh +++ b/ctdb/tests/local_daemons.sh @@ -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}" \ diff --git a/ctdb/tests/run_tests.sh b/ctdb/tests/run_tests.sh index b74d7c5f193..5cca297fd64 100755 --- a/ctdb/tests/run_tests.sh +++ b/ctdb/tests/run_tests.sh @@ -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 diff --git a/ctdb/tests/scripts/common.sh b/ctdb/tests/scripts/common.sh index 2998df3cb98..de117e90caa 100644 --- a/ctdb/tests/scripts/common.sh +++ b/ctdb/tests/scripts/common.sh @@ -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 -- cgit v1.2.1