0

I use catch2 extensively as part of my testing ecosystem, which gets fired by CLion running "ctest" during development and just running "ctest" by hand in CI.

My issue is, I can't seem to find a decent way to have those benchmarks be an opt-in type of situation when running my unit tests, which now makes the CLion and CI invocations of ctest take twice if not three times as long.

I know I can supply --skip-benchmarks to the Catch2 invocation via CLI, but I don't know of an easy way to pipe that through the ctest executable. I also want to avoid having to create a new profile in CLion on every fresh "git clone" on a dev machine.

Short of just some ifdef macro solution (which would require a recompile for benchmarking, I used this in the past and found it easily bit-rots akin to commented out "test" code), is there an easy way, ideally in CMakeList.txt itself or in the source code, to have benchmarks be opt-in, rather than opt out? Worst case, I can always fork Catch2 to add this feature in and attempt to mainline it.

hak8or
  • 488
  • 2
  • 9
  • 28
  • Does this answer your question? [How to pass command-line arguments in CTest at runtime](https://stackoverflow.com/questions/28812533/how-to-pass-command-line-arguments-in-ctest-at-runtime) – starball Jul 01 '23 at 17:30

0 Answers0