Commit Graph

58 Commits

Author SHA1 Message Date
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
mheimlich
a7dc85dd49 Use DYLD_LIBRARY_PATH on apple platforms. 2022-07-23 20:45:49 +02:00
Martin Hořeňovský
97c48e0c34
v3.1.0 2022-07-17 20:18:44 +02:00
mheimlich
a63ad74554
Added new DL_PATHS option to catch_discover_tests() (#2467)
This enables setting the required PATH/LD_LIBRARY_PATH environment variables both when retrieving the list of text cases and when executing the tests.

Co-authored-by: Martin Hořeňovský <martin.horenovsky@gmail.com>
2022-07-11 18:31:32 +02:00
Martin Hořeňovský
34d9724058
Add experimental CMake script for sharding tests in binaries 2022-06-24 14:12:55 +02:00
Martin Hořeňovský
605a34765a
v3.0.1 2022-05-17 22:13:36 +02:00
Martin Hořeňovský
f526ff0fc3
Bump version to v3.0.0 preview 5 2022-04-20 23:46:07 +02:00
Martin Hořeňovský
f4af9f6926
Bump version to v3.0.0 preview 4 2022-01-03 23:16:39 +01:00
Martin Hořeňovský
e6da4e10ae
Use make_unique instead of unique_ptr(new T) 2021-06-01 00:17:22 +02:00
Martin Hořeňovský
f9ec34ce01
Make operator BenchmarkStats<Duration2> explicit 2021-05-28 23:19:07 +02:00
Reinhold Gschweicher
48f220b68a
Add deprecation warning in ParseAndCatchTests
Parsing C++ with regex in CMake is error prone and regularly leads to silently
dropped (not run) test cases.

Going forward the function `catch_discover_tests` from `contrib/CMake.cmake`
should be used.

For more information see https://github.com/catchorg/Catch2/issues/2092#issuecomment-747342765
2021-05-09 18:05:25 +02:00
Reinhold Gschweicher
031a57e7b7
Fix Catch.cmake helper by setting variable globally
Set `_CATCH_DISCOVER_TESTS_SCRIPT` helper variable globally. Otherwise in a
scoped call (like `add_subdirectory()`) the variable gets lost. This lost
variable results in a post build error with not much information to lead to the
root of the problem.

This enables the usage of the helper script with the following example structure

- CMakeLists.txt (project root with `add_subdirectory(external/catch2)`
- external/catch2
  - CMakeLists.txt (contents listed below)
  - contrib/Catch.cmake
  - contrib/CatchAddTests.cmake
  - catch2/catch.hpp
- tests
  - CMakeLists.txt (add tests with `catch_discover_tests(${PROJECT_NAME})`)

contents of project specific helper `external/catch2/CMakeLists.txt`
```cmake
cmake_minimum_required (VERSION 3.1...${CMAKE_VERSION})
project(Catch2 LANGUAGES CXX VERSION 2.13.3)
add_library(Catch2 INTERFACE)
target_include_directories(Catch2
  INTERFACE
    $<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}>
)
 # provide a namespaced alias for clients to 'link' against if catch is included as a sub-project
add_library(Catch2::Catch2 ALIAS Catch2)
include(contrib/Catch.cmake)
```
2021-05-09 18:05:18 +02:00
Georg Schwab
04166514fe fixed inconsistent semicolon expansion in catch_discover_tests (Bug #2214) 2021-04-16 17:22:14 +02:00
Julien Brianceau
e8cdfdca87
Fix typos in the code base (#2206)
Note that only documentation and comments are impacted by this change.
2021-04-07 20:43:50 +02:00
Reinhold Gschweicher
74b397e6b8
Consider CMP0110 add_test() policy
CMake 3.19 introduces new add_test() behavior guarded with the policy
CMP0110.

See: https://cmake.org/cmake/help/latest/policy/CMP0110.html

Update the helper script ParseAndAddCatchTests to consider the policy and
handle the test case name accordingly.
2020-11-02 14:42:22 +01:00
Reinhold Gschweicher
730ec39a74
Fix indentation in ParseAndAddCatchTests
Consistently use 4 spaces instead of tabs
2020-11-02 14:42:19 +01:00
Reinhold Gschweicher
71328bae90
Fix CMake regex to add tests
Fix regex that requires two string arguments in the form of
TEST_CASE("a", "b") resulting in not finding TEST_CASE("a") entries.

See https://regex101.com/r/JygOND/1

Fixes: https://github.com/catchorg/Catch2/issues/2055
2020-11-02 14:42:17 +01:00
Liam Keegan
c44d9cc718
fix warning in extras/CatchAddTests.cmake
- don't warn on zero return code of --list-reporters
  - previously return code was the number of reporters (#1410, #1146)
  - as of 2c06ee9 return code is zero on success
2020-10-08 16:44:20 +02:00
Martin Hořeňovský
b9853b4b35
Bump version to v3.0.0 preview 3 2020-10-08 15:26:30 +02:00
Rémy Salim
863cc6a155
Add WORKING_DIRECTORY to CatchAddTests.cmake commands 2020-10-08 11:41:35 +02:00