1
0
mirror of https://github.com/Kitware/CMake.git synced 2025-10-16 05:26:58 +08:00

add_test: Allow special characters in test name

Fixes: #19391
This commit is contained in:
Deniz Bahadir
2020-05-16 01:52:34 +02:00
parent ec1b3992db
commit f84af8e270
58 changed files with 383 additions and 15 deletions

View File

@@ -10,8 +10,9 @@ Add a test to the project to be run by :manual:`ctest(1)`.
[WORKING_DIRECTORY <dir>]
[COMMAND_EXPAND_LISTS])
Adds a test called ``<name>``. The test name may not contain spaces,
quotes, or other characters special in CMake syntax. The options are:
Adds a test called ``<name>``. The test name may contain arbitrary
characters except for double-quotes. However, if it contains spaces
or semicolons it must be enclosed in double-quotes. The options are:
``COMMAND``
Specify the test command-line. If ``<command>`` specifies an

View File

@@ -76,7 +76,7 @@ void cmTestGenerator::GenerateScriptForConfig(std::ostream& os,
cmGeneratorExpression ge(this->Test->GetBacktrace());
// Start the test command.
os << indent << "add_test(" << this->Test->GetName() << " ";
os << indent << "add_test(\"" << this->Test->GetName() << "\" ";
// Evaluate command line arguments
std::vector<std::string> argv =
@@ -126,8 +126,8 @@ void cmTestGenerator::GenerateScriptForConfig(std::ostream& os,
os << ")\n";
// Output properties for the test.
os << indent << "set_tests_properties(" << this->Test->GetName()
<< " PROPERTIES ";
os << indent << "set_tests_properties(\"" << this->Test->GetName()
<< "\" PROPERTIES ";
for (auto const& i : this->Test->GetProperties().GetList()) {
os << " " << i.first << " "
<< cmOutputConverter::EscapeForCMake(
@@ -139,7 +139,8 @@ void cmTestGenerator::GenerateScriptForConfig(std::ostream& os,
void cmTestGenerator::GenerateScriptNoConfig(std::ostream& os, Indent indent)
{
os << indent << "add_test(" << this->Test->GetName() << " NOT_AVAILABLE)\n";
os << indent << "add_test(\"" << this->Test->GetName()
<< "\" NOT_AVAILABLE)\n";
}
bool cmTestGenerator::NeedsScriptNoConfig() const
@@ -159,9 +160,8 @@ void cmTestGenerator::GenerateOldStyle(std::ostream& fout, Indent indent)
std::string exe = command[0];
cmSystemTools::ConvertToUnixSlashes(exe);
fout << indent;
fout << "add_test(";
fout << this->Test->GetName() << " \"" << exe << "\"";
fout << indent << "add_test(\"" << this->Test->GetName() << "\" \"" << exe
<< "\"";
for (std::string const& arg : cmMakeRange(command).advance(1)) {
// Just double-quote all arguments so they are re-parsed

View File

@@ -13,7 +13,7 @@ function(compare_build_to_expected)
endfunction()
function(check_for_setup_test)
file(STRINGS "${RunCMake_TEST_BINARY_DIR}/CTestTestfile.cmake" output_var REGEX "add_test\\(setup_test.*")
file(STRINGS "${RunCMake_TEST_BINARY_DIR}/CTestTestfile.cmake" output_var REGEX "add_test\\(\"setup_test\".*")
if(NOT output_var)
set(RunCMake_TEST_FAILED "Could not find the test: setup_test" PARENT_SCOPE)
endif()

View File

@@ -272,6 +272,7 @@ add_RunCMake_test(add_dependencies)
add_RunCMake_test(add_executable)
add_RunCMake_test(add_library)
add_RunCMake_test(add_subdirectory)
add_RunCMake_test(add_test)
add_RunCMake_test(build_command)
add_executable(exit_code exit_code.c)
set(execute_process_ARGS -DEXIT_CODE_EXE=$<TARGET_FILE:exit_code>)

View File

@@ -7,22 +7,22 @@ endif()
set(error_details "There is a problem with generated test file: ${testfile}")
if(testfile_contents MATCHES "add_test[(]DoesNotUseEmulator [^\n]+pseudo_emulator[^\n]+\n")
if(testfile_contents MATCHES "add_test[(][\"]DoesNotUseEmulator[\"] [^\n]+pseudo_emulator[^\n]+\n")
message(SEND_ERROR "Used emulator when it should not be used. ${error_details}")
endif()
if(NOT testfile_contents MATCHES "add_test[(]UsesEmulator [^\n]+pseudo_emulator[^\n]+\n")
if(NOT testfile_contents MATCHES "add_test[(][\"]UsesEmulator[\"] [^\n]+pseudo_emulator[^\n]+\n")
message(SEND_ERROR "Did not use emulator when it should be used. ${error_details}")
endif()
if(testfile_contents MATCHES "add_test[(]DoesNotUseEmulatorWithGenex [^\n]+pseudo_emulator[^\n]+\n")
if(testfile_contents MATCHES "add_test[(][\"]DoesNotUseEmulatorWithGenex[\"] [^\n]+pseudo_emulator[^\n]+\n")
message(SEND_ERROR "Used emulator when it should not be used. ${error_details}")
endif()
if(NOT testfile_contents MATCHES "add_test[(]UsesEmulatorWithExecTargetFromSubdirAddedWithoutGenex [^\n]+pseudo_emulator[^\n]+\n")
if(NOT testfile_contents MATCHES "add_test[(][\"]UsesEmulatorWithExecTargetFromSubdirAddedWithoutGenex[\"] [^\n]+pseudo_emulator[^\n]+\n")
message(SEND_ERROR "Did not use emulator when it should be used. ${error_details}")
endif()
if(testfile_contents MATCHES "add_test[(]DoesNotUseEmulatorWithExecTargetFromSubdirAddedWithGenex [^\n]+pseudo_emulator[^\n]+\n")
if(testfile_contents MATCHES "add_test[(][\"]DoesNotUseEmulatorWithExecTargetFromSubdirAddedWithGenex[\"] [^\n]+pseudo_emulator[^\n]+\n")
message(SEND_ERROR "Used emulator when it should not be used. ${error_details}")
endif()

View File

@@ -0,0 +1,27 @@
if (NOT DEFINED RUN_AS_SCRIPT)
cmake_minimum_required(VERSION 3.7)
project(@CASE_NAME@ NONE)
include(CTest)
# Two fallback tests for set_tests_properties.
add_test(NAME PrefixTest COMMAND "${CMAKE_COMMAND}" --version)
add_test(NAME SuffixTest COMMAND "${CMAKE_COMMAND}" --version)
add_test(
NAME @CASE_CMAKELISTS_NAME_1@
COMMAND "${CMAKE_COMMAND}" -D RUN_AS_SCRIPT=1 -P "${CMAKE_CURRENT_LIST_FILE}"
)
set_tests_properties(
@CASE_CMAKELISTS_NAME_2@
PROPERTIES
ENVIRONMENT CMAKE_add_test_ENVVAR=1
)
else()
if(NOT DEFINED ENV{CMAKE_add_test_ENVVAR})
message(FATAL_ERROR "Setting property on test did not succeed!")
endif()
endif()

View File

@@ -0,0 +1 @@
Test #[0-9]+: \[=\[BracketArgument;SuffixTest\]=\] \.+[ ]+Passed

View File

@@ -0,0 +1 @@
Test #[0-9]+: BracketArgument;SuffixTest \.+[ ]+Passed

View File

@@ -0,0 +1 @@
(-1|255)

View File

@@ -0,0 +1,2 @@
Error\(s\) when configuring the project
No tests were found!!!

View File

@@ -0,0 +1 @@
(-1|255)

View File

@@ -0,0 +1,2 @@
Error\(s\) when configuring the project
No tests were found!!!

View File

@@ -0,0 +1 @@
(-1|255)

View File

@@ -0,0 +1 @@
Unable to find executable: SuffixTest

View File

@@ -0,0 +1 @@
Test #[0-9]+: EscapedQuote \.+\*\*\*Not Run

View File

@@ -0,0 +1 @@
(-1|255)

View File

@@ -0,0 +1 @@
Unable to find executable: SuffixTest

View File

@@ -0,0 +1 @@
Test #[0-9]+: EscapedQuote \.+\*\*\*Not Run

View File

@@ -0,0 +1 @@
(-1|255)

View File

@@ -0,0 +1 @@
Unable to find executable: SuffixTest

View File

@@ -0,0 +1 @@
Test #[0-9]+: EscapedQuote \.+\*\*\*Not Run

View File

@@ -0,0 +1 @@
(-1|255)

View File

@@ -0,0 +1 @@
Unable to find executable: SuffixTest

View File

@@ -0,0 +1 @@
Test #[0-9]+: EscapedQuote \.+\*\*\*Not Run

View File

@@ -0,0 +1 @@
Test #[0-9]+: \(\) # \.+[ ]*Passed

View File

@@ -0,0 +1 @@
Test #[0-9]+: \(\) # \.+[ ]*Passed

View File

@@ -0,0 +1 @@
Test #[0-9]+: \(\) # \.+[ ]*Passed

View File

@@ -0,0 +1 @@
Test #[0-9]+: \(\) # \.+[ ]*Passed

View File

@@ -0,0 +1 @@
Test #[0-9]+: \$<BOOL:0> \.+[ ]*Passed

View File

@@ -0,0 +1 @@
Test #[0-9]+: \$<BOOL:0> \.+[ ]*Passed

View File

@@ -0,0 +1 @@
Test #[0-9]+: \$<BOOL:0> \.+[ ]*Passed

View File

@@ -0,0 +1 @@
Test #[0-9]+: \$<BOOL:0> \.+[ ]*Passed

View File

@@ -0,0 +1 @@
Test #[0-9]+: !§\$%&/ü:\*😤~ \.+[ ]*Passed

View File

@@ -0,0 +1 @@
Test #[0-9]+: !§\$%&/ü:\*😤~ \.+[ ]*Passed

View File

@@ -0,0 +1 @@
Test #[0-9]+: !§\$%&/ü:\*😤~ \.+[ ]*Passed

View File

@@ -0,0 +1 @@
Test #[0-9]+: !§\$%&/ü:\*😤~ \.+[ ]*Passed

View File

@@ -0,0 +1 @@
Test #[0-9]+: PrefixTest;SuffixTest \.+[ ]*Passed

View File

@@ -0,0 +1 @@
(-1|255)

View File

@@ -0,0 +1,2 @@
Error\(s\) when configuring the project
No tests were found!!!

View File

@@ -0,0 +1,3 @@
3/3 Test #3: PrefixTest;SuffixTest \.+\*\*\*Failed.*
CMake Error at .+/CMakeLists.txt:[0-9]+ \(message\):
[ ]*Setting property on test did not succeed!

View File

@@ -0,0 +1 @@
(-1|255)

View File

@@ -0,0 +1,2 @@
Error\(s\) when configuring the project
No tests were found!!!

View File

@@ -0,0 +1 @@
Test #[0-9]+: PrefixTest SuffixTest \.+[ ]*Passed

View File

@@ -0,0 +1 @@
(-1|255)

View File

@@ -0,0 +1,2 @@
Error\(s\) when configuring the project
No tests were found!!!

View File

@@ -0,0 +1,3 @@
3/3 Test #3: PrefixTest SuffixTest \.+\*\*\*Failed.*
CMake Error at .+/CMakeLists.txt:[0-9]+ \(message\):
[ ]*Setting property on test did not succeed!

View File

@@ -0,0 +1 @@
(-1|255)

View File

@@ -0,0 +1,2 @@
Error\(s\) when configuring the project
No tests were found!!!

View File

@@ -0,0 +1 @@
Test #[0-9]+: abc_\.\+-012 \.+[ ]*Passed

View File

@@ -0,0 +1 @@
Test #[0-9]+: abc_\.\+-012 \.+[ ]*Passed

View File

@@ -0,0 +1 @@
Test #[0-9]+: abc_\.\+-012 \.+[ ]*Passed

View File

@@ -0,0 +1 @@
Test #[0-9]+: abc_\.\+-012 \.+[ ]*Passed

View File

@@ -0,0 +1 @@
Test #[0-9]+: abcdefghijklmnopqrstuvwxyz0123456789 \.+[ ]*Passed

View File

@@ -0,0 +1 @@
Test #[0-9]+: abcdefghijklmnopqrstuvwxyz0123456789 \.+[ ]*Passed

View File

@@ -0,0 +1 @@
Test #[0-9]+: abcdefghijklmnopqrstuvwxyz0123456789 \.+[ ]*Passed

View File

@@ -0,0 +1 @@
Test #[0-9]+: abcdefghijklmnopqrstuvwxyz0123456789 \.+[ ]*Passed

View File

@@ -0,0 +1,263 @@
include(RunCTest)
set(ENV{CTEST_OUTPUT_ON_FAILURE} 1)
function(run_NameIsAlphaNumeric1_test)
set(CASE_CMAKELISTS_NAME_1 [==[ abcdefghijklmnopqrstuvwxyz0123456789 ]==])
set(CASE_CMAKELISTS_NAME_2 [==[ abcdefghijklmnopqrstuvwxyz0123456789 ]==])
run_ctest(NameIsAlphaNumeric1)
endfunction()
run_NameIsAlphaNumeric1_test()
function(run_NameIsAlphaNumeric2_test)
set(CASE_CMAKELISTS_NAME_1 [==["abcdefghijklmnopqrstuvwxyz0123456789"]==])
set(CASE_CMAKELISTS_NAME_2 [==["abcdefghijklmnopqrstuvwxyz0123456789"]==])
run_ctest(NameIsAlphaNumeric2)
endfunction()
run_NameIsAlphaNumeric2_test()
function(run_NameIsAlphaNumeric3_test)
set(CASE_CMAKELISTS_NAME_1 [==["abcdefghijklmnopqrstuvwxyz0123456789"]==])
set(CASE_CMAKELISTS_NAME_2 [==[ abcdefghijklmnopqrstuvwxyz0123456789 ]==])
run_ctest(NameIsAlphaNumeric3)
endfunction()
run_NameIsAlphaNumeric3_test()
function(run_NameIsAlphaNumeric4_test)
set(CASE_CMAKELISTS_NAME_1 [==[ abcdefghijklmnopqrstuvwxyz0123456789 ]==])
set(CASE_CMAKELISTS_NAME_2 [==["abcdefghijklmnopqrstuvwxyz0123456789"]==])
run_ctest(NameIsAlphaNumeric4)
endfunction()
run_NameIsAlphaNumeric4_test()
function(run_NameContainsValidSpecialChars1_test)
set(CASE_CMAKELISTS_NAME_1 [==[ abc_.+-012 ]==])
set(CASE_CMAKELISTS_NAME_2 [==[ abc_.+-012 ]==])
run_ctest(NameContainsValidSpecialChars1)
endfunction()
run_NameContainsValidSpecialChars1_test()
function(run_NameContainsValidSpecialChars2_test)
set(CASE_CMAKELISTS_NAME_1 [==["abc_.+-012"]==])
set(CASE_CMAKELISTS_NAME_2 [==["abc_.+-012"]==])
run_ctest(NameContainsValidSpecialChars2)
endfunction()
run_NameContainsValidSpecialChars2_test()
function(run_NameContainsValidSpecialChars3_test)
set(CASE_CMAKELISTS_NAME_1 [==["abc_.+-012"]==])
set(CASE_CMAKELISTS_NAME_2 [==[ abc_.+-012 ]==])
run_ctest(NameContainsValidSpecialChars3)
endfunction()
run_NameContainsValidSpecialChars3_test()
function(run_NameContainsValidSpecialChars4_test)
set(CASE_CMAKELISTS_NAME_1 [==[ abc_.+-012 ]==])
set(CASE_CMAKELISTS_NAME_2 [==["abc_.+-012"]==])
run_ctest(NameContainsValidSpecialChars4)
endfunction()
run_NameContainsValidSpecialChars4_test()
function(run_NameContainsOtherSpecialChars1_test)
set(CASE_CMAKELISTS_NAME_1 [==[ $%&/ü:*😤~ ]==])
set(CASE_CMAKELISTS_NAME_2 [==[ $%&/ü:*😤~ ]==])
run_ctest(NameContainsOtherSpecialChars1)
endfunction()
run_NameContainsOtherSpecialChars1_test()
function(run_NameContainsOtherSpecialChars2_test)
set(CASE_CMAKELISTS_NAME_1 [==["!§$%&/ü:*😤~"]==])
set(CASE_CMAKELISTS_NAME_2 [==["!§$%&/ü:*😤~"]==])
run_ctest(NameContainsOtherSpecialChars2)
endfunction()
run_NameContainsOtherSpecialChars2_test()
function(run_NameContainsOtherSpecialChars3_test)
set(CASE_CMAKELISTS_NAME_1 [==["!§$%&/ü:*😤~"]==])
set(CASE_CMAKELISTS_NAME_2 [==[ $%&/ü:*😤~ ]==])
run_ctest(NameContainsOtherSpecialChars3)
endfunction()
run_NameContainsOtherSpecialChars3_test()
function(run_NameContainsOtherSpecialChars4_test)
set(CASE_CMAKELISTS_NAME_1 [==[ $%&/ü:*😤~ ]==])
set(CASE_CMAKELISTS_NAME_2 [==["!§$%&/ü:*😤~"]==])
run_ctest(NameContainsOtherSpecialChars4)
endfunction()
run_NameContainsOtherSpecialChars4_test()
function(run_NameContainsEscapedSpecialChars1_test)
set(CASE_CMAKELISTS_NAME_1 [==[ \(\)\ \# ]==])
set(CASE_CMAKELISTS_NAME_2 [==[ \(\)\ \# ]==])
run_ctest(NameContainsEscapedSpecialChars1)
endfunction()
run_NameContainsEscapedSpecialChars1_test()
function(run_NameContainsEscapedSpecialChars2_test)
set(CASE_CMAKELISTS_NAME_1 [==["\(\)\ \#"]==])
set(CASE_CMAKELISTS_NAME_2 [==["\(\)\ \#"]==])
run_ctest(NameContainsEscapedSpecialChars2)
endfunction()
run_NameContainsEscapedSpecialChars2_test()
function(run_NameContainsEscapedSpecialChars3_test)
set(CASE_CMAKELISTS_NAME_1 [==["\(\)\ \#"]==])
set(CASE_CMAKELISTS_NAME_2 [==[ \(\)\ \# ]==])
run_ctest(NameContainsEscapedSpecialChars3)
endfunction()
run_NameContainsEscapedSpecialChars3_test()
function(run_NameContainsEscapedSpecialChars4_test)
set(CASE_CMAKELISTS_NAME_1 [==[ \(\)\ \# ]==])
set(CASE_CMAKELISTS_NAME_2 [==["\(\)\ \#"]==])
run_ctest(NameContainsEscapedSpecialChars4)
endfunction()
run_NameContainsEscapedSpecialChars4_test()
function(run_NameContainsGeneratorExpressionSyntax1_test)
set(CASE_CMAKELISTS_NAME_1 [==[ $<BOOL:0> ]==])
set(CASE_CMAKELISTS_NAME_2 [==[ $<BOOL:0> ]==])
run_ctest(NameContainsGeneratorExpressionSyntax1)
endfunction()
run_NameContainsGeneratorExpressionSyntax1_test()
function(run_NameContainsGeneratorExpressionSyntax2_test)
set(CASE_CMAKELISTS_NAME_1 [==["$<BOOL:0>"]==])
set(CASE_CMAKELISTS_NAME_2 [==["$<BOOL:0>"]==])
run_ctest(NameContainsGeneratorExpressionSyntax2)
endfunction()
run_NameContainsGeneratorExpressionSyntax2_test()
function(run_NameContainsGeneratorExpressionSyntax3_test)
set(CASE_CMAKELISTS_NAME_1 [==["$<BOOL:0>"]==])
set(CASE_CMAKELISTS_NAME_2 [==[ $<BOOL:0> ]==])
run_ctest(NameContainsGeneratorExpressionSyntax3)
endfunction()
run_NameContainsGeneratorExpressionSyntax3_test()
function(run_NameContainsGeneratorExpressionSyntax4_test)
set(CASE_CMAKELISTS_NAME_1 [==[ $<BOOL:0> ]==])
set(CASE_CMAKELISTS_NAME_2 [==["$<BOOL:0>"]==])
run_ctest(NameContainsGeneratorExpressionSyntax4)
endfunction()
run_NameContainsGeneratorExpressionSyntax4_test()
function(run_NameContainsSpaces1_test)
set(CASE_CMAKELISTS_NAME_1 [==["PrefixTest SuffixTest"]==])
set(CASE_CMAKELISTS_NAME_2 [==["PrefixTest SuffixTest"]==])
run_ctest(NameContainsSpaces1)
endfunction()
run_NameContainsSpaces1_test()
function(run_NameContainsSpaces2_test)
set(CASE_CMAKELISTS_NAME_1 [==[ PrefixTest SuffixTest ]==])
set(CASE_CMAKELISTS_NAME_2 [==[ PrefixTest SuffixTest ]==])
run_ctest(NameContainsSpaces2)
endfunction()
run_NameContainsSpaces2_test()
function(run_NameContainsSpaces3_test)
set(CASE_CMAKELISTS_NAME_1 [==["PrefixTest SuffixTest"]==])
set(CASE_CMAKELISTS_NAME_2 [==[ PrefixTest SuffixTest ]==])
run_ctest(NameContainsSpaces3)
endfunction()
run_NameContainsSpaces3_test()
function(run_NameContainsSpaces4_test)
set(CASE_CMAKELISTS_NAME_1 [==[ PrefixTest SuffixTest ]==])
set(CASE_CMAKELISTS_NAME_2 [==["PrefixTest SuffixTest"]==])
run_ctest(NameContainsSpaces4)
endfunction()
run_NameContainsSpaces4_test()
function(run_NameContainsSemicolon1_test)
set(CASE_CMAKELISTS_NAME_1 [==["PrefixTest;SuffixTest"]==])
set(CASE_CMAKELISTS_NAME_2 [==["PrefixTest;SuffixTest"]==])
run_ctest(NameContainsSemicolon1)
endfunction()
run_NameContainsSemicolon1_test()
function(run_NameContainsSemicolon2_test)
set(CASE_CMAKELISTS_NAME_1 [==[ PrefixTest;SuffixTest ]==])
set(CASE_CMAKELISTS_NAME_2 [==[ PrefixTest;SuffixTest ]==])
run_ctest(NameContainsSemicolon2)
endfunction()
run_NameContainsSemicolon2_test()
function(run_NameContainsSemicolon3_test)
set(CASE_CMAKELISTS_NAME_1 [==["PrefixTest;SuffixTest"]==])
set(CASE_CMAKELISTS_NAME_2 [==[ PrefixTest;SuffixTest ]==])
run_ctest(NameContainsSemicolon3)
endfunction()
run_NameContainsSemicolon3_test()
function(run_NameContainsSemicolon4_test)
set(CASE_CMAKELISTS_NAME_1 [==[ PrefixTest;SuffixTest ]==])
set(CASE_CMAKELISTS_NAME_2 [==["PrefixTest;SuffixTest"]==])
run_ctest(NameContainsSemicolon4)
endfunction()
run_NameContainsSemicolon4_test()
function(run_NameContainsEscapedQuote1_test)
set(CASE_CMAKELISTS_NAME_1 [==["EscapedQuote\"\"SuffixTest"]==])
set(CASE_CMAKELISTS_NAME_2 [==["EscapedQuote\"\"SuffixTest"]==])
run_ctest(NameContainsEscapedQuote1)
endfunction()
run_NameContainsEscapedQuote1_test()
function(run_NameContainsEscapedQuote2_test)
set(CASE_CMAKELISTS_NAME_1 [==[ EscapedQuote\"\"SuffixTest ]==])
set(CASE_CMAKELISTS_NAME_2 [==[ EscapedQuote\"\"SuffixTest ]==])
run_ctest(NameContainsEscapedQuote2)
endfunction()
run_NameContainsEscapedQuote2_test()
function(run_NameContainsEscapedQuote3_test)
set(CASE_CMAKELISTS_NAME_1 [==["EscapedQuote\"\"SuffixTest"]==])
set(CASE_CMAKELISTS_NAME_2 [==[ EscapedQuote\"\"SuffixTest ]==])
run_ctest(NameContainsEscapedQuote3)
endfunction()
run_NameContainsEscapedQuote3_test()
function(run_NameContainsEscapedQuote4_test)
set(CASE_CMAKELISTS_NAME_1 [==[ EscapedQuote\"\"SuffixTest ]==])
set(CASE_CMAKELISTS_NAME_2 [==["EscapedQuote\"\"SuffixTest"]==])
run_ctest(NameContainsEscapedQuote4)
endfunction()
run_NameContainsEscapedQuote4_test()
function(run_NameContainsBracketArgument1_test)
set(CASE_CMAKELISTS_NAME_1 [==["[=[BracketArgument;SuffixTest]=]"]==])
set(CASE_CMAKELISTS_NAME_2 [==["[=[BracketArgument;SuffixTest]=]"]==])
run_ctest(NameContainsBracketArgument1)
endfunction()
run_NameContainsBracketArgument1_test()
function(run_NameContainsBracketArgument2_test)
set(CASE_CMAKELISTS_NAME_1 [==[ [=[BracketArgument;SuffixTest]=] ]==])
set(CASE_CMAKELISTS_NAME_2 [==[ [=[BracketArgument;SuffixTest]=] ]==])
run_ctest(NameContainsBracketArgument2)
endfunction()
run_NameContainsBracketArgument2_test()
function(run_NameContainsBracketArgument3_test)
set(CASE_CMAKELISTS_NAME_1 [==["[=[BracketArgument;SuffixTest]=]"]==])
set(CASE_CMAKELISTS_NAME_2 [==[ [=[BracketArgument;SuffixTest]=] ]==])
run_ctest(NameContainsBracketArgument3)
endfunction()
run_NameContainsBracketArgument3_test()
function(run_NameContainsBracketArgument4_test)
set(CASE_CMAKELISTS_NAME_1 [==[ [=[BracketArgument;SuffixTest]=] ]==])
set(CASE_CMAKELISTS_NAME_2 [==["[=[BracketArgument;SuffixTest]=]"]==])
run_ctest(NameContainsBracketArgument4)
endfunction()
run_NameContainsBracketArgument4_test()

View File

@@ -0,0 +1,16 @@
cmake_minimum_required(VERSION 3.17)
set(CTEST_SITE "test-site")
set(CTEST_BUILD_NAME "test-build-name")
set(CTEST_SOURCE_DIRECTORY "@RunCMake_BINARY_DIR@/@CASE_NAME@")
set(CTEST_BINARY_DIRECTORY "@RunCMake_BINARY_DIR@/@CASE_NAME@-build")
set(CTEST_CMAKE_GENERATOR "@RunCMake_GENERATOR@")
set(CTEST_CMAKE_GENERATOR_PLATFORM "@RunCMake_GENERATOR_PLATFORM@")
set(CTEST_CMAKE_GENERATOR_TOOLSET "@RunCMake_GENERATOR_TOOLSET@")
set(CTEST_BUILD_CONFIGURATION "$ENV{CMAKE_CONFIG_TYPE}")
set(ctest_test_args "@CASE_CTEST_TEST_ARGS@")
ctest_start(Experimental)
ctest_configure()
#ctest_build()
ctest_test(${ctest_test_args})