diff options
author | Stefan Floeren <stefan.floeren@smartronic.de> | 2020-06-25 14:57:43 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2020-06-26 13:39:51 (GMT) |
commit | 75aa3ee7e724e0f6c3d2707565519041efe1443f (patch) | |
tree | 0826eb69f39a1a2b6f8e135ec5d8a3be10dae827 /Modules | |
parent | e66fe75792a2fbe9f3ffe237c748008906ae7116 (diff) | |
download | CMake-75aa3ee7e724e0f6c3d2707565519041efe1443f.zip CMake-75aa3ee7e724e0f6c3d2707565519041efe1443f.tar.gz CMake-75aa3ee7e724e0f6c3d2707565519041efe1443f.tar.bz2 |
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
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/GoogleTestAddTests.cmake | 2 |
1 files changed, 1 insertions, 1 deletions
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() |