1
0
mirror of https://github.com/samba-team/samba.git synced 2025-02-28 01:58:17 +03:00

ctdb-tests: Switch TEST_VAR_DIR to a local script variable

This is now local to run_tests.sh.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>

Autobuild-User(master): Amitay Isaacs <amitay@samba.org>
Autobuild-Date(master): Tue Sep 24 03:46:59 UTC 2019 on sn-devel-184
This commit is contained in:
Martin Schwenke 2019-09-09 17:59:15 +10:00 committed by Amitay Isaacs
parent e78c1a0ca2
commit b8f4f141a2
2 changed files with 15 additions and 17 deletions

View File

@ -62,7 +62,7 @@ Some of the more useful options include:
-e Exit on the first test failure -e Exit on the first test failure
-C Clean up - kill daemons and remove $TEST_VAR_DIR when done -C Clean up when done by removing test state directory
Tests uses a temporary/var directory for test state. By default, Tests uses a temporary/var directory for test state. By default,
this directory is not removed when tests are complete, so you this directory is not removed when tests are complete, so you
@ -70,9 +70,7 @@ Some of the more useful options include:
have failed against the same directory (with the same local have failed against the same directory (with the same local
daemons setup). So this option cleans things up. daemons setup). So this option cleans things up.
Also kills local daemons associated with directory. -V Use <dir> as test state directory
-V Use <dir> as $TEST_VAR_DIR
Use the specified temporary temporary/var directory. Use the specified temporary temporary/var directory.

View File

@ -7,7 +7,7 @@ Usage: $0 [OPTIONS] [TESTS]
Options: Options:
-A Use "cat -A" to print test output (only some tests) -A Use "cat -A" to print test output (only some tests)
-c Run integration tests on a cluster -c Run integration tests on a cluster
-C Remove TEST_VAR_DIR when done -C Clean up when done by removing test state directory (see -V)
-D Show diff between failed/expected test output (some tests only) -D Show diff between failed/expected test output (some tests only)
-e Exit on the first test failure -e Exit on the first test failure
-H No headers - for running single test with other wrapper -H No headers - for running single test with other wrapper
@ -16,7 +16,7 @@ Options:
-q Quiet - don't show tests being run (still displays summary) -q Quiet - don't show tests being run (still displays summary)
-S <lib> Use socket wrapper library <lib> for local integration tests -S <lib> Use socket wrapper library <lib> for local integration tests
-v Verbose - print test output for non-failures (only some tests) -v Verbose - print test output for non-failures (only some tests)
-V <dir> Use <dir> as TEST_VAR_DIR -V <dir> Use <dir> as test state directory
-x Trace this script with the -x option -x Trace this script with the -x option
-X Trace certain scripts run by tests using -x (only some tests) -X Trace certain scripts run by tests using -x (only some tests)
EOF EOF
@ -36,6 +36,7 @@ quiet=false
exit_on_fail=false exit_on_fail=false
max_iterations=1 max_iterations=1
no_header=false no_header=false
test_state_dir=""
export TEST_VERBOSE=false export TEST_VERBOSE=false
export TEST_COMMAND_TRACE=false export TEST_COMMAND_TRACE=false
@ -43,7 +44,6 @@ export TEST_CAT_RESULTS_OPTS=""
export TEST_DIFF_RESULTS=false export TEST_DIFF_RESULTS=false
export TEST_LOCAL_DAEMONS export TEST_LOCAL_DAEMONS
[ -n "$TEST_LOCAL_DAEMONS" ] || TEST_LOCAL_DAEMONS=3 [ -n "$TEST_LOCAL_DAEMONS" ] || TEST_LOCAL_DAEMONS=3
export TEST_VAR_DIR=""
export TEST_CLEANUP=false export TEST_CLEANUP=false
export TEST_TIMEOUT=3600 export TEST_TIMEOUT=3600
export TEST_SOCKET_WRAPPER_SO_PATH="" export TEST_SOCKET_WRAPPER_SO_PATH=""
@ -62,7 +62,7 @@ while getopts "AcCDehHI:NqS:T:vV:xX?" opt ; do
S) TEST_SOCKET_WRAPPER_SO_PATH="$OPTARG" ;; S) TEST_SOCKET_WRAPPER_SO_PATH="$OPTARG" ;;
T) TEST_TIMEOUT="$OPTARG" ;; T) TEST_TIMEOUT="$OPTARG" ;;
v) TEST_VERBOSE=true ;; v) TEST_VERBOSE=true ;;
V) TEST_VAR_DIR="$OPTARG" ;; V) test_state_dir="$OPTARG" ;;
x) set -x ;; x) set -x ;;
X) TEST_COMMAND_TRACE=true ;; X) TEST_COMMAND_TRACE=true ;;
\?|h) usage ;; \?|h) usage ;;
@ -198,7 +198,7 @@ run_one_test ()
test_suite_dir=$(cd "$CTDB_TEST_SUITE_DIR" && pwd) test_suite_dir=$(cd "$CTDB_TEST_SUITE_DIR" && pwd)
reldir="${test_suite_dir#${test_dir}/}" reldir="${test_suite_dir#${test_dir}/}"
export CTDB_TEST_TMP_DIR="${TEST_VAR_DIR}/${reldir}" export CTDB_TEST_TMP_DIR="${test_state_dir}/${reldir}"
rm -rf "$CTDB_TEST_TMP_DIR" rm -rf "$CTDB_TEST_TMP_DIR"
mkdir -p "$CTDB_TEST_TMP_DIR" mkdir -p "$CTDB_TEST_TMP_DIR"
@ -288,16 +288,16 @@ CTDB_TESTS_ARE_INSTALLED=false
CTDB_TEST_DIR=$(dirname "$0") CTDB_TEST_DIR=$(dirname "$0")
export CTDB_TESTS_ARE_INSTALLED CTDB_TEST_DIR export CTDB_TESTS_ARE_INSTALLED CTDB_TEST_DIR
if [ -z "$TEST_VAR_DIR" ] ; then if [ -z "$test_state_dir" ] ; then
if $CTDB_TESTS_ARE_INSTALLED ; then if $CTDB_TESTS_ARE_INSTALLED ; then
TEST_VAR_DIR=$(mktemp -d) test_state_dir=$(mktemp -d)
else else
TEST_VAR_DIR="${CTDB_TEST_DIR}/var" test_state_dir="${CTDB_TEST_DIR}/var"
fi fi
fi fi
mkdir -p "$TEST_VAR_DIR" mkdir -p "$test_state_dir"
summary_file="${TEST_VAR_DIR}/.summary" summary_file="${test_state_dir}/.summary"
: >"$summary_file" : >"$summary_file"
export TEST_SCRIPTS_DIR="${CTDB_TEST_DIR}/scripts" export TEST_SCRIPTS_DIR="${CTDB_TEST_DIR}/scripts"
@ -325,10 +325,10 @@ fi
do_cleanup () do_cleanup ()
{ {
if $TEST_CLEANUP ; then if $TEST_CLEANUP ; then
echo "Removing TEST_VAR_DIR=$TEST_VAR_DIR" echo "Removing test state directory: ${test_state_dir}"
rm -rf "$TEST_VAR_DIR" rm -rf "$test_state_dir"
else else
echo "Not cleaning up TEST_VAR_DIR=$TEST_VAR_DIR" echo "Not cleaning up test state directory: ${test_state_dir}"
fi fi
} }