summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChase Qi <chase.qi@linaro.org>2016-09-18 18:44:31 +0800
committerChase Qi <chase.qi@linaro.org>2016-09-18 18:44:31 +0800
commit0c69ba192e3b7af9a70b2dbdc0d93c401c10dcb2 (patch)
tree815ac5f7ebecf77d73676f355b20cd2c5f2cbe06
parent7f319ba82b05da329514f00e109a5689df11abf6 (diff)
v2: lib: added skip_list support for exit_on_fail
When using exit_on_fail function, you may need to save "rest_tests skip" to result file. Adding optional parameter skip_list for that usage. Change-Id: I6c8165dfaae36caace5757bd90b4e19185c46199 Signed-off-by: Chase Qi <chase.qi@linaro.org>
-rwxr-xr-xautomated/lib/sh-test-lib12
1 files changed, 11 insertions, 1 deletions
diff --git a/automated/lib/sh-test-lib b/automated/lib/sh-test-lib
index 818fc90..39a7e92 100755
--- a/automated/lib/sh-test-lib
+++ b/automated/lib/sh-test-lib
@@ -32,11 +32,21 @@ check_root() {
exit_on_fail() {
local exit_code="$?"
- [ "$#" -ne 1 ] && error_msg "Usage: exit_on_fail test"
+ [ "$#" -lt 1 ] && error_msg "Usage: exit_on_fail test [skip_list]"
local test="$1"
+ local skip_list="$2"
if [ "${exit_code}" -ne 0 ]; then
echo "${test} fail" | tee -a "${RESULT_FILE}"
+
+ # skip_list is a list of tests sepereated by space. This might be
+ # useful when exiting on prerequisite not met.
+ if [ -n "${skip_list}" ]; then
+ for i in ${skip_list}; do
+ echo "$i skip" | tee -a "${RESULT_FILE}"
+ done
+ fi
+
# Exit normally to continue to run the following steps defined in test
# definition file.
exit 0