From 02edfb0f199fb7206df1f725aee56826d65716c1 Mon Sep 17 00:00:00 2001 From: Martin Schwenke Date: Fri, 6 Sep 2019 20:54:37 +1000 Subject: [PATCH] ctdb-tests: Rename variable TEST_SUBDIR -> CTDB_TEST_SUITE_DIR Signed-off-by: Martin Schwenke Reviewed-by: Amitay Isaacs --- ctdb/tests/eventscripts/scripts/local.sh | 8 ++++---- ctdb/tests/local_daemons.sh | 14 +++++++------- ctdb/tests/onnode/scripts/local.sh | 2 +- ctdb/tests/scripts/common.sh | 10 +++++----- ctdb/tests/scripts/integration.bash | 2 +- ctdb/tests/scripts/unit.sh | 2 +- ctdb/tests/simple/scripts/local.bash | 2 +- 7 files changed, 20 insertions(+), 20 deletions(-) diff --git a/ctdb/tests/eventscripts/scripts/local.sh b/ctdb/tests/eventscripts/scripts/local.sh index c0eb72badd1d..16eeafd1050f 100644 --- a/ctdb/tests/eventscripts/scripts/local.sh +++ b/ctdb/tests/eventscripts/scripts/local.sh @@ -4,7 +4,7 @@ # Augment PATH with relevant stubs/ directories. # -stubs_dir="${TEST_SUBDIR}/stubs" +stubs_dir="${CTDB_TEST_SUITE_DIR}/stubs" [ -d "${stubs_dir}" ] || die "Failed to locate stubs/ subdirectory" # Make the path absolute for tests that change directory @@ -35,8 +35,8 @@ export CTDB_LOGGING="file:${EVENTSCRIPTS_TESTS_VAR_DIR}/log.ctdb" touch "${CTDB_LOGGING#file:}" || \ die "Unable to setup logging for \"$CTDB_LOGGING\"" -if [ -d "${TEST_SUBDIR}/etc" ] ; then - cp -a "${TEST_SUBDIR}/etc" "$EVENTSCRIPTS_TESTS_VAR_DIR" +if [ -d "${CTDB_TEST_SUITE_DIR}/etc" ] ; then + cp -a "${CTDB_TEST_SUITE_DIR}/etc" "$EVENTSCRIPTS_TESTS_VAR_DIR" export CTDB_SYS_ETCDIR="${EVENTSCRIPTS_TESTS_VAR_DIR}/etc" else die "Unable to setup \$CTDB_SYS_ETCDIR" @@ -495,7 +495,7 @@ define_test () printf "%-17s %-10s %-4s - %s\n\n" \ "$script_short" "$event" "$_num" "$desc" - _f="${TEST_SUBDIR}/scripts/${script_short}.sh" + _f="${CTDB_TEST_SUITE_DIR}/scripts/${script_short}.sh" if [ -r "$_f" ] ; then . "$_f" fi diff --git a/ctdb/tests/local_daemons.sh b/ctdb/tests/local_daemons.sh index 15c80713b3b3..2efa91f76f40 100755 --- a/ctdb/tests/local_daemons.sh +++ b/ctdb/tests/local_daemons.sh @@ -197,14 +197,14 @@ local_daemons_setup () fi for _n in $(seq 0 $((_num_nodes - 1))) ; do - # common.sh will set TEST_SUBDIR to a stupid value - # when installed because common.sh is usually sourced - # by a test. TEST_SUBDIR 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. + # 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. # shellcheck disable=SC2034 - TEST_SUBDIR="$CTDB_TEST_DIR" \ + CTDB_TEST_SUITE_DIR="$CTDB_TEST_DIR" \ setup_ctdb_base "$directory" "node.${_n}" \ functions notify.sh debug-hung-script.sh diff --git a/ctdb/tests/onnode/scripts/local.sh b/ctdb/tests/onnode/scripts/local.sh index d5067f8cb6c2..1236145e5bd8 100644 --- a/ctdb/tests/onnode/scripts/local.sh +++ b/ctdb/tests/onnode/scripts/local.sh @@ -4,7 +4,7 @@ : ${ONNODE:=onnode} # Augment PATH with relevant stubs/ directory -stubs_dir="${TEST_SUBDIR}/stubs" +stubs_dir="${CTDB_TEST_SUITE_DIR}/stubs" [ -d "${stubs_dir}" ] || die "Failed to locate stubs/ subdirectory" PATH="${stubs_dir}:${PATH}" diff --git a/ctdb/tests/scripts/common.sh b/ctdb/tests/scripts/common.sh index 519219ca982a..2998df3cb98c 100644 --- a/ctdb/tests/scripts/common.sh +++ b/ctdb/tests/scripts/common.sh @@ -14,9 +14,9 @@ die () } # This expands the most probable problem cases like "." and "..". -TEST_SUBDIR=$(dirname "$0") -if [ "$(dirname "$TEST_SUBDIR")" = "." ] ; then - TEST_SUBDIR=$(cd "$TEST_SUBDIR" && pwd) +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" @@ -102,11 +102,11 @@ setup_ctdb_base () mkdir -p "${CTDB_BASE}/events/legacy" - if [ -z "$TEST_SUBDIR" ] ; then + if [ -z "$CTDB_TEST_SUITE_DIR" ] ; then return fi - for _i in "${TEST_SUBDIR}/etc-ctdb/"* ; do + for _i in "${CTDB_TEST_SUITE_DIR}/etc-ctdb/"* ; do # No/empty etc-ctdb directory [ -e "$_i" ] || break diff --git a/ctdb/tests/scripts/integration.bash b/ctdb/tests/scripts/integration.bash index 0aaede98e8aa..966bce4f3f6a 100644 --- a/ctdb/tests/scripts/integration.bash +++ b/ctdb/tests/scripts/integration.bash @@ -723,7 +723,7 @@ ctdb_enable_cluster_test_event_scripts () # Make sure that $CTDB is set. : ${CTDB:=ctdb} -local="${TEST_SUBDIR}/scripts/local.bash" +local="${CTDB_TEST_SUITE_DIR}/scripts/local.bash" if [ -r "$local" ] ; then . "$local" fi diff --git a/ctdb/tests/scripts/unit.sh b/ctdb/tests/scripts/unit.sh index e9476aef0755..7713496cf575 100644 --- a/ctdb/tests/scripts/unit.sh +++ b/ctdb/tests/scripts/unit.sh @@ -240,7 +240,7 @@ test_cleanup () trap 'eval $test_cleanup_hooks' 0 -local="${TEST_SUBDIR}/scripts/local.sh" +local="${CTDB_TEST_SUITE_DIR}/scripts/local.sh" if [ -r "$local" ] ; then . "$local" fi diff --git a/ctdb/tests/simple/scripts/local.bash b/ctdb/tests/simple/scripts/local.bash index 5ffe2892c5c9..eb91353ac793 100644 --- a/ctdb/tests/simple/scripts/local.bash +++ b/ctdb/tests/simple/scripts/local.bash @@ -7,5 +7,5 @@ export SIMPLE_TESTS_VAR_DIR="${TEST_VAR_DIR}/simple" mkdir -p "$SIMPLE_TESTS_VAR_DIR" if [ -n "$TEST_LOCAL_DAEMONS" ] ; then - . "${TEST_SUBDIR}/scripts/local_daemons.bash" + . "${CTDB_TEST_SUITE_DIR}/scripts/local_daemons.bash" fi -- 2.34.1