summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2020-05-06 13:31:42 (GMT)
committerKitware Robot <kwrobot@kitware.com>2020-05-06 13:31:53 (GMT)
commitb86dfa205686a13550cac0ab89b4f27951229f4d (patch)
tree3aa472a172d7975913d497c0adff0df00052a2fe /Modules
parentf6178df27dfbf535e3eabdbe2e57649a989169aa (diff)
parent839a1010a3e2123e197e2c9e0ed8e5ad58988622 (diff)
downloadCMake-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.cmake20
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()