Skipped tests will not cause the test harness to return failure. An
exit status of "3" was chosen for skipped tests. This doesn't
conflict with any of the current tests.
Signed-off-by: Jeff Moyer <jmoyer@redhat.com>
Gbp-Pq: Topic upstream
Gbp-Pq: Name 0021-harness-add-support-for-skipping-tests.patch
int main(void)
{
int res;
+ const char *test_result;
#if defined(SETUP)
SETUP;
#endif
res = test_main();
- printf("test %s completed %s.\n", test_name,
- res ? "FAILED" : "PASSED"
- );
+ switch(res) {
+ case 0:
+ test_result = "PASSED";
+ break;
+ case 3:
+ test_result = "SKIPPED";
+ break;
+ default:
+ test_result = "FAILED";
+ res = 1;
+ break;
+ }
+
+ printf("test %s completed %s.\n", test_name, test_result);
fflush(stdout);
- return res ? 1 : 0;
+ return res;
}
passes=0
fails=0
+skips=0
echo "Test run starting at" `date`
echo "Starting $this_test"
$this_test 2>&1
res=$?
- if [ $res -eq 0 ] ; then str="" ; passes=$[passes + 1] ; else str=" -- FAILED" ; fails=$[fails + 1] ; fi
+ if [ $res -eq 0 ]; then
+ str="";
+ passes=$((passes + 1));
+ elif [ $res -eq 3 ]; then
+ str=" -- SKIPPED";
+ skips=$((skips + 1));
+ else
+ str=" -- FAILED"
+ fails=$((fails + 1));
+ fi
echo "Completed $this_test with $res$str".
done
-echo "Pass: $passes Fail: $fails"
+echo "Pass: $passes Fail: $fails Skip: $skips"
echo "Test run complete at" `date`
exit $fails