ctdb-tests: Prefix remaining environment variables with CTDB_
authorMartin Schwenke <martin@meltin.net>
Thu, 17 Oct 2019 05:33:48 +0000 (16:33 +1100)
committerRalph Boehme <slow@samba.org>
Tue, 22 Oct 2019 19:39:41 +0000 (19:39 +0000)
Now they are clearly all part of CTDB.

TEST_SOCKET_WRAPPER_SO_PATH gets too long in
integration_local_daemons.bash, so change it to
CTDB_TEST_SWRAP_SO_PATH instead of just prefixing.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
ctdb/tests/README
ctdb/tests/UNIT/eventd/scripts/local.sh
ctdb/tests/UNIT/eventscripts/scripts/60.nfs.sh
ctdb/tests/UNIT/eventscripts/scripts/local.sh
ctdb/tests/UNIT/onnode/scripts/local.sh
ctdb/tests/UNIT/takeover_helper/scripts/local.sh
ctdb/tests/UNIT/tool/scripts/local.sh
ctdb/tests/run_tests.sh
ctdb/tests/scripts/integration.bash
ctdb/tests/scripts/integration_local_daemons.bash
ctdb/tests/scripts/unit.sh

index fbf10d898c29f4fd76db6510cddf787e5737ea43..4d977f761a463ea0a5cb499ef2a834979ac717a1 100644 (file)
@@ -23,7 +23,7 @@ By default:
 
 * INTEGRATION tests are run against 3 local daemons
 
-  Set TEST_LOCAL_DAEMONS to a different number if desired
+  Set CTDB_TEST_LOCAL_DAEMONS to a different number if desired
 
 * When testing is complete, a summary showing a list is printed
   showing the tests run and their results
index 2cb1115fcf9b3fd7bab3bd5d67d00a001a78cf6d..9b8ebf18074c254785d9231245722cc7080c9202 100644 (file)
@@ -4,7 +4,7 @@
 
 PATH="$PATH:$CTDB_SCRIPTS_TOOLS_HELPER_DIR"
 
-if "$TEST_VERBOSE" ; then
+if "$CTDB_TEST_VERBOSE" ; then
     debug () { echo "$@" ; }
 else
     debug () { : ; }
index 59cdeda9b9668ea2f2005cf96b0643a0be9e8823..2a269910826d707f1dbd97b718ad4254745996cb 100644 (file)
@@ -389,7 +389,7 @@ EOF
                fi
                _out=$(simple_test 2>&1)
                _ret=$?
-               if "$TEST_VERBOSE" || [ $_ret -ne 0 ] ; then
+               if "$CTDB_TEST_VERBOSE" || [ $_ret -ne 0 ] ; then
                        cat <<EOF
 ##################################################
 Iteration ${_iteration}:
index e1b92b41fbe27e14b57c0c0dad0fba622d71999e..14017e953659292420be38fde1a4ab0361e445ca 100644 (file)
@@ -49,7 +49,7 @@ mkdir -p "$FAKE_NETWORK_STATE"
 
 ######################################################################
 
-if "$TEST_VERBOSE" ; then
+if "$CTDB_TEST_VERBOSE" ; then
        debug ()
        {
                if [ -n "$1" ] ; then
index 4cb797031c46859a5a5d56be9c00a94245dc89fd..5b830c876974717cba87d673a2813bbc5e91e298 100644 (file)
@@ -48,7 +48,7 @@ simple_test ()
        _sort="sort"
     fi
 
-    if $TEST_COMMAND_TRACE ; then
+    if $CTDB_TEST_COMMAND_TRACE ; then
        _onnode=$(which "$1") ; shift
        _out=$(bash -x "$_onnode" "$@" 2>&1)
     else
index d15ec93f03f353d64d2f13111fb4a974dbe2e6d0..d36d4e495007f7280f6cfe17886f0d2351bd0061 100644 (file)
@@ -1,6 +1,6 @@
 # Hey Emacs, this is a -*- shell-script -*- !!!  :-)
 
-if "$TEST_VERBOSE" ; then
+if "$CTDB_TEST_VERBOSE" ; then
        debug () { echo "$@" ; }
 else
        debug () { : ; }
index 53ddccf4f5bb8e7295dc3dc8e974c0f9d04ebf53..618fa36cd879d851411cfca9d18cfb9d6314fd97 100644 (file)
@@ -6,7 +6,7 @@ PATH="${PATH}:${CTDB_SCRIPTS_HELPER_BINDIR}"
 setup_ctdb_base "$CTDB_TEST_TMP_DIR" "ctdb-etc" \
                functions
 
-if "$TEST_VERBOSE" ; then
+if "$CTDB_TEST_VERBOSE" ; then
     debug () { echo "$@" ; }
 else
     debug () { : ; }
index 8304443b1962ef8e1589f982c23a67aff001396b..5011a73d82cae17284f566f3d26ac644b73b0e0f 100755 (executable)
@@ -41,33 +41,33 @@ test_state_dir=""
 cleanup=false
 test_time_limit=3600
 
-export TEST_VERBOSE=false
-export TEST_COMMAND_TRACE=false
-export TEST_CAT_RESULTS_OPTS=""
-export TEST_DIFF_RESULTS=false
+export CTDB_TEST_VERBOSE=false
+export CTDB_TEST_COMMAND_TRACE=false
+export CTDB_TEST_CAT_RESULTS_OPTS=""
+export CTDB_TEST_DIFF_RESULTS=false
 export CTDB_TEST_PRINT_LOGS_ON_ERROR=false
-export TEST_LOCAL_DAEMONS
-[ -n "$TEST_LOCAL_DAEMONS" ] || TEST_LOCAL_DAEMONS=3
-export TEST_SOCKET_WRAPPER_SO_PATH=""
+export CTDB_TEST_LOCAL_DAEMONS
+[ -n "$CTDB_TEST_LOCAL_DAEMONS" ] || CTDB_TEST_LOCAL_DAEMONS=3
+export CTDB_TEST_SWRAP_SO_PATH=""
 
 while getopts "AcCDehHI:LNqS:T:vV:xX?" opt ; do
        case "$opt" in
-       A) TEST_CAT_RESULTS_OPTS="-A" ;;
-       c) TEST_LOCAL_DAEMONS="" ;;
+       A) CTDB_TEST_CAT_RESULTS_OPTS="-A" ;;
+       c) CTDB_TEST_LOCAL_DAEMONS="" ;;
        C) cleanup=true ;;
-       D) TEST_DIFF_RESULTS=true ;;
+       D) CTDB_TEST_DIFF_RESULTS=true ;;
        e) exit_on_fail=true ;;
        H) no_header=true ;;
        I) max_iterations="$OPTARG" ; exit_on_fail=true ; with_summary=false ;;
        L) CTDB_TEST_PRINT_LOGS_ON_ERROR=true ;;
        N) with_summary=false ;;
        q) quiet=true ;;
-       S) TEST_SOCKET_WRAPPER_SO_PATH="$OPTARG" ;;
+       S) CTDB_TEST_SWRAP_SO_PATH="$OPTARG" ;;
        T) test_time_limit="$OPTARG" ;;
-       v) TEST_VERBOSE=true ;;
+       v) CTDB_TEST_VERBOSE=true ;;
        V) test_state_dir="$OPTARG" ;;
        x) set -x ;;
-       X) TEST_COMMAND_TRACE=true ;;
+       X) CTDB_TEST_COMMAND_TRACE=true ;;
        \?|h) usage ;;
        esac
 done
@@ -76,7 +76,7 @@ shift $((OPTIND - 1))
 case $(basename "$0") in
     *run_cluster_tests*)
        # Running on a cluster...  same as -c
-       TEST_LOCAL_DAEMONS=""
+       CTDB_TEST_LOCAL_DAEMONS=""
        ;;
 esac
 
@@ -321,7 +321,7 @@ export TEST_SCRIPTS_DIR="${CTDB_TEST_DIR}/scripts"
 
 # If no tests specified then run some defaults
 if [ -z "$1" ] ; then
-       if [ -n "$TEST_LOCAL_DAEMONS" ] ; then
+       if [ -n "$CTDB_TEST_LOCAL_DAEMONS" ] ; then
                set -- UNIT INTEGRATION
        else
                set -- INTEGRATION CLUSTER
index 55b5deb70235996d5c307e8f00f6609122ba0ed7..bbb3a64ea5a6ef3b266b46e0b866e9695706dcab 100644 (file)
@@ -25,7 +25,7 @@ PATH="${TEST_SCRIPTS_DIR}:${PATH}"
 
 ctdb_test_on_cluster ()
 {
-       [ -z "$TEST_LOCAL_DAEMONS" ]
+       [ -z "$CTDB_TEST_LOCAL_DAEMONS" ]
 }
 
 ctdb_test_exit ()
index ec9c477bb0fc73c35d40faca251a69541456ccfc..0e7e07d540c1b5fc5adf7701ad97a13031efb4f3 100644 (file)
@@ -24,9 +24,9 @@ setup_ctdb ()
        esac
 
        $ctdb_local_daemons setup "$@" \
-               -n "$TEST_LOCAL_DAEMONS" \
+               -n "$CTDB_TEST_LOCAL_DAEMONS" \
                ${CTDB_USE_IPV6:+-6} \
-               ${TEST_SOCKET_WRAPPER_SO_PATH:+-S ${TEST_SOCKET_WRAPPER_SO_PATH}}
+               ${CTDB_TEST_SWRAP_SO_PATH:+-S ${CTDB_TEST_SWRAP_SO_PATH}}
        # Burying the above in an if-statement condition reduces readability.
        # shellcheck disable=SC2181
        if [ $? -ne 0 ] ; then
@@ -35,7 +35,7 @@ setup_ctdb ()
 
        if $no_event_scripts ; then
                local pnn
-               for pnn in $(seq 0 $((TEST_LOCAL_DAEMONS - 1))) ; do
+               for pnn in $(seq 0 $((CTDB_TEST_LOCAL_DAEMONS - 1))) ; do
                        rm -vf "${CTDB_BASE}/events/legacy/"*
                done
        fi
index 7713496cf575acd5191719a8ce684ebb9d8f7120..00f7fe9cb48985dc9ca3d12f02dc680431e7ca73 100644 (file)
@@ -74,7 +74,7 @@ result_print ()
     _out="$2"
     _rc="$3"
 
-    if "$TEST_VERBOSE" || ! $_passed ; then
+    if "$CTDB_TEST_VERBOSE" || ! $_passed ; then
        extra_header
 
 cat <<EOF
@@ -83,7 +83,7 @@ Output (Exit status: ${_rc}):
 --------------------------------------------------
 EOF
        # Avoid echo, which might expand unintentional escapes
-       printf '%s\n' "$_out" | result_filter | cat $TEST_CAT_RESULTS_OPTS
+       printf '%s\n' "$_out" | result_filter | cat $CTDB_TEST_CAT_RESULTS_OPTS
     fi
 
     if ! $_passed ; then
@@ -93,9 +93,9 @@ Required output (Exit status: ${required_rc}):
 --------------------------------------------------
 EOF
        # Avoid echo, which might expand unintentional escapes
-       printf '%s\n' "$required_output" | cat $TEST_CAT_RESULTS_OPTS
+       printf '%s\n' "$required_output" | cat $CTDB_TEST_CAT_RESULTS_OPTS
 
-       if $TEST_DIFF_RESULTS ; then
+       if $CTDB_TEST_DIFF_RESULTS ; then
            _outr=$(mktemp)
            # Avoid echo, which might expand unintentional escapes
            printf '%s\n' "$required_output" >"$_outr"
@@ -119,7 +119,7 @@ result_footer ()
 {
     _passed="$1"
 
-    if "$TEST_VERBOSE" || ! $_passed ; then
+    if "$CTDB_TEST_VERBOSE" || ! $_passed ; then
        extra_footer
     fi
 
@@ -196,7 +196,7 @@ unit_test ()
     test_header "$@"
 
     _wrapper="$VALGRIND"
-    if $TEST_COMMAND_TRACE ; then
+    if $CTDB_TEST_COMMAND_TRACE ; then
        _wrapper="strace"
     fi
     _out=$($_wrapper "$@" 2>&1)
@@ -210,7 +210,7 @@ script_test ()
     test_header "$@"
 
     _shell=""
-    if ${TEST_COMMAND_TRACE} ; then
+    if ${CTDB_TEST_COMMAND_TRACE} ; then
        _shell="sh -x"
     else
        _shell="sh"