diff options
| author | Martin Schwenke <martin@meltin.net> | 2012-04-19 11:50:32 +1000 |
|---|---|---|
| committer | Martin Schwenke <martin@meltin.net> | 2012-04-27 15:40:43 +1000 |
| commit | d4b102fe82192e42bb36185d2ccd9a0cd7b496b9 (patch) | |
| tree | f568a3a8fd1e2eac79b47da7e60c152a348fcd2a /ctdb/tests/scripts | |
| parent | 21b219075173e4e365d2fce271c1f4ea315455bf (diff) | |
tests: Add -e option to cause run_tests to exit on first test failure
Signed-off-by: Martin Schwenke <martin@meltin.net>
(This used to be ctdb commit f45295a3005474957852d0e7a5c3807e30ab519d)
Diffstat (limited to 'ctdb/tests/scripts')
| -rwxr-xr-x | ctdb/tests/scripts/run_tests | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/ctdb/tests/scripts/run_tests b/ctdb/tests/scripts/run_tests index f901ef2a7a..f45afc35a4 100755 --- a/ctdb/tests/scripts/run_tests +++ b/ctdb/tests/scripts/run_tests @@ -7,6 +7,7 @@ Usage: run_tests [OPTIONS] [TESTS] Options: -s Print a summary of tests results after running all tests -l Use local daemons for integration tests + -e Exit on the first test failure -v Verbose - print test output for non-failures (only some tests) -A Use "cat -A" to print test output (only some tests) -D Show diff between failed/expected test output (some tests only) @@ -29,6 +30,7 @@ die () with_summary=false with_desc=false quiet=false +exit_on_fail=false export TEST_VERBOSE=false export TEST_COMMAND_TRACE="" @@ -36,7 +38,7 @@ export TEST_CAT_RESULTS_OPTS="" export TEST_DIFF_RESULTS=false export TEST_LOCAL_DAEMONS # No default, developer can "override"! -temp=$(getopt -n "$prog" -o "xdhlqsvXAD" -l help -- "$@") +temp=$(getopt -n "$prog" -o "xdehlqsvXAD" -l help -- "$@") [ $? != 0 ] && usage @@ -46,6 +48,7 @@ while true ; do case "$1" in -x) set -x; shift ;; -d) with_desc=true ; shift ;; # 4th line of output is description + -e) exit_on_fail=true ; shift ;; -l) TEST_LOCAL_DAEMONS="3" ; shift ;; -q) quiet=true ; shift ;; -s) with_summary=true ; shift ;; @@ -167,9 +170,15 @@ for f ; do if [ -d "$f" ] ; then for i in $(ls "${f%/}/"*".sh" 2>/dev/null) ; do run_one_test "$i" + if $exit_on_fail && [ $status -ne 0 ] ; then + break + fi done elif [ -f "$f" ] ; then run_one_test "$f" + if $exit_on_fail && [ $status -ne 0 ] ; then + break + fi else die "test \"$f\" is not recognised" fi |
