summaryrefslogtreecommitdiff
path: root/automated/lib/sh-test-lib
diff options
context:
space:
mode:
Diffstat (limited to 'automated/lib/sh-test-lib')
-rwxr-xr-xautomated/lib/sh-test-lib22
1 files changed, 22 insertions, 0 deletions
diff --git a/automated/lib/sh-test-lib b/automated/lib/sh-test-lib
index 4cdfddb..a44d2c8 100755
--- a/automated/lib/sh-test-lib
+++ b/automated/lib/sh-test-lib
@@ -56,6 +56,28 @@ exit_on_fail() {
fi
}
+exit_on_skip() {
+ exit_code="$?"
+ [ "$#" -lt 1 ] && error_msg "Usage: exit_on_skip test_case [msg]"
+ test_case="$1"
+ msg="$2"
+
+ if [ "${exit_code}" -ne 0 ]; then
+ echo "${test_case} skip" | tee -a "${RESULT_FILE}"
+
+ if [ -n "${msg}" ]; then
+ error_msg "${msg}"
+ fi
+
+ # Exit normally to continue to run the following steps defined in test
+ # definition file.
+ exit 0
+ else
+ echo "${test_case} pass" | tee -a "${RESULT_FILE}"
+ return 0
+ fi
+}
+
check_return() {
exit_code="$?"
[ "$#" -ne 1 ] && error_msg "Usage: check_return test_case"