Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ck_skip() and ck_skip_msg(...) macros [WIP] [DISCUSS] #263

Closed
wants to merge 1 commit into from

Conversation

jbboehr
Copy link

@jbboehr jbboehr commented Jun 12, 2020

  • ck_skip() aborts the test and marks it as skipped
  • ck_skip_msg(...) does the same with a custom printf message
  • _ck_skip() is exposed as a symbol

These are all analogues of ck_abort(), ck_abort_msg(), and _ck_assert_failed()

Since they basically work like ck_abort(), I decided to use a flag wasskipped in FailMsg instead of adding a new message type.

As it is, I'm not including skipped tests in the success percentage, but they are included in total tests run. I considered adding srunner_ntests_skipped() and srunner_skipped() but decided to hold off since they are included in srunner_results()

In tr_type_str, I assigned skip to K because the default return value was S already. I'm not sure if there's a more appropriate value here.

I'm personally using check with the autotools tap driver, and it seems to be working alright so far.

Let me know if you have any thoughts and, of course, feel free to request changes.

Closes #178

@jbboehr jbboehr force-pushed the ck-skip branch 2 times, most recently from 07c8ca7 to 8d8084b Compare June 12, 2020 02:43
* `ck_skip()` aborts the tests and marks it as skipped
* `ck_skip_msg(...)` does the same with a custom printf message
* `_ck_skip()` is exposed as a symbol
@thom311
Copy link

thom311 commented May 16, 2024

I think a skip should not abort the test, unlike an assertion failure. Otherwise, if you run without fork-mode, an earlier skip will prevent all followup tests from running. With assertion failures that is fine, because you better debug the first failure you encounter. For skip, that seems undesirable.

Compare to glib's g_test_skip(), which just remembers the verdict of the test, and evaluates the test result at the end.

Yes, it means, usually the user would follow up that with an additional return, like

if (!has_dependency()) {
     ck_skip("Lacks dependency");
     return;
}

I think this would be a good feature.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature request: skipping a test from within a test
2 participants