From: Martin Schwenke Date: Tue, 17 Sep 2019 06:00:13 +0000 (+1000) Subject: ctdb-tests: Add functions for terminating tests on failure, skip, error X-Git-Tag: talloc-2.3.1~497 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=65ca431c95e53e8686c2887d8c8ddaf67999305b;p=thirdparty%2Fsamba.git ctdb-tests: Add functions for terminating tests on failure, skip, error This allows standard exit codes for failed and skipped tests, and test errors. Skipped tests currently just succeed and a test error is the same as a failure. These can be easily changed later when run_tests.sh is ready to handle them. Signed-off-by: Martin Schwenke Reviewed-by: Amitay Isaacs --- diff --git a/ctdb/tests/scripts/common.sh b/ctdb/tests/scripts/common.sh index de117e90caa..1165fcadb47 100644 --- a/ctdb/tests/scripts/common.sh +++ b/ctdb/tests/scripts/common.sh @@ -23,6 +23,30 @@ if [ -d "$CTDB_SCRIPTS_TESTS_LIBEXEC_DIR" ] ; then PATH="${CTDB_SCRIPTS_TESTS_LIBEXEC_DIR}:${PATH}" fi +ctdb_test_error () +{ + if [ $# -gt 0 ] ; then + echo "$*" + fi + exit 1 +} + +ctdb_test_fail () +{ + if [ $# -gt 0 ] ; then + echo "$*" + fi + exit 1 +} + +ctdb_test_skip () +{ + if [ $# -gt 0 ] ; then + echo "$*" + fi + exit 0 +} + # Wait until either timeout expires or command succeeds. The command # will be tried once per second, unless timeout has format T/I, where # I is the recheck interval.