]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
ctdb-tests: Add new test support script for script install paths
authorMartin Schwenke <martin@meltin.net>
Thu, 14 Jul 2016 01:58:51 +0000 (11:58 +1000)
committerAmitay Isaacs <amitay@samba.org>
Thu, 21 Jul 2016 00:24:27 +0000 (02:24 +0200)
This helps unit tests locate CTDB's scripts.  It is being created to
support some new shellcheck unit tests.

Hopefully, it can also be used to simplify some of the symlink
complexity in some other unit tests suites, such as eventscripts.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
ctdb/tests/scripts/script_install_paths.sh [new file with mode: 0644]
ctdb/wscript

diff --git a/ctdb/tests/scripts/script_install_paths.sh b/ctdb/tests/scripts/script_install_paths.sh
new file mode 100644 (file)
index 0000000..bbf6f9e
--- /dev/null
@@ -0,0 +1,21 @@
+# Hey Emacs, this is a -*- shell-script -*- !!!  :-)
+
+# $ctdb_dir is set in common.sh
+if [  -n "$ctdb_dir" ] ; then
+       # Running in-tree
+       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"
+else
+       # Installed
+       CTDB_SCRIPTS_BASE="/usr/local/etc/ctdb"
+       CTDB_SCRIPTS_INIT_SCRIPT="" # No ideas here... this is a packaging choice
+       CTDB_SCRIPTS_SBIN_DIR="/usr/local/sbin"
+       CTDB_SCRIPTS_TOOLS_BIN_DIR="/usr/local/bin"
+       CTDB_SCRIPTS_TOOLS_HELPER_DIR="/usr/local/libexec/ctdb"
+fi
+
+export CTDB_SCRIPTS_BASE CTDB_SCRIPTS_BIN_DIR CTDB_SCRIPTS_INIT_DIR \
+       CTDB_SCRIPTS_SBIN_DIR CTDB_SCRIPTS_TOOLS_HELPER_DIR
index f3a1901c322c662a3a8752a6839a9656324931b0..3429e379117dfcfcbc1c00545bfb9119cb4e2982 100755 (executable)
@@ -763,6 +763,14 @@ def build(bld):
     bld.INSTALL_FILES(bld.env.CTDB_TEST_DATADIR+"/scripts", 'test_wrap',
                       destname='test_wrap', chmod=0755)
 
+    bld.SAMBA_GENERATOR('ctdb-test-script-install-paths',
+                        source='tests/scripts/script_install_paths.sh',
+                        target='script_install_paths.sh',
+                        rule='sed %s ${SRC} > ${TGT}' % (sed_cmdline))
+    bld.INSTALL_FILES(bld.env.CTDB_TEST_DATADIR+"/scripts",
+                      'script_install_paths.sh',
+                      destname='script_install_paths.sh', chmod=0644)
+
     sed_expr1 = 's@^test_dir=.*@test_dir=%s\\nexport TEST_BIN_DIR=\"%s\"@' % (
                 bld.env.CTDB_TEST_DATADIR, bld.env.CTDB_TEST_LIBDIR)
     sed_expr2 = 's@^\(export CTDB_TESTS_ARE_INSTALLED\)=false@\\1=true@'