Read-only mirrors. Development, issues and pull requests are on GitHub.

summaryrefslogtreecommitdiffhomepage
path: root/src/catch2/internal
diff options
context:
space:
mode:
authorJohn Bytheway2020-04-13 08:34:27 -0400
committerMartin Hořeňovský2020-07-26 10:47:53 +0200
commit80b0d6975c1582d03436ba82146983d557b0a1a6 (patch)
treee9b9cc1e4eb1f5fb6a298eed1c89c16f6076a5d5 /src/catch2/internal
parent36131f7ffa7f6a3e5a54de9fcf4f622e7b97a5a5 (diff)
downloadcatch3-80b0d6975c1582d03436ba82146983d557b0a1a6.tar.gz
Add --min-duration option
A test runner already has a --durations option to print durations. However, this isn't entirely satisfactory. When there are many tests, this produces output spam which makes it hard to find the test failure output. Nevertheless, it is helpful to be informed of tests which are unusually slow. Therefore, introduce a new option --min-duration that causes all durations above a certain threshold to be printed. This allows slow tests to be visible without mentioning every test.
Diffstat (limited to 'src/catch2/internal')
-rw-r--r--src/catch2/internal/catch_commandline.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/catch2/internal/catch_commandline.cpp b/src/catch2/internal/catch_commandline.cpp
index 9890ca64..2759eb8e 100644
--- a/src/catch2/internal/catch_commandline.cpp
+++ b/src/catch2/internal/catch_commandline.cpp
@@ -170,6 +170,9 @@ namespace Catch {
| Opt( [&]( bool flag ) { config.showDurations = flag ? ShowDurations::Always : ShowDurations::Never; }, "yes|no" )
["-d"]["--durations"]
( "show test durations" )
+ | Opt( config.minDuration, "seconds" )
+ ["-D"]["--min-duration"]
+ ( "show test durations for tests taking at least the given number of seconds" )
| Opt( loadTestNamesFromFile, "filename" )
["-f"]["--input-file"]
( "load test names to run from a file" )