diff options
author | Brad King <brad.king@kitware.com> | 2020-05-06 13:31:42 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2020-05-06 13:31:53 (GMT) |
commit | b86dfa205686a13550cac0ab89b4f27951229f4d (patch) | |
tree | 3aa472a172d7975913d497c0adff0df00052a2fe /Modules | |
parent | f6178df27dfbf535e3eabdbe2e57649a989169aa (diff) | |
parent | 839a1010a3e2123e197e2c9e0ed8e5ad58988622 (diff) | |
download | CMake-b86dfa205686a13550cac0ab89b4f27951229f4d.zip CMake-b86dfa205686a13550cac0ab89b4f27951229f4d.tar.gz CMake-b86dfa205686a13550cac0ab89b4f27951229f4d.tar.bz2 |
Merge topic 'gtest-space-in-parameter'
839a1010a3 GoogleTestAddTests: Fix output processing
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !4694
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/GoogleTestAddTests.cmake | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/Modules/GoogleTestAddTests.cmake b/Modules/GoogleTestAddTests.cmake index 499332f..4af62ed 100644 --- a/Modules/GoogleTestAddTests.cmake +++ b/Modules/GoogleTestAddTests.cmake @@ -83,6 +83,8 @@ function(gtest_discover_tests_impl) ) endif() + # Preserve semicolon in test-parameters + string(REPLACE [[;]] [[\;]] output "${output}") string(REPLACE "\n" ";" output "${output}") # Parse output @@ -114,9 +116,19 @@ function(gtest_discover_tests_impl) else() unset(TEST_XML_OUTPUT_PARAM) endif() + + # sanitize test name for further processing downstream + set(testname "${prefix}${pretty_suite}.${pretty_test}${suffix}") + # escape \ + string(REPLACE [[\]] [[\\]] testname "${testname}") + # escape ; + string(REPLACE [[;]] [[\;]] testname "${testname}") + # escape $ + string(REPLACE [[$]] [[\$]] testname "${testname}") + # ...and add to script add_command(add_test - "${prefix}${pretty_suite}.${pretty_test}${suffix}" + "${testname}" ${_TEST_EXECUTOR} "${_TEST_EXECUTABLE}" "--gtest_filter=${suite}.${test}" @@ -126,18 +138,18 @@ function(gtest_discover_tests_impl) ) if(suite MATCHES "^DISABLED" OR test MATCHES "^DISABLED") add_command(set_tests_properties - "${prefix}${pretty_suite}.${pretty_test}${suffix}" + "${testname}" PROPERTIES DISABLED TRUE ) endif() add_command(set_tests_properties - "${prefix}${pretty_suite}.${pretty_test}${suffix}" + "${testname}" PROPERTIES WORKING_DIRECTORY "${_TEST_WORKING_DIR}" SKIP_REGULAR_EXPRESSION "\\\\[ SKIPPED \\\\]" ${properties} ) - list(APPEND tests_buffer "${prefix}${pretty_suite}.${pretty_test}${suffix}") + list(APPEND tests_buffer "${testname}") list(LENGTH tests_buffer tests_buffer_length) if(${tests_buffer_length} GREATER "250") flush_tests_buffer() |