From f8af2993215b4f14432f8dba80fa976c3d9b767c Mon Sep 17 00:00:00 2001 From: Miroslav Lichvar Date: Thu, 14 Aug 2014 17:58:59 +0200 Subject: [PATCH] test: allow tests to be skipped --- test/simulation/run | 12 +++++++++--- test/simulation/test.common | 5 +++++ 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/test/simulation/run b/test/simulation/run index 75fc4e4..cbc7b8d 100755 --- a/test/simulation/run +++ b/test/simulation/run @@ -2,19 +2,25 @@ . test.common -passed=() failed=() +passed=() failed=() skipped=() [ $# -gt 0 ] && tests=($@) || tests=([0-9]*-*[^_]) for test in "${tests[@]}"; do echo "$test ($[${#passed[@]} + ${#failed[@]} + 1]/${#tests[@]})" - ./$test && passed=(${passed[@]} $test) || failed=(${failed[@]} $test) + ./$test + case $? in + 0) passed=(${passed[@]} $test);; + 9) skipped=(${skipped[@]} $test);; + *) failed=(${failed[@]} $test);; + esac echo done echo "SUMMARY:" -echo " TOTAL $[${#passed[@]} + ${#failed[@]}]" +echo " TOTAL $[${#passed[@]} + ${#failed[@]} + ${#skipped[@]}]" echo " PASSED ${#passed[@]}" echo " FAILED ${#failed[@]} (${failed[@]})" +echo " SKIPPED ${#skipped[@]} (${skipped[@]})" [ ${#failed} -eq 0 ] diff --git a/test/simulation/test.common b/test/simulation/test.common index 1178611..8aee454 100644 --- a/test/simulation/test.common +++ b/test/simulation/test.common @@ -101,6 +101,11 @@ test_fail() { exit 1 } +test_skip() { + echo "SKIP" + exit 9 +} + test_ok() { pad_line echo -e "\tOK"