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

summaryrefslogtreecommitdiffhomepage
path: root/tests/ExtraTests
diff options
context:
space:
mode:
authorMartin Hořeňovský2020-07-06 20:02:20 +0200
committerMartin Hořeňovský2020-07-26 10:47:58 +0200
commite6d947f6d4f84713637da5e5b37cd1f84b925403 (patch)
treeda9042ccaa9bfabb39e3d70aaa5904ead4f8a6a2 /tests/ExtraTests
parent80b0d6975c1582d03436ba82146983d557b0a1a6 (diff)
downloadcatch3-e6d947f6d4f84713637da5e5b37cd1f84b925403.tar.gz
Refactor tests for duration reporting threshold
Diffstat (limited to 'tests/ExtraTests')
-rw-r--r--tests/ExtraTests/CMakeLists.txt25
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/ExtraTests/CMakeLists.txt b/tests/ExtraTests/CMakeLists.txt
index 4946d842..3c6da4d5 100644
--- a/tests/ExtraTests/CMakeLists.txt
+++ b/tests/ExtraTests/CMakeLists.txt
@@ -8,6 +8,31 @@ project( Catch2ExtraTests LANGUAGES CXX )
message( STATUS "Extra tests included" )
+# The MinDuration reporting tests do not need separate compilation, but
+# they have non-trivial execution time, so they are categorized as
+# extra tests, so that they are run less.
+add_test(NAME MinDuration::SimpleThreshold COMMAND $<TARGET_FILE:SelfTest> --min-duration 0.15 [min_duration_test])
+set_tests_properties(
+ MinDuration::SimpleThreshold
+ PROPERTIES
+ PASS_REGULAR_EXPRESSION "s: sleep_for_200ms"
+ FAIL_REGULAR_EXPRESSION "sleep_for_100ms"
+ RUN_SERIAL ON # The test is timing sensitive, so we want to run it
+ # serially to avoid false positives on oversubscribed machines
+)
+
+# -d yes overrides the threshold, so we should see the faster test even
+# with a ridiculous high min duration threshold
+add_test(NAME MinDuration::DurationOverrideYes COMMAND $<TARGET_FILE:SelfTest> --min-duration 1.0 -d yes [min_duration_test])
+set_tests_properties(
+ MinDuration::DurationOverrideYes
+ PROPERTIES
+ PASS_REGULAR_EXPRESSION "s: sleep_for_100ms"
+)
+
+
+# ------------ end of duration reporting tests
+
# define folders used:
set( TESTS_DIR ${CATCH_DIR}/tests/ExtraTests )