[Cmake-commits] CMake branch, next, updated. v3.0.0-rc3-1707-g69fba98

Brad King brad.king at kitware.com
Tue Apr 1 09:57:56 EDT 2014


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".

The branch, next has been updated
       via  69fba98342c7a1094654662a3491878037c267cc (commit)
       via  2e2939c365292d1771d5dd6d2cd8f04e3d2aea44 (commit)
      from  c8ee8319b7b7df08da4f8b7459514d63f3cb7601 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=69fba98342c7a1094654662a3491878037c267cc
commit 69fba98342c7a1094654662a3491878037c267cc
Merge: c8ee831 2e2939c
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Tue Apr 1 09:57:56 2014 -0400
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Tue Apr 1 09:57:56 2014 -0400

    Merge topic 'FindGTest-TEST_P' into next
    
    2e2939c3 FindGTest: Teach GTEST_ADD_TESTS about TEST_P


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=2e2939c365292d1771d5dd6d2cd8f04e3d2aea44
commit 2e2939c365292d1771d5dd6d2cd8f04e3d2aea44
Author:     Jack Morrison <jackmorrison1 at gmail.com>
AuthorDate: Tue Apr 1 09:21:23 2014 -0400
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Tue Apr 1 09:48:20 2014 -0400

    FindGTest: Teach GTEST_ADD_TESTS about TEST_P
    
    Previously the GTEST_ADD_TESTS function would miss parameterized tests
    because it only considered TEST and TEST_F.  Add TEST_P to the list of
    considered tests and will run all instantiations of this parameterized
    test together.
    
    This is perhaps not as correct as searching for all instantiations of
    this parameterized test and separating those into separate runs, but
    this will at least run tests that were previously missing.
    
    For reference: https://code.google.com/p/googletest/wiki/Documentation

diff --git a/Modules/FindGTest.cmake b/Modules/FindGTest.cmake
index aa3c235..c4f911d 100644
--- a/Modules/FindGTest.cmake
+++ b/Modules/FindGTest.cmake
@@ -115,11 +115,19 @@ function(GTEST_ADD_TESTS executable extra_args)
         # obtain sources used for building that executable
         get_property(ARGN TARGET ${executable} PROPERTY SOURCES)
     endif()
+    set(gtest_case_name_regex ".*\\( *([A-Za-z_0-9]+), *([A-Za-z_0-9]+) *\\).*")
     foreach(source ${ARGN})
         file(READ "${source}" contents)
-        string(REGEX MATCHALL "TEST_?F?\\(([A-Za-z_0-9 ,]+)\\)" found_tests ${contents})
+        string(REGEX MATCHALL "TEST_?[FP]?\\(([A-Za-z_0-9 ,]+)\\)" found_tests ${contents})
         foreach(hit ${found_tests})
-            string(REGEX REPLACE ".*\\( *([A-Za-z_0-9]+), *([A-Za-z_0-9]+) *\\).*" "\\1.\\2" test_name ${hit})
+            string(REGEX MATCH "TEST_?[FP]?" test_type ${hit})
+
+            # Parameterized tests have a different signature for the filter
+            if(${test_type} STREQUAL "TEST_P")
+                string(REGEX REPLACE ${gtest_case_name_regex}  "*/\\1.\\2/*" test_name ${hit})
+            else()
+                string(REGEX REPLACE ${gtest_case_name_regex} "\\1.\\2" test_name ${hit})
+            endif()
             add_test(${test_name} ${executable} --gtest_filter=${test_name} ${extra_args})
         endforeach()
     endforeach()

-----------------------------------------------------------------------

Summary of changes:
 Modules/FindGTest.cmake |   12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list