diff options
author | Naresh Kamboju <naresh.kamboju@linaro.org> | 2016-11-17 22:14:50 +0530 |
---|---|---|
committer | Naresh Kamboju <naresh.kamboju@linaro.org> | 2016-11-18 11:55:27 +0000 |
commit | b2a67fa64bfb7ca42575d3b923fb56f188b1d4aa (patch) | |
tree | 2a3cafdb23acdf74bbaf5bf36aff3a638c154d25 /automated/lib | |
parent | 57cd01011c15d2cc062e7ce5ef79aca90a9b049b (diff) |
lib: Adding new function exit_on_skip
exit_on_skip "testcase-name" "reason for skip"
Change-Id: I361f8282c1201362cd89afb4961012d02c8b2bbe
Signed-off-by: Naresh Kamboju <naresh.kamboju@linaro.org>
Signed-off-by: Milosz Wasilewski <milosz.wasilewski@linaro.org>
Diffstat (limited to 'automated/lib')
-rwxr-xr-x | automated/lib/sh-test-lib | 22 |
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" |