From 75aa3ee7e724e0f6c3d2707565519041efe1443f Mon Sep 17 00:00:00 2001 From: Stefan Floeren Date: Thu, 25 Jun 2020 14:57:43 +0000 Subject: GoogleTest: Fix name generation for XML_OUTPUT_DIR The Google test framework allows to write the results into an XML file since commit e9ab39eb1d (GoogleTest: Add XML_OUTPUT_DIR parameter, 2020-03-06, v3.18.0-rc1~538^2~2). This file is passed on the command line: `--gtest_output=xml:FILE_NAME`. The module allows to specify a directory to save those files with **TEST_XML_OUTPUT_PARAM**. If the option is set, the filename will be set to `${prefix}${pretty_suite}.${pretty_test}${suffix}.xml`. The pretty names contain parameters for the tests, if value-parameterized tests are used. These parameters may not be safe to use in file names. There are two possible options: 1. sanitize the file name 2. omit the values and use the internal numbering of gtest This commit chose option 2. The testname needs to be a valid C++ identifier and should therefore be reasonable for a filename. Note that the generated names contain slashes. This will lead to subdirectories, but works on both Linux and Windows. Fixes: #20877 --- Modules/GoogleTestAddTests.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modules/GoogleTestAddTests.cmake b/Modules/GoogleTestAddTests.cmake index 4af62ed..5d098d9 100644 --- a/Modules/GoogleTestAddTests.cmake +++ b/Modules/GoogleTestAddTests.cmake @@ -112,7 +112,7 @@ function(gtest_discover_tests_impl) string(REGEX REPLACE "^DISABLED_" "" pretty_test "${pretty_test}") string(REGEX REPLACE "#.*" "" test "${test}") if(NOT "${_TEST_XML_OUTPUT_DIR}" STREQUAL "") - set(TEST_XML_OUTPUT_PARAM "--gtest_output=xml:${_TEST_XML_OUTPUT_DIR}/${prefix}${pretty_suite}.${pretty_test}${suffix}.xml") + set(TEST_XML_OUTPUT_PARAM "--gtest_output=xml:${_TEST_XML_OUTPUT_DIR}/${prefix}${suite}.${test}${suffix}.xml") else() unset(TEST_XML_OUTPUT_PARAM) endif() -- cgit v0.12