summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCraig Scott <craig.scott@crascit.com>2018-12-22 21:10:14 (GMT)
committerKitware Robot <kwrobot@kitware.com>2018-12-22 21:10:29 (GMT)
commitd780fb15a4bae35f37a3b0e34085ea0b028357e4 (patch)
treef15cce15840deac6b623ee2bf2ff176345c5d059
parent87ddcad03e69746cedcef9b9820151c6bfd8d7dc (diff)
parentb6eafd5781bfce88e29b5e6d5bf07bfe742c9654 (diff)
downloadCMake-d780fb15a4bae35f37a3b0e34085ea0b028357e4.zip
CMake-d780fb15a4bae35f37a3b0e34085ea0b028357e4.tar.gz
CMake-d780fb15a4bae35f37a3b0e34085ea0b028357e4.tar.bz2
Merge topic 'runcmake-test-filter'
b6eafd5781 Tests: Add RunCMake_TEST_FILTER environment variable Acked-by: Kitware Robot <kwrobot@kitware.com> Acked-by: Artur Ryt <artur.ryt@gmail.com> Merge-request: !2743
-rw-r--r--Tests/RunCMake/README.rst11
-rw-r--r--Tests/RunCMake/RunCMake.cmake4
2 files changed, 15 insertions, 0 deletions
diff --git a/Tests/RunCMake/README.rst b/Tests/RunCMake/README.rst
index 08b51d9..d8b43fe 100644
--- a/Tests/RunCMake/README.rst
+++ b/Tests/RunCMake/README.rst
@@ -65,3 +65,14 @@ but do not actually build anything. To add a test:
Top of test binary tree
and an failure must store a message in ``RunCMake_TEST_FAILED``.
+
+To speed up local testing, you can choose to run only a subset of
+``run_cmake()`` tests in a ``RunCMakeTest.cmake`` script by using the
+``RunCMake_TEST_FILTER`` environment variable. If this variable is set,
+it is treated as a regular expression, and any tests whose names don't
+match the regular expression are not run. For example::
+
+ $ RunCMake_TEST_FILTER="^example" ctest -R '^RunCMake\.Example$'
+
+This will only run subtests in ``RunCMake.Example`` that start with
+``example``.
diff --git a/Tests/RunCMake/RunCMake.cmake b/Tests/RunCMake/RunCMake.cmake
index 4bacd96..ce71677 100644
--- a/Tests/RunCMake/RunCMake.cmake
+++ b/Tests/RunCMake/RunCMake.cmake
@@ -9,6 +9,10 @@ foreach(arg
endforeach()
function(run_cmake test)
+ if(DEFINED ENV{RunCMake_TEST_FILTER} AND NOT test MATCHES "$ENV{RunCMake_TEST_FILTER}")
+ return()
+ endif()
+
set(top_src "${RunCMake_SOURCE_DIR}")
set(top_bin "${RunCMake_BINARY_DIR}")
if(EXISTS ${top_src}/${test}-result.txt)