ctdb-tests: If bin/ isn't in ctdb/ then look one level higher
authorMartin Schwenke <martin@meltin.net>
Wed, 29 Aug 2018 23:35:58 +0000 (09:35 +1000)
committerAmitay Isaacs <amitay@samba.org>
Mon, 3 Sep 2018 08:52:11 +0000 (10:52 +0200)
CTDB's test suite doesn't work from a top-level compile.  The first
step to fixing this is to correctly locate the bin/ directory.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
ctdb/tests/scripts/common.sh
ctdb/tests/scripts/script_install_paths.sh

index dfba6fd00e37086b73f91ddb281b1ab859a3d996..143ae088b1dfa8f9635ac93402744afaf42b8f2e 100644 (file)
@@ -37,13 +37,15 @@ else
                PATH="${_tools_dir}:$PATH"
        fi
 
-       _test_bin_dir="${ctdb_dir}/bin"
+       top_dir=$(cd -P "$ctdb_dir" && echo "$PWD") # real path
+
+       _test_bin_dir="${top_dir}/bin"
+       if [ ! -d "$_test_bin_dir" ] ; then
+               top_dir=$(dirname "$top_dir")
+               _test_bin_dir="${top_dir}/bin"
+       fi
 fi
 
-case "$_test_bin_dir" in
-/*) : ;;
-*) _test_bin_dir="${PWD}/${_test_bin_dir}" ;;
-esac
 if [ -d "$_test_bin_dir" ] ; then
        PATH="${_test_bin_dir}:$PATH"
 fi
index c0777c9b7feb4de82ed7746e7605bcf90bdec753..5266ba409c461b71e4090aeae03f0fe679cd2e3d 100644 (file)
@@ -8,7 +8,7 @@ if [  -n "$ctdb_dir" ] ; then
        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="${ctdb_dir}/bin"
+       CTDB_SCRIPTS_HELPER_BINDIR="${top_dir}/bin"
        CTDB_SCRIPTS_DATA_DIR="${ctdb_dir}/config"
 else
        # Installed