-e Exit on the first test failure
-H No headers - for running single test with other wrapper
-I <count> Iterate tests <count> times, exiting on failure (implies -e, -N)
+ -l <count> Use <count> daemons for local daemon integration tests
-L Print daemon logs on test failure (only some tests)
-N Don't print summary of tests results after running all tests
-q Quiet - don't show tests being run (still displays summary)
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=3
+export CTDB_TEST_SWRAP_SO_PATH=""
-while getopts "AcCDehHI:LNqS:T:vV:xX?" opt ; do
+while getopts "AcCDehHI:l: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_LOCAL_DAEMONS="$OPTARG" ;;
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
case $(basename "$0") in
*run_cluster_tests*)
# Running on a cluster... same as -c
- TEST_LOCAL_DAEMONS=""
+ CTDB_TEST_LOCAL_DAEMONS=""
;;
esac
start_time=$(date '+%s')
if [ -x "$f" ] ; then
- timeout "$test_time_limit" "$f" | show_progress
+ timeout "$test_time_limit" "$f" </dev/null | show_progress
status=$?
else
echo "TEST IS NOT EXECUTABLE"
printf '%-10s %s\n' "$t" "$f" >>"$summary_file"
fi
+ # Skipped tests should not cause failure
+ case "$status" in
+ 77)
+ status=0
+ ;;
+ esac
+
return $status
}
local test_dir test_suite_dir reldir
test_dir=$(cd "$CTDB_TEST_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_state_dir}/${reldir}"
rm -rf "$CTDB_TEST_TMP_DIR"
# Can't find it? Check relative to CTDB_TEST_DIR.
# Strip off current directory from beginning,
# if there, just to make paths more friendly.
- f="${CTDB_TEST_DIR#${PWD}/}/${f}"
+ f="${CTDB_TEST_DIR#"${PWD}"/}/${f}"
fi
if [ -d "$f" ] ; then
test_dir=$(cd "$CTDB_TEST_DIR" && pwd)
dir=$(cd "$f" && pwd)
- reldir="${dir#${test_dir}/}"
+ reldir="${dir#"${test_dir}"/}"
case "$reldir" in
*/*/*)
die "test \"$f\" is not recognised"
fi
- if $exit_on_fail && [ $status -ne 0 ] ; then
- return $status
+ if $exit_on_fail && [ "$status" -ne 0 ] ; then
+ return "$status"
fi
done
}
# 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
done
if $with_summary ; then
- if [ $status -eq 0 ] || ! $exit_on_fail ; then
+ if [ "$status" -eq 0 ] || ! $exit_on_fail ; then
echo
cat "$summary_file"
do_cleanup
if $no_header || $exit_on_fail ; then
- exit $status
+ exit "$status"
elif [ $tests_failed -gt 0 ] ; then
exit 1
else