Commit ed92a5f9 authored by Sebastian Ramacher's avatar Sebastian Ramacher

Mark tests as skipped if setup fails

parent 77846d51
......@@ -10,9 +10,26 @@ int run_suite(Suite* suite)
SRunner* suite_runner = srunner_create(suite);
srunner_run_all(suite_runner, CK_NORMAL);
const int number_failed = srunner_ntests_failed(suite_runner);
int ret = EXIT_SUCCESS;
if (number_failed != 0) {
ret = EXIT_FAILURE;
const int tests_run = srunner_ntests_run(suite_runner);
TestResult** results = srunner_failures(suite_runner);
for (int i = 0; i < tests_run; ++i) {
if (tr_ctx(results[i]) == CK_CTX_SETUP) {
/* mark tests as skipped */
ret = 77;
break;
}
}
}
srunner_free(suite_runner);
return (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
return ret;
}
void setup(void)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment