From 99350c18aadb0345051f9a21111da1cae3eabe55 Mon Sep 17 00:00:00 2001 From: Martin Schwenke Date: Tue, 6 Feb 2018 16:41:36 +1100 Subject: [PATCH] ctdb-tests: Clean up PATH setting for stubs/ subdirectory Drop unnecessary PATH setting in rc.local. The functions file no longer sets PATH so setting it here is unnecessary. Fix a comment referencing this PATH setting. Given EVENTSCRIPTS_PATH is no longer used, use a more obvious variable name and fail on missing stubs/ subdirectory. Signed-off-by: Martin Schwenke Reviewed-by: Amitay Isaacs --- ctdb/tests/eventscripts/etc-ctdb/rc.local | 1 - ctdb/tests/eventscripts/scripts/local.sh | 29 +++++++++++------------ 2 files changed, 14 insertions(+), 16 deletions(-) diff --git a/ctdb/tests/eventscripts/etc-ctdb/rc.local b/ctdb/tests/eventscripts/etc-ctdb/rc.local index 541474a8b73..72a79bc66ac 100755 --- a/ctdb/tests/eventscripts/etc-ctdb/rc.local +++ b/ctdb/tests/eventscripts/etc-ctdb/rc.local @@ -59,4 +59,3 @@ background_with_logging () } CTDB_INIT_STYLE="${EVENTSCRIPT_TESTS_INIT_STYLE:-redhat}" -PATH="${EVENTSCRIPTS_PATH}:$PATH" diff --git a/ctdb/tests/eventscripts/scripts/local.sh b/ctdb/tests/eventscripts/scripts/local.sh index adaad08a9b1..708733713d3 100644 --- a/ctdb/tests/eventscripts/scripts/local.sh +++ b/ctdb/tests/eventscripts/scripts/local.sh @@ -1,24 +1,23 @@ # Hey Emacs, this is a -*- shell-script -*- !!! :-) -# Augment PATH with relevant stubs/ directories. We do this by actually -# setting PATH, and also by setting $EVENTSCRIPTS_PATH and then -# prepending that to $PATH in rc.local to avoid the PATH reset in -# functions. +# +# Augment PATH with relevant stubs/ directories. +# -EVENTSCRIPTS_PATH="" +stubs_dir="${TEST_SUBDIR}/stubs" +[ -d "${stubs_dir}" ] || die "Failed to locate stubs/ subdirectory" -if [ -d "${TEST_SUBDIR}/stubs" ] ; then - EVENTSCRIPTS_PATH="${TEST_SUBDIR}/stubs" - case "$EVENTSCRIPTS_PATH" in - /*) : ;; - *) EVENTSCRIPTS_PATH="${PWD}/${EVENTSCRIPTS_PATH}" ;; - esac - export CTDB_HELPER_BINDIR="$EVENTSCRIPTS_PATH" -fi +# Make the path absolute for tests that change directory +case "$stubs_dir" in +/*) : ;; +*) stubs_dir="${PWD}/${stubs_dir}" ;; +esac -export EVENTSCRIPTS_PATH +# Use stubs as helpers +export CTDB_HELPER_BINDIR="$stubs_dir" + +PATH="${stubs_dir}:${PATH}" -PATH="${EVENTSCRIPTS_PATH}:${PATH}" export CTDB="ctdb"