ctdb-tests: Avoid shellcheck warning SC2155
authorMartin Schwenke <martin@meltin.net>
Mon, 5 Aug 2019 00:18:08 +0000 (10:18 +1000)
committerAmitay Isaacs <amitay@samba.org>
Wed, 14 Aug 2019 09:11:35 +0000 (09:11 +0000)
SC2155 Declare and assign separately to avoid masking return values

The wscript changes require an identical change in local_daemons.sh.

While touching the lines in wscript, escape the backslashes to make
them literal backslashes.

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

index d9bbc5dfbea731916f01833a5a582a767e360803..aecf78590b3d3d0e68b765487bd251a488f5a1b3 100755 (executable)
@@ -5,8 +5,9 @@ set -u
 export CTDB_TEST_MODE="yes"
 
 # Following 2 lines may be modified by installation script
-export CTDB_TESTS_ARE_INSTALLED=false
-export CTDB_TEST_DIR=$(dirname "$0")
+CTDB_TESTS_ARE_INSTALLED=false
+CTDB_TEST_DIR=$(dirname "$0")
+export CTDB_TESTS_ARE_INSTALLED CTDB_TEST_DIR
 
 export TEST_SCRIPTS_DIR="${CTDB_TEST_DIR}/scripts"
 
index 710bea40e8f79a05b2a2799a5783633bb9c55d04..22235655e5b3c003e7b83f29953ebc8a1f125180 100755 (executable)
@@ -236,8 +236,9 @@ find_and_run_one_test ()
 export CTDB_TEST_MODE="yes"
 
 # Following 2 lines may be modified by installation script
-export CTDB_TESTS_ARE_INSTALLED=false
-export CTDB_TEST_DIR=$(dirname "$0")
+CTDB_TESTS_ARE_INSTALLED=false
+CTDB_TEST_DIR=$(dirname "$0")
+export CTDB_TESTS_ARE_INSTALLED CTDB_TEST_DIR
 
 if [ -z "$TEST_VAR_DIR" ] ; then
     if $CTDB_TESTS_ARE_INSTALLED ; then
index 573a8f0e643d84c5e3a5b7d2cbcadbf1dd876b2a..03e29e133d832ef21bea8e5dbaaf8af87a5d71b9 100644 (file)
@@ -1108,9 +1108,9 @@ def build(bld):
                       'script_install_paths.sh',
                       destname='script_install_paths.sh', chmod=MODE_644)
 
-    sed_expr1 = 's@^\(export %s\)=.*@\\1=%s@' % (
+    sed_expr1 = 's@^\\(%s\\)=.*@\\1=%s@' % (
                     'CTDB_TEST_DIR', bld.env.CTDB_TEST_DATADIR)
-    sed_expr2 = 's@^\(export CTDB_TESTS_ARE_INSTALLED\)=false@\\1=true@'
+    sed_expr2 = 's@^\\(CTDB_TESTS_ARE_INSTALLED\\)=false@\\\\1=true@'
     bld.SAMBA_GENERATOR('ctdb-test-runner',
                         source='tests/run_tests.sh',
                         target='ctdb_run_tests.sh',