diff options
| author | Martin Hořeňovský | 2025-09-21 11:19:18 +0200 |
|---|---|---|
| committer | Martin Hořeňovský | 2025-09-22 14:02:45 +0200 |
| commit | 8ed8c431c601c7b303dbfe7eb412a63f1641b812 (patch) | |
| tree | 4e23dd0b60bfb09b58bb5bac770965c83243c569 /src/catch2/internal/catch_commandline.cpp | |
| parent | dc3a4ea41a78c643fbfa07b1cb456738c9e25ef6 (diff) | |
| download | catch3-8ed8c431c601c7b303dbfe7eb412a63f1641b812.tar.gz | |
Support Bazel's TEST_PREMATURE_EXIT_FILE and add it to CLI as well
This tells Catch2 to create an empty file at specified path before
the tests start, and delete it after the tests finish. This allows
callers to catch cases where the test binary silently exits before
finishing (e.g. via call to `exit(0)` inside the code under test),
by looking whether the file still exists.
Closes #3020
Diffstat (limited to 'src/catch2/internal/catch_commandline.cpp')
| -rw-r--r-- | src/catch2/internal/catch_commandline.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/catch2/internal/catch_commandline.cpp b/src/catch2/internal/catch_commandline.cpp index 212f1774..db903507 100644 --- a/src/catch2/internal/catch_commandline.cpp +++ b/src/catch2/internal/catch_commandline.cpp @@ -305,6 +305,9 @@ namespace Catch { | Opt( config.allowZeroTests ) ["--allow-running-no-tests"] ( "Treat 'No tests run' as a success" ) + | Opt( config.prematureExitGuardFilePath, "path" ) + ["--premature-exit-guard-file"] + ( "create a file before running tests and delete it during clean exit" ) | Arg( config.testsOrTags, "test name|pattern|tags" ) ( "which test or tests to use" ); |