77 Commits

Author SHA1 Message Date
Manuel Knörle ae5d271da2 Remove debug message for environment variable check 2026-07-15 11:19:22 +02:00
Nikolay Baklicharov a15f718c82 Optimize JSON parsing in catch_discover_tests() 2026-07-08 10:29:59 +02:00
Martin Hořeňovský 191fa38c9b v3.15.2 2026-07-07 20:44:33 +02:00
Martin Hořeňovský 9ec44dd62b catch_discover_tests uses tempfile to retrieve JSON from the binary
This allows it to deal with badly behaved code, where 3rd party
dependencies write into stdout during global construction.

Closes #3162
Closes #3166
2026-07-04 16:36:05 +02:00
Martin Hořeňovský bcfb10e498 v3.15.1 2026-06-14 10:57:30 +02:00
Martin Hořeňovský 6ee0826dca v3.15.0 2026-05-12 13:16:46 +02:00
Martin Hořeňovský b670de4fe1 v3.14.0 2026-04-05 15:05:38 +02:00
Sung, Po Han f4e83daa18 Fix catch_discover_tests PRE_TEST failure with zero discoverable tests
When using catch_discover_tests() with DISCOVERY_MODE PRE_TEST and a
multi-config generator (e.g. Ninja Multi-Config), if a test target has
zero discoverable tests (e.g. all tests tagged with [.]), ctest fails:

  CMake Error: include could not find requested file:
    .../test-hidden-b12d07c_tests-Release.cmake

The early return added in #2962 (76f70b14) correctly prevented a JSON
parsing crash for zero tests, but skipped writing the ctest file. The
PRE_TEST include script unconditionally includes this file, so the
missing file causes a hard error that aborts all test discovery.

Write an empty file before returning early so the include always
succeeds.
2026-04-02 10:24:46 +02:00
Martin Hořeňovský 29c9844f68 v3.13.0 2026-02-15 22:55:48 +01:00
Martin Hořeňovský 88abf9bf32 v3.12.0 2025-12-28 22:31:54 +01:00
Martin Hořeňovský b3fb4b9fea v3.11.0 2025-09-30 10:54:31 +02:00
Martin Hořeňovský 25319fd304 v3.10.0 2025-08-25 21:30:21 +02:00
Martin Hořeňovský 644821ce28 v3.9.1 2025-08-09 00:30:23 +02:00
Martin Hořeňovský fee81626d2 v3.9.0 2025-07-24 22:01:46 +02:00
Chris Thrasher 8cfca70ae8 Fix formatting of CMake files
2 spaces seems to be the more common indentation level so that's what
I unified around.
2025-04-26 10:38:36 -06:00
Chris Thrasher 2b60af89e2 v3.8.1 2025-04-08 12:40:18 -06:00
Chris Thrasher 76f70b1403 Fix bug where catch_discover_tests fails when no TEST_CASEs are present 2025-03-12 14:03:56 -06:00
Martin Hořeňovský 914aeecfe2 v3.8.0 2025-01-06 00:41:45 +01:00
Martin Hořeňovský 7d7b2f89f2 Support adding test tags as CTest labels in catch_discover_tests
We also bump the minimum CMake version to 3.20 as per #2943
2025-01-05 20:02:00 +01:00
Holger Kaelberer 0321d2fce3 Catch.cmake: Remove redundant CTEST_FILE param 2024-11-22 11:05:50 +01:00
Martin Hořeňovský fa43b77429 v3.7.1 2024-09-17 10:45:43 +02:00
Martin Hořeňovský 79f2d66ea3 Use SKIP_RETURN_CODE test property in catch_discover_tests
I also added `SKIP_IS_FAILURE` option to the `catch_discover_tests`
function, to allow users to get back the old behaviour.

Closes #2873
2024-09-17 09:35:43 +02:00
Martin Hořeňovský 31588bb4f5 v3.7.0 2024-08-14 12:05:21 +02:00
Martin Hořeňovský a579b5f640 Properly handle prepending user-specified paths to DYLD_FRAMEWORK_PATH 2024-08-13 23:05:21 +02:00
Chien-Yu Lin 1538be67cb Respect path order of DL_PATHS in catch_discover_tests function 2024-08-13 22:23:16 +02:00
Andy Phillips 85b7f3d6ab Add optional argument to catch_discover_tests to set DYLD_FRAMEWORK_PATH (#2880)
* Added optional argument to catch_discover_tests to set the DYLD_FRAMEWORK_PATH environment variable on Apple platforms.
2024-07-22 19:25:24 +02:00
Martin Hořeňovský 4e8d92bf02 v3.6.0 2024-05-05 20:58:18 +02:00
Martin Hořeňovský b5373dadca v3.5.4 2024-04-10 12:05:46 +02:00
Cristian Le 202bdee977 Fix TEST_DL_PATHS to be multi-args
Signed-off-by: Cristian Le <cristian.le@mpsd.mpg.de>
2024-03-26 18:04:17 +01:00
Chris Thrasher 792c3b7549 Stop repeating conditional in endif()
This is not necessary so we can remove it. Most conditionals already
omit this anyways.
2024-03-12 22:55:12 +01:00
Martin Hořeňovský 8ac8190e49 v3.5.3 2024-03-01 22:07:10 +01:00
Martin Hořeňovský 05e10dfccc v3.5.2 2024-01-15 14:13:53 +01:00
Chris Thrasher 05786fa7ec Remove redundant destructors
Classes will automatically inherit the virtual-ness of their base
class destructors. If the base class already has a virtual
destructor and the derived class needs default destructor semantics
then the derived class can omit defining the destructor in favor of
the compiler automatically defining it.

This has an additional benefit of reenabling move semantics. The
presence of a user-specified destructor automatically disables move
operations.
2024-01-14 23:33:51 +01:00
Martin Hořeňovský f981c9cbca v3.5.1 2023-12-31 15:15:04 +01:00
Martin Hořeňovský 53d0d913a4 v3.5.0 2023-12-11 00:55:40 +01:00
Holger Kaelberer 7b793314e5 Catch.cmake: Support CMake multi-config with PRE_TEST discovery mode (#2739)
Closes #2746 

---------

Co-authored-by: Holger Kaelberer <Holger.Kaelberer@bmw.de>
2023-09-25 19:40:35 +02:00
Ilya Arzhannikov db495acdbb correct argument references in CatchAddTests.cmake 2023-09-20 15:47:11 +02:00
Martin Hořeňovský 6e79e682b7 v3.4.0 2023-07-13 13:37:30 +02:00
Robin Christ 42ee66b5e6 Fix handling of semicolon and backslash characters in CMake test discovery (#2676)
This PR fixes the handling of semicolon and backslash characters in test names in the CMake test discovery

Closes #2674
2023-06-14 23:40:10 +02:00
Holger Kaelberer aad926baf8 Catch.cmake: Add new DISCOVERY_MODE option to catch_discover_tests
Introducing a new DISCOVERY_MODE mode option, which provides greater
control over when catch_discover_tests perforsm test discovery.

It has two supported modes:
* POST_BUILD: The default behavior, which adds a POST_BUILD command
  to perform test discovery after the test has been built as was
  always done so far.

* PRE_TEST: New mode, which delays test discovery until test execution.
  The generated include file generates the appropriate CTest files at
  runtime and regenerates the CTest files when the executable is
  updated.
  This mode can be used in build-environments that don't allow for
  executing the linked binaries at build-time (like in a
  cross-compilation environment).

DISCOVERY_MODE can be controlled in two ways:
1. Setting the DISCOVERY_MODE when calling catch_discover_tests.

2. Setting the global CMAKE_CATCH_DISCOVER_TESTS_DISCOVERY_MODE prior
   to calling gtest_discover_tests.

Closes #2493
2023-04-19 23:51:42 +02:00
Holger Kaelberer 4e8399d835 CatchAddTests.cmake: Refactor into callable method
Move test discovery logic into new catch_discover_tests_impl method
and make CatchAddTests aware of whether it is being launched in
CMake's script mode.

When launched in script mode, catch_discover_tests_impl is called
passing arguments obtained from the definitions passed into the call
to cmake. This preserves the existing behavior assumed by Catch.cmake.

Looking ahead, it also allows CatchAddTests to be included in
generated files and call catch_discover_tests_impl to perform test
discovery at test runtime with the new PRE_TEST discovery mode
introduced later.
2023-04-19 23:51:42 +02:00
Arne Mertz 50bf00e266 Fix reporter detection in catch_discover_tests
Closes #2668
Instead of grepping for the reporter, use it in the process and check for the error code
2023-04-05 10:12:50 +02:00
Bob Miller 6783411349 Fixed extras installation and shard impl location 2023-03-14 18:31:38 +01:00
Martin Hořeňovský 3f0283de7a v3.3.2 2023-02-27 15:12:49 +01:00
Martin Hořeňovský 2ab20a0e00 v3.3.1 2023-01-29 23:18:57 +01:00
Martin Hořeňovský c837cb4a8a v3.3.0 2023-01-22 19:53:12 +01:00
Martin Hořeňovský ab6c7375be v3.2.1 2022-12-09 23:10:18 +01:00
Martin Hořeňovský 65cc7fd2ae v3.2.0 2022-11-16 20:05:48 +01:00
Lars Toenning f1084fb309 Fix references to license file
The license file was renamed with 6a502cc2f5
2022-10-28 11:30:15 +02:00
Martin Hořeňovský 5df88da16e 3.1.1 2022-10-17 19:57:58 +02:00