diff options
author | Chase Qi <chase.qi@linaro.org> | 2016-09-18 18:44:31 +0800 |
---|---|---|
committer | Chase Qi <chase.qi@linaro.org> | 2016-09-30 00:06:31 +0000 |
commit | 92bff7d00b928364e7e2de11caabfcaec5aa1e43 (patch) | |
tree | 815ac5f7ebecf77d73676f355b20cd2c5f2cbe06 | |
parent | 74a5f348241a9fa90c6ed3bd0d1618edada1f493 (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-x | automated/lib/sh-test-lib | 12 |
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 |