-
Notifications
You must be signed in to change notification settings - Fork 2k
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
[no squash] Fix building unittests & benchmarks by upgrading Catch2 #14735
Conversation
Importing 200kLOC is a terrible idea. Downloading content at build time is a nuisance, so FetchContent is not worthy of consideration.
I'm pretty sure this was required to make the automated benchmarks work correctly. |
Alright, I'll go with the amalgamated source, and re-apply the patch to output everything in microseconds. CI reveals that the return value of |
Alright, switched to the amalgamation. The custom cout / cerr / clog pose a problem, because they cause ODR definition violations vs. Catch internals. We need to tell Catch to always use our redefinitions (for benchmarks as well) which just use |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for fixing the ability to build unittests and benchmarks together. This is a nice clean solution. I will be closing #14693 in favor of this.
3479e71
to
ab026e8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
I also suggest changing the author of the first commit to something artificial to not skew the LoC change statistics. |
Done, thanks for the reminder. (I remember having done this initially, but it probably got lost when I switched to the amalgamation, redoing the commit.) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CI green = good
Fixes #14692, alternative to #14693, by simply upgrading Catch2 to v3. Catch uses a separate implementation and header now, which helps resolve the issue. This uses the amalgamation.
Bonus: Catch2 version upgrade.
Small change (I consider this an improvement, but you may differ): Gets rid of
#define CATCH_CONFIG_CONSOLE_WIDTH 160
. I think this (arbitrarily?) chosen number is too large. It is also inconsistent with unit tests. Using the Catch default (80) here is better (and simpler) IMO.Fun fact: You can run benchmarks via
--run-unittests --test-module <benchmark>
now. Catch2 also prints "Randomness seeded to: <seed>" now.To review, look at the second commit (8b02699). The first commit updates the vendored copy, which causes a lot of noise.
How to test
--run-unittests
and--run-benchmarks
work as expected.--test-module
is used.