Files
CMake/Tests/RunCMake/add_test/RunCMakeTest.cmake
Deniz Bahadir a20987732b add_test: Allow special characters in test name (w/ policy CMP0110)
Restore the change from commit f84af8e270 (add_test: Allow special
characters in test name, 2020-05-16, v3.18.0-rc1~142^2) that had to be
reverted by commit f84af8e270 (add_test: Allow special characters in
test name, 2020-05-16, v3.18.0-rc1~142^2) for compatibility.

Add policy CMP0110 to make the change in a compatible way.
Also, support even more characters than before by generating the
test scripts using bracket arguments around the test names.

Fixes: #19391
Signed-off-by: Deniz Bahadir <dbahadir@benocs.com>
2020-08-12 10:44:07 -04:00

36 lines
815 B
CMake

include(RunCMake)
set(ENV{CTEST_OUTPUT_ON_FAILURE} 1)
function(run_case CASE_NAME)
set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/CMP0110-${CASE_NAME}-build)
run_cmake(CMP0110-${CASE_NAME})
# Run ctest on the generated CTestTestfile.cmake.
set(RunCMake_TEST_NO_CLEAN 1)
run_cmake_command(CMP0110-${CASE_NAME}-ctest ${CMAKE_CTEST_COMMAND} -C Debug)
endfunction()
set(cases
AlphaNumeric
ValidSpecialChars
OtherSpecialChars
EscapedSpecialChars
Space
LeadingAndTrailingWhitespace
Semicolon
Quote
BracketArgument
)
if(RunCMake_GENERATOR_IS_MULTI_CONFIG)
list(APPEND cases FormerInvalidSpecialCharsMC)
else()
list(APPEND cases FormerInvalidSpecialChars)
endif()
foreach(case IN LISTS cases)
run_case(WARN-${case})
run_case(OLD-${case})
run_case(NEW-${case})
endforeach()