-
Notifications
You must be signed in to change notification settings - Fork 10
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
Fix Catch2 XML format compatibility #183
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #183 +/- ##
==========================================
+ Coverage 94.03% 94.17% +0.13%
==========================================
Files 29 30 +1
Lines 1709 1750 +41
==========================================
+ Hits 1607 1648 +41
Misses 102 102
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report in Codecov by Sentry.
|
Trying to add more tests to catch the lines currently missing from the coverage; I noticed there's an edge case to the current implementation: struct destructor_asserter {
~destructor_asserter() {
CHECK(false);
}
};
TEST_CASE("test") {
SECTION("section 1") {
destructor_asserter a;
SECTION("section 2") {
throw std::runtime_error("oops");
}
}
} This is actually a pre-existing issue introduced in #178. This currently causes us to miss the |
Solved by reworking the "held state clearing" logic. This is no longer done unconditionally on the first We also expose this logic in a new public function TEST_CASE("foo") {
try {
// Your test code that can throw...
} catch (...) {
// Your custom handling logic...
// This is now necessary:
snitch::notify_exception_handled();
}
// Now, all following code works fine.
} If that call is forgotten, most things will still work fine: only a following unhandled exception would have confusing contextual information (i.e., wrong capture/info/section data reported). More detailed explanations are in #179. |
8beb659
to
4b42dd2
Compare
Catch2 has a section enter and exit event. This allows for finer resolution display of test failures in IDEs and CI dashboards without giving up the benefits of using sections.
As suggested in code review, don't include chrono in the snitch headers since this increases compile times. Use a basic integral representation type and then convert back and forth to chrono types in the source files when actually reading clocks or calculating times.
a426ccc
to
c8bc7e0
Compare
I'm happy to merge this. @CrustyAuklet if you are able to test this before merge, it would be awesome! Otherwise I'll just merge it sometime this weekend, and we can fix any issues in a follow up PR. Thanks for your help regardless, and sorry this took so long to merge... |
Originally contributed by @CrustyAuklet in #169. Rebased on the latest
main
branch and refactoring to solve the remaining issues.Also fixes #179.