summaryrefslogtreecommitdiff
path: root/ctdb
diff options
context:
space:
mode:
authorMartin Schwenke <martin@meltin.net>2020-02-05 12:09:51 +1100
committerAmitay Isaacs <amitay@samba.org>2020-02-10 04:07:39 +0000
commit3b0b830e40330b7fa679cf3c6e25dfb29d19e969 (patch)
tree31ea4665640c1890c0e6f2db00097291113a6326 /ctdb
parentb0b14e4eddab78ef71bc6d39f016e4a18929fd64 (diff)
downloadsamba-3b0b830e40330b7fa679cf3c6e25dfb29d19e969.tar.gz
ctdb-tests: Use $PWD/bin/ if it exists when running in-tree
When running tests from a top-level build, a stale build in ctdb/bin/ will be preferred and may cause confusing results. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
Diffstat (limited to 'ctdb')
-rw-r--r--ctdb/tests/scripts/script_install_paths.sh33
1 files changed, 27 insertions, 6 deletions
diff --git a/ctdb/tests/scripts/script_install_paths.sh b/ctdb/tests/scripts/script_install_paths.sh
index 9e54f4b473a..6890cf87aa6 100644
--- a/ctdb/tests/scripts/script_install_paths.sh
+++ b/ctdb/tests/scripts/script_install_paths.sh
@@ -1,5 +1,29 @@
# Hey Emacs, this is a -*- shell-script -*- !!! :-)
+# Sets $bin_dir
+find_bin_dir ()
+{
+ _ctdb_dir="$1"
+
+ bin_dir="$(pwd -P)/bin"
+ if [ -d "$(pwd -P)/bin" ] ; then
+ return
+ fi
+
+ bin_dir="${_ctdb_dir}/bin"
+ if [ -d "$bin_dir" ] ; then
+ return
+ fi
+
+ bin_dir="$(dirname "${_ctdb_dir}")/bin"
+ if [ -d "$bin_dir" ] ; then
+ return
+ fi
+
+ die "Unable to locate bin/ subdirectory"
+}
+
+
if ! $CTDB_TESTS_ARE_INSTALLED ; then
if [ ! -f "${CTDB_TEST_DIR}/run_tests.sh" ] ; then
die "Tests not installed but can't find run_tests.sh"
@@ -7,19 +31,16 @@ if ! $CTDB_TESTS_ARE_INSTALLED ; then
ctdb_dir=$(cd -P "$(dirname "$CTDB_TEST_DIR")" && pwd) # real path
- top_dir="$ctdb_dir"
- if [ ! -d "${top_dir}/bin" ] ; then
- top_dir=$(dirname "$top_dir")
- fi
+ find_bin_dir "$ctdb_dir"
CTDB_SCRIPTS_BASE="${ctdb_dir}/config"
CTDB_SCRIPTS_INIT_SCRIPT="${ctdb_dir}/config/ctdb.init"
CTDB_SCRIPTS_SBIN_DIR="${ctdb_dir}/config"
CTDB_SCRIPTS_TOOLS_BIN_DIR="${ctdb_dir}/tools"
CTDB_SCRIPTS_TOOLS_HELPER_DIR="${ctdb_dir}/tools"
- CTDB_SCRIPTS_HELPER_BINDIR="${top_dir}/bin"
+ CTDB_SCRIPTS_HELPER_BINDIR="$bin_dir"
CTDB_SCRIPTS_DATA_DIR="${ctdb_dir}/config"
- CTDB_SCRIPTS_TESTS_LIBEXEC_DIR="${top_dir}/bin"
+ CTDB_SCRIPTS_TESTS_LIBEXEC_DIR="$bin_dir"
CTDB_SCRIPTS_TESTS_BIN_DIR="$CTDB_TEST_DIR"
else
# Installed