From a20987732bbd8d7e86501e42b2b5a72d60d02805 Mon Sep 17 00:00:00 2001 From: Deniz Bahadir Date: Sat, 16 May 2020 01:52:34 +0200 Subject: 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 --- Help/command/add_test.rst | 5 +- Help/manual/cmake-policies.7.rst | 3 +- Help/policy/CMP0110.rst | 24 ++++ .../release/dev/add_test-special-chars-in-name.rst | 6 + Source/cmPolicies.h | 5 +- Source/cmTestGenerator.cxx | 121 +++++++++++++++++++-- Tests/RunCMake/CMakeLists.txt | 1 + .../add_test/CMP0110-Common-AlphaNumeric.cmake | 2 + .../add_test/CMP0110-Common-BracketArgument.cmake | 2 + .../CMP0110-Common-EscapedSpecialChars.cmake | 2 + .../CMP0110-Common-FormerInvalidSpecialChars.cmake | 2 + ...P0110-Common-LeadingAndTrailingWhitespace.cmake | 2 + .../CMP0110-Common-OtherSpecialChars.cmake | 2 + Tests/RunCMake/add_test/CMP0110-Common-Quote.cmake | 2 + .../add_test/CMP0110-Common-Semicolon.cmake | 2 + Tests/RunCMake/add_test/CMP0110-Common-Space.cmake | 2 + .../CMP0110-Common-ValidSpecialChars.cmake | 2 + Tests/RunCMake/add_test/CMP0110-Common.cmake | 9 ++ .../CMP0110-NEW-AlphaNumeric-ctest-stdout.txt | 1 + .../add_test/CMP0110-NEW-AlphaNumeric.cmake | 2 + .../CMP0110-NEW-BracketArgument-ctest-stdout.txt | 1 + .../add_test/CMP0110-NEW-BracketArgument.cmake | 2 + ...MP0110-NEW-EscapedSpecialChars-ctest-stdout.txt | 1 + .../add_test/CMP0110-NEW-EscapedSpecialChars.cmake | 2 + ...-NEW-FormerInvalidSpecialChars-ctest-stdout.txt | 1 + .../CMP0110-NEW-FormerInvalidSpecialChars.cmake | 2 + .../CMP0110-NEW-FormerInvalidSpecialCharsMC.cmake | 1 + .../CMP0110-NEW-GeneratorExpressionSyntax.cmake | 2 + ...W-LeadingAndTrailingWhitespace-ctest-stdout.txt | 1 + .../CMP0110-NEW-LeadingAndTrailingWhitespace.cmake | 2 + .../CMP0110-NEW-OtherSpecialChars-ctest-stdout.txt | 1 + .../add_test/CMP0110-NEW-OtherSpecialChars.cmake | 2 + .../add_test/CMP0110-NEW-Quote-ctest-stdout.txt | 1 + Tests/RunCMake/add_test/CMP0110-NEW-Quote.cmake | 2 + .../RunCMake/add_test/CMP0110-NEW-Semicolon.cmake | 2 + Tests/RunCMake/add_test/CMP0110-NEW-Space.cmake | 2 + .../CMP0110-NEW-ValidSpecialChars-ctest-stdout.txt | 1 + .../add_test/CMP0110-NEW-ValidSpecialChars.cmake | 2 + .../CMP0110-OLD-AlphaNumeric-ctest-stdout.txt | 1 + .../add_test/CMP0110-OLD-AlphaNumeric.cmake | 2 + .../CMP0110-OLD-BracketArgument-ctest-stdout.txt | 1 + .../add_test/CMP0110-OLD-BracketArgument.cmake | 2 + ...MP0110-OLD-EscapedSpecialChars-ctest-stderr.txt | 5 + .../add_test/CMP0110-OLD-EscapedSpecialChars.cmake | 2 + ...-OLD-FormerInvalidSpecialChars-ctest-result.txt | 1 + ...-OLD-FormerInvalidSpecialChars-ctest-stderr.txt | 1 + ...-OLD-FormerInvalidSpecialChars-ctest-stdout.txt | 1 + .../CMP0110-OLD-FormerInvalidSpecialChars.cmake | 2 + ...LD-FormerInvalidSpecialCharsMC-ctest-stderr.txt | 3 + .../CMP0110-OLD-FormerInvalidSpecialCharsMC.cmake | 1 + .../CMP0110-OLD-GeneratorExpressionSyntax.cmake | 2 + ...D-LeadingAndTrailingWhitespace-ctest-stdout.txt | 1 + .../CMP0110-OLD-LeadingAndTrailingWhitespace.cmake | 2 + .../CMP0110-OLD-OtherSpecialChars-ctest-stdout.txt | 1 + .../add_test/CMP0110-OLD-OtherSpecialChars.cmake | 2 + .../add_test/CMP0110-OLD-Quote-ctest-stdout.txt | 1 + Tests/RunCMake/add_test/CMP0110-OLD-Quote.cmake | 2 + .../CMP0110-OLD-Semicolon-ctest-result.txt | 1 + .../CMP0110-OLD-Semicolon-ctest-stderr.txt | 1 + .../CMP0110-OLD-Semicolon-ctest-stdout.txt | 1 + .../RunCMake/add_test/CMP0110-OLD-Semicolon.cmake | 2 + .../add_test/CMP0110-OLD-Space-ctest-result.txt | 1 + .../add_test/CMP0110-OLD-Space-ctest-stderr.txt | 1 + .../add_test/CMP0110-OLD-Space-ctest-stdout.txt | 1 + Tests/RunCMake/add_test/CMP0110-OLD-Space.cmake | 2 + .../CMP0110-OLD-ValidSpecialChars-ctest-stdout.txt | 1 + .../add_test/CMP0110-OLD-ValidSpecialChars.cmake | 2 + Tests/RunCMake/add_test/CMP0110-Test.cmake | 3 + .../CMP0110-WARN-AlphaNumeric-ctest-stdout.txt | 1 + .../add_test/CMP0110-WARN-AlphaNumeric.cmake | 2 + .../CMP0110-WARN-BracketArgument-ctest-stdout.txt | 1 + .../CMP0110-WARN-BracketArgument-stderr.txt | 11 ++ .../add_test/CMP0110-WARN-BracketArgument.cmake | 2 + ...P0110-WARN-EscapedSpecialChars-ctest-stderr.txt | 5 + .../CMP0110-WARN-EscapedSpecialChars-stderr.txt | 11 ++ .../CMP0110-WARN-EscapedSpecialChars.cmake | 2 + ...WARN-FormerInvalidSpecialChars-ctest-result.txt | 1 + ...WARN-FormerInvalidSpecialChars-ctest-stderr.txt | 1 + ...WARN-FormerInvalidSpecialChars-ctest-stdout.txt | 1 + ...P0110-WARN-FormerInvalidSpecialChars-stderr.txt | 13 +++ .../CMP0110-WARN-FormerInvalidSpecialChars.cmake | 2 + ...RN-FormerInvalidSpecialCharsMC-ctest-stderr.txt | 3 + ...110-WARN-FormerInvalidSpecialCharsMC-stderr.txt | 13 +++ .../CMP0110-WARN-FormerInvalidSpecialCharsMC.cmake | 1 + .../CMP0110-WARN-GeneratorExpressionSyntax.cmake | 2 + ...N-LeadingAndTrailingWhitespace-ctest-stdout.txt | 1 + ...10-WARN-LeadingAndTrailingWhitespace-stderr.txt | 11 ++ ...CMP0110-WARN-LeadingAndTrailingWhitespace.cmake | 2 + ...CMP0110-WARN-OtherSpecialChars-ctest-stdout.txt | 1 + .../add_test/CMP0110-WARN-OtherSpecialChars.cmake | 2 + .../add_test/CMP0110-WARN-Quote-ctest-stdout.txt | 1 + .../add_test/CMP0110-WARN-Quote-stderr.txt | 11 ++ Tests/RunCMake/add_test/CMP0110-WARN-Quote.cmake | 2 + .../CMP0110-WARN-Semicolon-ctest-result.txt | 1 + .../CMP0110-WARN-Semicolon-ctest-stderr.txt | 1 + .../CMP0110-WARN-Semicolon-ctest-stdout.txt | 1 + .../add_test/CMP0110-WARN-Semicolon-stderr.txt | 11 ++ .../RunCMake/add_test/CMP0110-WARN-Semicolon.cmake | 2 + .../add_test/CMP0110-WARN-Space-ctest-result.txt | 1 + .../add_test/CMP0110-WARN-Space-ctest-stderr.txt | 1 + .../add_test/CMP0110-WARN-Space-ctest-stdout.txt | 1 + .../add_test/CMP0110-WARN-Space-stderr.txt | 11 ++ Tests/RunCMake/add_test/CMP0110-WARN-Space.cmake | 2 + ...CMP0110-WARN-ValidSpecialChars-ctest-stdout.txt | 1 + .../add_test/CMP0110-WARN-ValidSpecialChars.cmake | 2 + Tests/RunCMake/add_test/CMakeLists.txt | 3 + Tests/RunCMake/add_test/RunCMakeTest.cmake | 35 ++++++ 107 files changed, 437 insertions(+), 13 deletions(-) create mode 100644 Help/policy/CMP0110.rst create mode 100644 Help/release/dev/add_test-special-chars-in-name.rst create mode 100644 Tests/RunCMake/add_test/CMP0110-Common-AlphaNumeric.cmake create mode 100644 Tests/RunCMake/add_test/CMP0110-Common-BracketArgument.cmake create mode 100644 Tests/RunCMake/add_test/CMP0110-Common-EscapedSpecialChars.cmake create mode 100644 Tests/RunCMake/add_test/CMP0110-Common-FormerInvalidSpecialChars.cmake create mode 100644 Tests/RunCMake/add_test/CMP0110-Common-LeadingAndTrailingWhitespace.cmake create mode 100644 Tests/RunCMake/add_test/CMP0110-Common-OtherSpecialChars.cmake create mode 100644 Tests/RunCMake/add_test/CMP0110-Common-Quote.cmake create mode 100644 Tests/RunCMake/add_test/CMP0110-Common-Semicolon.cmake create mode 100644 Tests/RunCMake/add_test/CMP0110-Common-Space.cmake create mode 100644 Tests/RunCMake/add_test/CMP0110-Common-ValidSpecialChars.cmake create mode 100644 Tests/RunCMake/add_test/CMP0110-Common.cmake create mode 100644 Tests/RunCMake/add_test/CMP0110-NEW-AlphaNumeric-ctest-stdout.txt create mode 100644 Tests/RunCMake/add_test/CMP0110-NEW-AlphaNumeric.cmake create mode 100644 Tests/RunCMake/add_test/CMP0110-NEW-BracketArgument-ctest-stdout.txt create mode 100644 Tests/RunCMake/add_test/CMP0110-NEW-BracketArgument.cmake create mode 100644 Tests/RunCMake/add_test/CMP0110-NEW-EscapedSpecialChars-ctest-stdout.txt create mode 100644 Tests/RunCMake/add_test/CMP0110-NEW-EscapedSpecialChars.cmake create mode 100644 Tests/RunCMake/add_test/CMP0110-NEW-FormerInvalidSpecialChars-ctest-stdout.txt create mode 100644 Tests/RunCMake/add_test/CMP0110-NEW-FormerInvalidSpecialChars.cmake create mode 100644 Tests/RunCMake/add_test/CMP0110-NEW-FormerInvalidSpecialCharsMC.cmake create mode 100644 Tests/RunCMake/add_test/CMP0110-NEW-GeneratorExpressionSyntax.cmake create mode 100644 Tests/RunCMake/add_test/CMP0110-NEW-LeadingAndTrailingWhitespace-ctest-stdout.txt create mode 100644 Tests/RunCMake/add_test/CMP0110-NEW-LeadingAndTrailingWhitespace.cmake create mode 100644 Tests/RunCMake/add_test/CMP0110-NEW-OtherSpecialChars-ctest-stdout.txt create mode 100644 Tests/RunCMake/add_test/CMP0110-NEW-OtherSpecialChars.cmake create mode 100644 Tests/RunCMake/add_test/CMP0110-NEW-Quote-ctest-stdout.txt create mode 100644 Tests/RunCMake/add_test/CMP0110-NEW-Quote.cmake create mode 100644 Tests/RunCMake/add_test/CMP0110-NEW-Semicolon.cmake create mode 100644 Tests/RunCMake/add_test/CMP0110-NEW-Space.cmake create mode 100644 Tests/RunCMake/add_test/CMP0110-NEW-ValidSpecialChars-ctest-stdout.txt create mode 100644 Tests/RunCMake/add_test/CMP0110-NEW-ValidSpecialChars.cmake create mode 100644 Tests/RunCMake/add_test/CMP0110-OLD-AlphaNumeric-ctest-stdout.txt create mode 100644 Tests/RunCMake/add_test/CMP0110-OLD-AlphaNumeric.cmake create mode 100644 Tests/RunCMake/add_test/CMP0110-OLD-BracketArgument-ctest-stdout.txt create mode 100644 Tests/RunCMake/add_test/CMP0110-OLD-BracketArgument.cmake create mode 100644 Tests/RunCMake/add_test/CMP0110-OLD-EscapedSpecialChars-ctest-stderr.txt create mode 100644 Tests/RunCMake/add_test/CMP0110-OLD-EscapedSpecialChars.cmake create mode 100644 Tests/RunCMake/add_test/CMP0110-OLD-FormerInvalidSpecialChars-ctest-result.txt create mode 100644 Tests/RunCMake/add_test/CMP0110-OLD-FormerInvalidSpecialChars-ctest-stderr.txt create mode 100644 Tests/RunCMake/add_test/CMP0110-OLD-FormerInvalidSpecialChars-ctest-stdout.txt create mode 100644 Tests/RunCMake/add_test/CMP0110-OLD-FormerInvalidSpecialChars.cmake create mode 100644 Tests/RunCMake/add_test/CMP0110-OLD-FormerInvalidSpecialCharsMC-ctest-stderr.txt create mode 100644 Tests/RunCMake/add_test/CMP0110-OLD-FormerInvalidSpecialCharsMC.cmake create mode 100644 Tests/RunCMake/add_test/CMP0110-OLD-GeneratorExpressionSyntax.cmake create mode 100644 Tests/RunCMake/add_test/CMP0110-OLD-LeadingAndTrailingWhitespace-ctest-stdout.txt create mode 100644 Tests/RunCMake/add_test/CMP0110-OLD-LeadingAndTrailingWhitespace.cmake create mode 100644 Tests/RunCMake/add_test/CMP0110-OLD-OtherSpecialChars-ctest-stdout.txt create mode 100644 Tests/RunCMake/add_test/CMP0110-OLD-OtherSpecialChars.cmake create mode 100644 Tests/RunCMake/add_test/CMP0110-OLD-Quote-ctest-stdout.txt create mode 100644 Tests/RunCMake/add_test/CMP0110-OLD-Quote.cmake create mode 100644 Tests/RunCMake/add_test/CMP0110-OLD-Semicolon-ctest-result.txt create mode 100644 Tests/RunCMake/add_test/CMP0110-OLD-Semicolon-ctest-stderr.txt create mode 100644 Tests/RunCMake/add_test/CMP0110-OLD-Semicolon-ctest-stdout.txt create mode 100644 Tests/RunCMake/add_test/CMP0110-OLD-Semicolon.cmake create mode 100644 Tests/RunCMake/add_test/CMP0110-OLD-Space-ctest-result.txt create mode 100644 Tests/RunCMake/add_test/CMP0110-OLD-Space-ctest-stderr.txt create mode 100644 Tests/RunCMake/add_test/CMP0110-OLD-Space-ctest-stdout.txt create mode 100644 Tests/RunCMake/add_test/CMP0110-OLD-Space.cmake create mode 100644 Tests/RunCMake/add_test/CMP0110-OLD-ValidSpecialChars-ctest-stdout.txt create mode 100644 Tests/RunCMake/add_test/CMP0110-OLD-ValidSpecialChars.cmake create mode 100644 Tests/RunCMake/add_test/CMP0110-Test.cmake create mode 100644 Tests/RunCMake/add_test/CMP0110-WARN-AlphaNumeric-ctest-stdout.txt create mode 100644 Tests/RunCMake/add_test/CMP0110-WARN-AlphaNumeric.cmake create mode 100644 Tests/RunCMake/add_test/CMP0110-WARN-BracketArgument-ctest-stdout.txt create mode 100644 Tests/RunCMake/add_test/CMP0110-WARN-BracketArgument-stderr.txt create mode 100644 Tests/RunCMake/add_test/CMP0110-WARN-BracketArgument.cmake create mode 100644 Tests/RunCMake/add_test/CMP0110-WARN-EscapedSpecialChars-ctest-stderr.txt create mode 100644 Tests/RunCMake/add_test/CMP0110-WARN-EscapedSpecialChars-stderr.txt create mode 100644 Tests/RunCMake/add_test/CMP0110-WARN-EscapedSpecialChars.cmake create mode 100644 Tests/RunCMake/add_test/CMP0110-WARN-FormerInvalidSpecialChars-ctest-result.txt create mode 100644 Tests/RunCMake/add_test/CMP0110-WARN-FormerInvalidSpecialChars-ctest-stderr.txt create mode 100644 Tests/RunCMake/add_test/CMP0110-WARN-FormerInvalidSpecialChars-ctest-stdout.txt create mode 100644 Tests/RunCMake/add_test/CMP0110-WARN-FormerInvalidSpecialChars-stderr.txt create mode 100644 Tests/RunCMake/add_test/CMP0110-WARN-FormerInvalidSpecialChars.cmake create mode 100644 Tests/RunCMake/add_test/CMP0110-WARN-FormerInvalidSpecialCharsMC-ctest-stderr.txt create mode 100644 Tests/RunCMake/add_test/CMP0110-WARN-FormerInvalidSpecialCharsMC-stderr.txt create mode 100644 Tests/RunCMake/add_test/CMP0110-WARN-FormerInvalidSpecialCharsMC.cmake create mode 100644 Tests/RunCMake/add_test/CMP0110-WARN-GeneratorExpressionSyntax.cmake create mode 100644 Tests/RunCMake/add_test/CMP0110-WARN-LeadingAndTrailingWhitespace-ctest-stdout.txt create mode 100644 Tests/RunCMake/add_test/CMP0110-WARN-LeadingAndTrailingWhitespace-stderr.txt create mode 100644 Tests/RunCMake/add_test/CMP0110-WARN-LeadingAndTrailingWhitespace.cmake create mode 100644 Tests/RunCMake/add_test/CMP0110-WARN-OtherSpecialChars-ctest-stdout.txt create mode 100644 Tests/RunCMake/add_test/CMP0110-WARN-OtherSpecialChars.cmake create mode 100644 Tests/RunCMake/add_test/CMP0110-WARN-Quote-ctest-stdout.txt create mode 100644 Tests/RunCMake/add_test/CMP0110-WARN-Quote-stderr.txt create mode 100644 Tests/RunCMake/add_test/CMP0110-WARN-Quote.cmake create mode 100644 Tests/RunCMake/add_test/CMP0110-WARN-Semicolon-ctest-result.txt create mode 100644 Tests/RunCMake/add_test/CMP0110-WARN-Semicolon-ctest-stderr.txt create mode 100644 Tests/RunCMake/add_test/CMP0110-WARN-Semicolon-ctest-stdout.txt create mode 100644 Tests/RunCMake/add_test/CMP0110-WARN-Semicolon-stderr.txt create mode 100644 Tests/RunCMake/add_test/CMP0110-WARN-Semicolon.cmake create mode 100644 Tests/RunCMake/add_test/CMP0110-WARN-Space-ctest-result.txt create mode 100644 Tests/RunCMake/add_test/CMP0110-WARN-Space-ctest-stderr.txt create mode 100644 Tests/RunCMake/add_test/CMP0110-WARN-Space-ctest-stdout.txt create mode 100644 Tests/RunCMake/add_test/CMP0110-WARN-Space-stderr.txt create mode 100644 Tests/RunCMake/add_test/CMP0110-WARN-Space.cmake create mode 100644 Tests/RunCMake/add_test/CMP0110-WARN-ValidSpecialChars-ctest-stdout.txt create mode 100644 Tests/RunCMake/add_test/CMP0110-WARN-ValidSpecialChars.cmake create mode 100644 Tests/RunCMake/add_test/CMakeLists.txt create mode 100644 Tests/RunCMake/add_test/RunCMakeTest.cmake diff --git a/Help/command/add_test.rst b/Help/command/add_test.rst index a77ba37..2b4d082 100644 --- a/Help/command/add_test.rst +++ b/Help/command/add_test.rst @@ -10,8 +10,9 @@ Add a test to the project to be run by :manual:`ctest(1)`. [WORKING_DIRECTORY ] [COMMAND_EXPAND_LISTS]) -Adds a test called ````. The test name may not contain spaces, -quotes, or other characters special in CMake syntax. The options are: +Adds a test called ````. The test name may contain arbitrary +characters, expressed as a :ref:`Quoted Argument` or :ref:`Bracket Argument` +if necessary. See policy :policy:`CMP0110`. The options are: ``COMMAND`` Specify the test command-line. If ```` specifies an diff --git a/Help/manual/cmake-policies.7.rst b/Help/manual/cmake-policies.7.rst index 3ceb1df..2627e0c 100644 --- a/Help/manual/cmake-policies.7.rst +++ b/Help/manual/cmake-policies.7.rst @@ -51,12 +51,13 @@ The :variable:`CMAKE_MINIMUM_REQUIRED_VERSION` variable may also be used to determine whether to report an error on use of deprecated macros or functions. -Policies Introduced by CMake 3.18 +Policies Introduced by CMake 3.19 ================================= .. toctree:: :maxdepth: 1 + CMP0110: add_test() supports arbitrary characters in test names. CMP0109: find_program() requires permission to execute but not to read. Policies Introduced by CMake 3.18 diff --git a/Help/policy/CMP0110.rst b/Help/policy/CMP0110.rst new file mode 100644 index 0000000..bc198aa --- /dev/null +++ b/Help/policy/CMP0110.rst @@ -0,0 +1,24 @@ +CMP0110 +------- + +:command:`add_test` supports arbitrary characters in test names. + +:command:`add_test` can now (officially) create tests with whitespace and +other special characters in its name. Before CMake version 3.19 that was not +allowed, however, it was possible to work around this limitation by explicitly +putting escaped quotes arount the test's name in the ``add_test`` command. + +Although never officially supported several projects in the wild found and +implemented this workaround. However, the new change which officially allows +the ``add_test`` command to support whitespace and other special characters in +test names now breaks that workaround. In order for these projects to work +smoothly with newer CMake versions, this policy was introduced. + +The ``OLD`` behavior of this policy is to still prevent ``add_test`` from +handling whitespace and special characters properly (if not using the +mentioned workaround). The ``NEW`` behavior on the other hand allows names +with whitespace and special characters for tests created by ``add_test``. + +This policy was introduced in CMake version 3.19. CMake version |release| +warns when the policy is not set and uses ``OLD`` behavior. Use the +:command:`cmake_policy` command to set it to ``OLD`` or ``NEW`` explicitly. diff --git a/Help/release/dev/add_test-special-chars-in-name.rst b/Help/release/dev/add_test-special-chars-in-name.rst new file mode 100644 index 0000000..5bb9a23 --- /dev/null +++ b/Help/release/dev/add_test-special-chars-in-name.rst @@ -0,0 +1,6 @@ +add_test-special-chars-in-name +------------------------------ + +* The :command:`add_test` command now (officially) supports whitespace and + other special characters in the name for the test it creates. + See policy :policy:`CMP0110`. diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h index bba8b03..0c00ffb 100644 --- a/Source/cmPolicies.h +++ b/Source/cmPolicies.h @@ -323,7 +323,10 @@ class cmMakefile; 3, 18, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0109, \ "find_program() requires permission to execute but not to read.", 3, \ - 19, 0, cmPolicies::WARN) + 19, 0, cmPolicies::WARN) \ + SELECT(POLICY, CMP0110, \ + "add_test() supports arbitrary characters in test names.", 3, 19, 0, \ + cmPolicies::WARN) #define CM_SELECT_ID(F, A1, A2, A3, A4, A5, A6) F(A1) #define CM_FOR_EACH_POLICY_ID(POLICY) \ diff --git a/Source/cmTestGenerator.cxx b/Source/cmTestGenerator.cxx index 78b230c..da4593f 100644 --- a/Source/cmTestGenerator.cxx +++ b/Source/cmTestGenerator.cxx @@ -2,8 +2,12 @@ file Copyright.txt or https://cmake.org/licensing for details. */ #include "cmTestGenerator.h" +#include +#include // IWYU pragma: keep +#include #include #include +#include #include #include @@ -11,7 +15,10 @@ #include "cmGeneratorTarget.h" #include "cmListFileCache.h" #include "cmLocalGenerator.h" +#include "cmMakefile.h" +#include "cmMessageType.h" #include "cmOutputConverter.h" +#include "cmPolicies.h" #include "cmProperty.h" #include "cmPropertyMap.h" #include "cmRange.h" @@ -20,6 +27,52 @@ #include "cmSystemTools.h" #include "cmTest.h" +namespace /* anonymous */ +{ + +bool needToQuoteTestName(const cmMakefile& mf, const std::string& name) +{ + // Determine if policy CMP0110 is set to NEW. + switch (mf.GetPolicyStatus(cmPolicies::CMP0110)) { + case cmPolicies::WARN: + // Only warn if a forbidden character is used in the name. + if (name.find_first_of("$[] #;\t\n\"\\") != std::string::npos) { + mf.IssueMessage( + MessageType::AUTHOR_WARNING, + cmStrCat(cmPolicies::GetPolicyWarning(cmPolicies::CMP0110), + "\nThe following name given to add_test() is invalid if " + "CMP0110 is not set or set to OLD:\n `", + name, "´\n")); + } + CM_FALLTHROUGH; + case cmPolicies::OLD: + // OLD behavior is to not quote the test's name. + return false; + case cmPolicies::REQUIRED_IF_USED: + case cmPolicies::REQUIRED_ALWAYS: + case cmPolicies::NEW: + default: + // NEW behavior is to quote the test's name. + return true; + } +} + +std::size_t countMaxConsecutiveEqualSigns(const std::string& name) +{ + std::size_t max = 0; + auto startIt = find(name.begin(), name.end(), '='); + auto endIt = startIt; + for (; startIt != name.end(); startIt = find(endIt, name.end(), '=')) { + endIt = + find_if_not(startIt + 1, name.end(), [](char c) { return c == '='; }); + max = + std::max(max, static_cast(std::distance(startIt, endIt))); + } + return max; +} + +} // End: anonymous namespace + cmTestGenerator::cmTestGenerator( cmTest* test, std::vector const& configurations) : cmScriptGenerator("CTEST_CONFIGURATION_TYPE", configurations) @@ -76,8 +129,21 @@ void cmTestGenerator::GenerateScriptForConfig(std::ostream& os, // Set up generator expression evaluation context. cmGeneratorExpression ge(this->Test->GetBacktrace()); + // Determine if policy CMP0110 is set to NEW. + const bool quote_test_name = + needToQuoteTestName(*this->Test->GetMakefile(), this->Test->GetName()); + // Determine the number of equal-signs needed for quoting test name with + // [==[...]==] syntax. + const std::string equalSigns( + 1 + countMaxConsecutiveEqualSigns(this->Test->GetName()), '='); + // Start the test command. - os << indent << "add_test(" << this->Test->GetName() << " "; + if (quote_test_name) { + os << indent << "add_test([" << equalSigns << "[" << this->Test->GetName() + << "]" << equalSigns << "] "; + } else { + os << indent << "add_test(" << this->Test->GetName() << " "; + } // Evaluate command line arguments std::vector argv = @@ -127,8 +193,13 @@ void cmTestGenerator::GenerateScriptForConfig(std::ostream& os, os << ")\n"; // Output properties for the test. - os << indent << "set_tests_properties(" << this->Test->GetName() - << " PROPERTIES "; + if (quote_test_name) { + os << indent << "set_tests_properties([" << equalSigns << "[" + << this->Test->GetName() << "]" << equalSigns << "] PROPERTIES "; + } else { + os << indent << "set_tests_properties(" << this->Test->GetName() + << " PROPERTIES "; + } for (auto const& i : this->Test->GetProperties().GetList()) { os << " " << i.first << " " << cmOutputConverter::EscapeForCMake( @@ -140,7 +211,21 @@ void cmTestGenerator::GenerateScriptForConfig(std::ostream& os, void cmTestGenerator::GenerateScriptNoConfig(std::ostream& os, Indent indent) { - os << indent << "add_test(" << this->Test->GetName() << " NOT_AVAILABLE)\n"; + // Determine if policy CMP0110 is set to NEW. + const bool quote_test_name = + needToQuoteTestName(*this->Test->GetMakefile(), this->Test->GetName()); + // Determine the number of equal-signs needed for quoting test name with + // [==[...]==] syntax. + const std::string equalSigns( + 1 + countMaxConsecutiveEqualSigns(this->Test->GetName()), '='); + + if (quote_test_name) { + os << indent << "add_test([" << equalSigns << "[" << this->Test->GetName() + << "]" << equalSigns << "] NOT_AVAILABLE)\n"; + } else { + os << indent << "add_test(" << this->Test->GetName() + << " NOT_AVAILABLE)\n"; + } } bool cmTestGenerator::NeedsScriptNoConfig() const @@ -155,14 +240,27 @@ void cmTestGenerator::GenerateOldStyle(std::ostream& fout, Indent indent) { this->TestGenerated = true; + // Determine if policy CMP0110 is set to NEW. + const bool quote_test_name = + needToQuoteTestName(*this->Test->GetMakefile(), this->Test->GetName()); + // Determine the number of equal-signs needed for quoting test name with + // [==[...]==] syntax. + const std::string equalSigns( + 1 + countMaxConsecutiveEqualSigns(this->Test->GetName()), '='); + // Get the test command line to be executed. std::vector const& command = this->Test->GetCommand(); std::string exe = command[0]; cmSystemTools::ConvertToUnixSlashes(exe); - fout << indent; - fout << "add_test("; - fout << this->Test->GetName() << " \"" << exe << "\""; + if (quote_test_name) { + fout << indent << "add_test([" << equalSigns << "[" + << this->Test->GetName() << "]" << equalSigns << "] \"" << exe + << "\""; + } else { + 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 @@ -182,8 +280,13 @@ void cmTestGenerator::GenerateOldStyle(std::ostream& fout, Indent indent) fout << ")\n"; // Output properties for the test. - fout << indent << "set_tests_properties(" << this->Test->GetName() - << " PROPERTIES "; + if (quote_test_name) { + fout << indent << "set_tests_properties([" << equalSigns << "[" + << this->Test->GetName() << "]" << equalSigns << "] PROPERTIES "; + } else { + fout << indent << "set_tests_properties(" << this->Test->GetName() + << " PROPERTIES "; + } for (auto const& i : this->Test->GetProperties().GetList()) { fout << " " << i.first << " " << cmOutputConverter::EscapeForCMake(i.second); diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index e08b30a..11e8e3c 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -292,6 +292,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=$) diff --git a/Tests/RunCMake/add_test/CMP0110-Common-AlphaNumeric.cmake b/Tests/RunCMake/add_test/CMP0110-Common-AlphaNumeric.cmake new file mode 100644 index 0000000..c2ab433 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-Common-AlphaNumeric.cmake @@ -0,0 +1,2 @@ +set(TEST_NAME "abcdefghijklmnopqrstuvwxyz0123456789") +include(CMP0110-Common.cmake) diff --git a/Tests/RunCMake/add_test/CMP0110-Common-BracketArgument.cmake b/Tests/RunCMake/add_test/CMP0110-Common-BracketArgument.cmake new file mode 100644 index 0000000..77cd3eb --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-Common-BracketArgument.cmake @@ -0,0 +1,2 @@ +set(TEST_NAME "[=[InBracketBeforeSemi;InBracketAfterSemi]=]") +include(CMP0110-Common.cmake) diff --git a/Tests/RunCMake/add_test/CMP0110-Common-EscapedSpecialChars.cmake b/Tests/RunCMake/add_test/CMP0110-Common-EscapedSpecialChars.cmake new file mode 100644 index 0000000..268b622 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-Common-EscapedSpecialChars.cmake @@ -0,0 +1,2 @@ +set(TEST_NAME \(\)\ \# ) +include(CMP0110-Common.cmake) diff --git a/Tests/RunCMake/add_test/CMP0110-Common-FormerInvalidSpecialChars.cmake b/Tests/RunCMake/add_test/CMP0110-Common-FormerInvalidSpecialChars.cmake new file mode 100644 index 0000000..65bca10 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-Common-FormerInvalidSpecialChars.cmake @@ -0,0 +1,2 @@ +set(TEST_NAME "$[] #;\t\n\"\\") +include(CMP0110-Common.cmake) diff --git a/Tests/RunCMake/add_test/CMP0110-Common-LeadingAndTrailingWhitespace.cmake b/Tests/RunCMake/add_test/CMP0110-Common-LeadingAndTrailingWhitespace.cmake new file mode 100644 index 0000000..ec90e13 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-Common-LeadingAndTrailingWhitespace.cmake @@ -0,0 +1,2 @@ +set(TEST_NAME " SurroundedByWhitespace ") +include(CMP0110-Common.cmake) diff --git a/Tests/RunCMake/add_test/CMP0110-Common-OtherSpecialChars.cmake b/Tests/RunCMake/add_test/CMP0110-Common-OtherSpecialChars.cmake new file mode 100644 index 0000000..f74c3b5 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-Common-OtherSpecialChars.cmake @@ -0,0 +1,2 @@ +set(TEST_NAME "!§%&/ü:*😤~") +include(CMP0110-Common.cmake) diff --git a/Tests/RunCMake/add_test/CMP0110-Common-Quote.cmake b/Tests/RunCMake/add_test/CMP0110-Common-Quote.cmake new file mode 100644 index 0000000..a1ddb66 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-Common-Quote.cmake @@ -0,0 +1,2 @@ +set(TEST_NAME "BeforeQuote\"\"AfterEscapedQuote") +include(CMP0110-Common.cmake) diff --git a/Tests/RunCMake/add_test/CMP0110-Common-Semicolon.cmake b/Tests/RunCMake/add_test/CMP0110-Common-Semicolon.cmake new file mode 100644 index 0000000..11fd4fb --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-Common-Semicolon.cmake @@ -0,0 +1,2 @@ +set(TEST_NAME "BeforeSemi;AfterSemi") +include(CMP0110-Common.cmake) diff --git a/Tests/RunCMake/add_test/CMP0110-Common-Space.cmake b/Tests/RunCMake/add_test/CMP0110-Common-Space.cmake new file mode 100644 index 0000000..38dd28e --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-Common-Space.cmake @@ -0,0 +1,2 @@ +set(TEST_NAME "BeforeSpace AfterSpace") +include(CMP0110-Common.cmake) diff --git a/Tests/RunCMake/add_test/CMP0110-Common-ValidSpecialChars.cmake b/Tests/RunCMake/add_test/CMP0110-Common-ValidSpecialChars.cmake new file mode 100644 index 0000000..bfd082b --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-Common-ValidSpecialChars.cmake @@ -0,0 +1,2 @@ +set(TEST_NAME "abc_.+-012") +include(CMP0110-Common.cmake) diff --git a/Tests/RunCMake/add_test/CMP0110-Common.cmake b/Tests/RunCMake/add_test/CMP0110-Common.cmake new file mode 100644 index 0000000..915d171 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-Common.cmake @@ -0,0 +1,9 @@ +include(CTest) +add_test( + NAME "${TEST_NAME}" + COMMAND "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_LIST_DIR}/CMP0110-Test.cmake" +) +set_property( + TEST "${TEST_NAME}" + PROPERTY ENVIRONMENT CMAKE_add_test_ENVVAR=1 +) diff --git a/Tests/RunCMake/add_test/CMP0110-NEW-AlphaNumeric-ctest-stdout.txt b/Tests/RunCMake/add_test/CMP0110-NEW-AlphaNumeric-ctest-stdout.txt new file mode 100644 index 0000000..ed939bf --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-NEW-AlphaNumeric-ctest-stdout.txt @@ -0,0 +1 @@ +Test #[0-9]+: abcdefghijklmnopqrstuvwxyz0123456789 \.+[ ]*Passed diff --git a/Tests/RunCMake/add_test/CMP0110-NEW-AlphaNumeric.cmake b/Tests/RunCMake/add_test/CMP0110-NEW-AlphaNumeric.cmake new file mode 100644 index 0000000..7ea7042 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-NEW-AlphaNumeric.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0110 NEW) +include(CMP0110-Common-AlphaNumeric.cmake) diff --git a/Tests/RunCMake/add_test/CMP0110-NEW-BracketArgument-ctest-stdout.txt b/Tests/RunCMake/add_test/CMP0110-NEW-BracketArgument-ctest-stdout.txt new file mode 100644 index 0000000..7364d56 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-NEW-BracketArgument-ctest-stdout.txt @@ -0,0 +1 @@ +Test #[0-9]+: \[=\[InBracketBeforeSemi;InBracketAfterSemi\]=\] \.+[ ]+Passed diff --git a/Tests/RunCMake/add_test/CMP0110-NEW-BracketArgument.cmake b/Tests/RunCMake/add_test/CMP0110-NEW-BracketArgument.cmake new file mode 100644 index 0000000..baef07c --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-NEW-BracketArgument.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0110 NEW) +include(CMP0110-Common-BracketArgument.cmake) diff --git a/Tests/RunCMake/add_test/CMP0110-NEW-EscapedSpecialChars-ctest-stdout.txt b/Tests/RunCMake/add_test/CMP0110-NEW-EscapedSpecialChars-ctest-stdout.txt new file mode 100644 index 0000000..80435b6 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-NEW-EscapedSpecialChars-ctest-stdout.txt @@ -0,0 +1 @@ +Test #[0-9]+: \(\) # \.+[ ]*Passed diff --git a/Tests/RunCMake/add_test/CMP0110-NEW-EscapedSpecialChars.cmake b/Tests/RunCMake/add_test/CMP0110-NEW-EscapedSpecialChars.cmake new file mode 100644 index 0000000..c9b06bd --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-NEW-EscapedSpecialChars.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0110 NEW) +include(CMP0110-Common-EscapedSpecialChars.cmake) diff --git a/Tests/RunCMake/add_test/CMP0110-NEW-FormerInvalidSpecialChars-ctest-stdout.txt b/Tests/RunCMake/add_test/CMP0110-NEW-FormerInvalidSpecialChars-ctest-stdout.txt new file mode 100644 index 0000000..5ad8694 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-NEW-FormerInvalidSpecialChars-ctest-stdout.txt @@ -0,0 +1 @@ +Test #[0-9]+: \$\[\] .+[ ]*Passed diff --git a/Tests/RunCMake/add_test/CMP0110-NEW-FormerInvalidSpecialChars.cmake b/Tests/RunCMake/add_test/CMP0110-NEW-FormerInvalidSpecialChars.cmake new file mode 100644 index 0000000..86ddf14 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-NEW-FormerInvalidSpecialChars.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0110 NEW) +include(CMP0110-Common-FormerInvalidSpecialChars.cmake) diff --git a/Tests/RunCMake/add_test/CMP0110-NEW-FormerInvalidSpecialCharsMC.cmake b/Tests/RunCMake/add_test/CMP0110-NEW-FormerInvalidSpecialCharsMC.cmake new file mode 100644 index 0000000..f9b556a --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-NEW-FormerInvalidSpecialCharsMC.cmake @@ -0,0 +1 @@ +include(CMP0110-NEW-FormerInvalidSpecialChars.cmake NO_POLICY_SCOPE) diff --git a/Tests/RunCMake/add_test/CMP0110-NEW-GeneratorExpressionSyntax.cmake b/Tests/RunCMake/add_test/CMP0110-NEW-GeneratorExpressionSyntax.cmake new file mode 100644 index 0000000..0790536 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-NEW-GeneratorExpressionSyntax.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0110 NEW) +include(CMP0110-Common-GeneratorExpressionSyntax.cmake) diff --git a/Tests/RunCMake/add_test/CMP0110-NEW-LeadingAndTrailingWhitespace-ctest-stdout.txt b/Tests/RunCMake/add_test/CMP0110-NEW-LeadingAndTrailingWhitespace-ctest-stdout.txt new file mode 100644 index 0000000..78379cd --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-NEW-LeadingAndTrailingWhitespace-ctest-stdout.txt @@ -0,0 +1 @@ +Test #[0-9]+: [ ]SurroundedByWhitespace[ ] \.+[ ]*Passed diff --git a/Tests/RunCMake/add_test/CMP0110-NEW-LeadingAndTrailingWhitespace.cmake b/Tests/RunCMake/add_test/CMP0110-NEW-LeadingAndTrailingWhitespace.cmake new file mode 100644 index 0000000..2d636a8 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-NEW-LeadingAndTrailingWhitespace.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0110 NEW) +include(CMP0110-Common-LeadingAndTrailingWhitespace.cmake) diff --git a/Tests/RunCMake/add_test/CMP0110-NEW-OtherSpecialChars-ctest-stdout.txt b/Tests/RunCMake/add_test/CMP0110-NEW-OtherSpecialChars-ctest-stdout.txt new file mode 100644 index 0000000..8ee3ea9 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-NEW-OtherSpecialChars-ctest-stdout.txt @@ -0,0 +1 @@ +Test #[0-9]+: !§%&/ü:\*😤~ \.+[ ]*Passed diff --git a/Tests/RunCMake/add_test/CMP0110-NEW-OtherSpecialChars.cmake b/Tests/RunCMake/add_test/CMP0110-NEW-OtherSpecialChars.cmake new file mode 100644 index 0000000..d77a6ce --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-NEW-OtherSpecialChars.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0110 NEW) +include(CMP0110-Common-OtherSpecialChars.cmake) diff --git a/Tests/RunCMake/add_test/CMP0110-NEW-Quote-ctest-stdout.txt b/Tests/RunCMake/add_test/CMP0110-NEW-Quote-ctest-stdout.txt new file mode 100644 index 0000000..23dafd4 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-NEW-Quote-ctest-stdout.txt @@ -0,0 +1 @@ +Test #[0-9]+: BeforeQuote""AfterEscapedQuote \.+[ ]+Passed diff --git a/Tests/RunCMake/add_test/CMP0110-NEW-Quote.cmake b/Tests/RunCMake/add_test/CMP0110-NEW-Quote.cmake new file mode 100644 index 0000000..2e7a6e1 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-NEW-Quote.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0110 NEW) +include(CMP0110-Common-Quote.cmake) diff --git a/Tests/RunCMake/add_test/CMP0110-NEW-Semicolon.cmake b/Tests/RunCMake/add_test/CMP0110-NEW-Semicolon.cmake new file mode 100644 index 0000000..1c6e1b1 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-NEW-Semicolon.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0110 NEW) +include(CMP0110-Common-Semicolon.cmake) diff --git a/Tests/RunCMake/add_test/CMP0110-NEW-Space.cmake b/Tests/RunCMake/add_test/CMP0110-NEW-Space.cmake new file mode 100644 index 0000000..38afb85 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-NEW-Space.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0110 NEW) +include(CMP0110-Common-Space.cmake) diff --git a/Tests/RunCMake/add_test/CMP0110-NEW-ValidSpecialChars-ctest-stdout.txt b/Tests/RunCMake/add_test/CMP0110-NEW-ValidSpecialChars-ctest-stdout.txt new file mode 100644 index 0000000..ae1a0b1 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-NEW-ValidSpecialChars-ctest-stdout.txt @@ -0,0 +1 @@ +Test #[0-9]+: abc_\.\+-012 \.+[ ]*Passed diff --git a/Tests/RunCMake/add_test/CMP0110-NEW-ValidSpecialChars.cmake b/Tests/RunCMake/add_test/CMP0110-NEW-ValidSpecialChars.cmake new file mode 100644 index 0000000..62bb638 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-NEW-ValidSpecialChars.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0110 NEW) +include(CMP0110-Common-ValidSpecialChars.cmake) diff --git a/Tests/RunCMake/add_test/CMP0110-OLD-AlphaNumeric-ctest-stdout.txt b/Tests/RunCMake/add_test/CMP0110-OLD-AlphaNumeric-ctest-stdout.txt new file mode 100644 index 0000000..ed939bf --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-OLD-AlphaNumeric-ctest-stdout.txt @@ -0,0 +1 @@ +Test #[0-9]+: abcdefghijklmnopqrstuvwxyz0123456789 \.+[ ]*Passed diff --git a/Tests/RunCMake/add_test/CMP0110-OLD-AlphaNumeric.cmake b/Tests/RunCMake/add_test/CMP0110-OLD-AlphaNumeric.cmake new file mode 100644 index 0000000..bf4e82b --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-OLD-AlphaNumeric.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0110 OLD) +include(CMP0110-Common-AlphaNumeric.cmake) diff --git a/Tests/RunCMake/add_test/CMP0110-OLD-BracketArgument-ctest-stdout.txt b/Tests/RunCMake/add_test/CMP0110-OLD-BracketArgument-ctest-stdout.txt new file mode 100644 index 0000000..093f5d4 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-OLD-BracketArgument-ctest-stdout.txt @@ -0,0 +1 @@ +Test #[0-9]+: InBracketBeforeSemi;InBracketAfterSemi \.+[ ]+Passed diff --git a/Tests/RunCMake/add_test/CMP0110-OLD-BracketArgument.cmake b/Tests/RunCMake/add_test/CMP0110-OLD-BracketArgument.cmake new file mode 100644 index 0000000..05dfeb4 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-OLD-BracketArgument.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0110 OLD) +include(CMP0110-Common-BracketArgument.cmake) diff --git a/Tests/RunCMake/add_test/CMP0110-OLD-EscapedSpecialChars-ctest-stderr.txt b/Tests/RunCMake/add_test/CMP0110-OLD-EscapedSpecialChars-ctest-stderr.txt new file mode 100644 index 0000000..ec2cf2c --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-OLD-EscapedSpecialChars-ctest-stderr.txt @@ -0,0 +1,5 @@ +CMake Error at CTestTestfile.cmake:[0-9]+: + Parse error\. Function missing ending "\)"\. End of file reached\. + + +No tests were found!!! diff --git a/Tests/RunCMake/add_test/CMP0110-OLD-EscapedSpecialChars.cmake b/Tests/RunCMake/add_test/CMP0110-OLD-EscapedSpecialChars.cmake new file mode 100644 index 0000000..1f0c99f --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-OLD-EscapedSpecialChars.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0110 OLD) +include(CMP0110-Common-EscapedSpecialChars.cmake) diff --git a/Tests/RunCMake/add_test/CMP0110-OLD-FormerInvalidSpecialChars-ctest-result.txt b/Tests/RunCMake/add_test/CMP0110-OLD-FormerInvalidSpecialChars-ctest-result.txt new file mode 100644 index 0000000..45a4fb7 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-OLD-FormerInvalidSpecialChars-ctest-result.txt @@ -0,0 +1 @@ +8 diff --git a/Tests/RunCMake/add_test/CMP0110-OLD-FormerInvalidSpecialChars-ctest-stderr.txt b/Tests/RunCMake/add_test/CMP0110-OLD-FormerInvalidSpecialChars-ctest-stderr.txt new file mode 100644 index 0000000..c656b4c --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-OLD-FormerInvalidSpecialChars-ctest-stderr.txt @@ -0,0 +1 @@ +Unable to find executable: diff --git a/Tests/RunCMake/add_test/CMP0110-OLD-FormerInvalidSpecialChars-ctest-stdout.txt b/Tests/RunCMake/add_test/CMP0110-OLD-FormerInvalidSpecialChars-ctest-stdout.txt new file mode 100644 index 0000000..d3b0fac --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-OLD-FormerInvalidSpecialChars-ctest-stdout.txt @@ -0,0 +1 @@ +Test #[0-9]+: \$\[\] \.+\*\*\*Not Run diff --git a/Tests/RunCMake/add_test/CMP0110-OLD-FormerInvalidSpecialChars.cmake b/Tests/RunCMake/add_test/CMP0110-OLD-FormerInvalidSpecialChars.cmake new file mode 100644 index 0000000..883c5b6 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-OLD-FormerInvalidSpecialChars.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0110 OLD) +include(CMP0110-Common-FormerInvalidSpecialChars.cmake) diff --git a/Tests/RunCMake/add_test/CMP0110-OLD-FormerInvalidSpecialCharsMC-ctest-stderr.txt b/Tests/RunCMake/add_test/CMP0110-OLD-FormerInvalidSpecialCharsMC-ctest-stderr.txt new file mode 100644 index 0000000..06ad927 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-OLD-FormerInvalidSpecialCharsMC-ctest-stderr.txt @@ -0,0 +1,3 @@ +CMake Error at CTestTestfile.cmake:[0-9]+: + Parse error. Function missing ending "\)". Instead found unterminated + string with text "\\ NOT_AVAILABLE\) diff --git a/Tests/RunCMake/add_test/CMP0110-OLD-FormerInvalidSpecialCharsMC.cmake b/Tests/RunCMake/add_test/CMP0110-OLD-FormerInvalidSpecialCharsMC.cmake new file mode 100644 index 0000000..47e03bc --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-OLD-FormerInvalidSpecialCharsMC.cmake @@ -0,0 +1 @@ +include(CMP0110-OLD-FormerInvalidSpecialChars.cmake NO_POLICY_SCOPE) diff --git a/Tests/RunCMake/add_test/CMP0110-OLD-GeneratorExpressionSyntax.cmake b/Tests/RunCMake/add_test/CMP0110-OLD-GeneratorExpressionSyntax.cmake new file mode 100644 index 0000000..7ee6b50 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-OLD-GeneratorExpressionSyntax.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0110 OLD) +include(CMP0110-Common-GeneratorExpressionSyntax.cmake) diff --git a/Tests/RunCMake/add_test/CMP0110-OLD-LeadingAndTrailingWhitespace-ctest-stdout.txt b/Tests/RunCMake/add_test/CMP0110-OLD-LeadingAndTrailingWhitespace-ctest-stdout.txt new file mode 100644 index 0000000..870483e --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-OLD-LeadingAndTrailingWhitespace-ctest-stdout.txt @@ -0,0 +1 @@ +Test #[0-9]+: SurroundedByWhitespace \.+[ ]*Passed diff --git a/Tests/RunCMake/add_test/CMP0110-OLD-LeadingAndTrailingWhitespace.cmake b/Tests/RunCMake/add_test/CMP0110-OLD-LeadingAndTrailingWhitespace.cmake new file mode 100644 index 0000000..a20d211 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-OLD-LeadingAndTrailingWhitespace.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0110 OLD) +include(CMP0110-Common-LeadingAndTrailingWhitespace.cmake) diff --git a/Tests/RunCMake/add_test/CMP0110-OLD-OtherSpecialChars-ctest-stdout.txt b/Tests/RunCMake/add_test/CMP0110-OLD-OtherSpecialChars-ctest-stdout.txt new file mode 100644 index 0000000..8ee3ea9 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-OLD-OtherSpecialChars-ctest-stdout.txt @@ -0,0 +1 @@ +Test #[0-9]+: !§%&/ü:\*😤~ \.+[ ]*Passed diff --git a/Tests/RunCMake/add_test/CMP0110-OLD-OtherSpecialChars.cmake b/Tests/RunCMake/add_test/CMP0110-OLD-OtherSpecialChars.cmake new file mode 100644 index 0000000..0e88183 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-OLD-OtherSpecialChars.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0110 OLD) +include(CMP0110-Common-OtherSpecialChars.cmake) diff --git a/Tests/RunCMake/add_test/CMP0110-OLD-Quote-ctest-stdout.txt b/Tests/RunCMake/add_test/CMP0110-OLD-Quote-ctest-stdout.txt new file mode 100644 index 0000000..23dafd4 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-OLD-Quote-ctest-stdout.txt @@ -0,0 +1 @@ +Test #[0-9]+: BeforeQuote""AfterEscapedQuote \.+[ ]+Passed diff --git a/Tests/RunCMake/add_test/CMP0110-OLD-Quote.cmake b/Tests/RunCMake/add_test/CMP0110-OLD-Quote.cmake new file mode 100644 index 0000000..c910a7c --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-OLD-Quote.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0110 OLD) +include(CMP0110-Common-Quote.cmake) diff --git a/Tests/RunCMake/add_test/CMP0110-OLD-Semicolon-ctest-result.txt b/Tests/RunCMake/add_test/CMP0110-OLD-Semicolon-ctest-result.txt new file mode 100644 index 0000000..45a4fb7 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-OLD-Semicolon-ctest-result.txt @@ -0,0 +1 @@ +8 diff --git a/Tests/RunCMake/add_test/CMP0110-OLD-Semicolon-ctest-stderr.txt b/Tests/RunCMake/add_test/CMP0110-OLD-Semicolon-ctest-stderr.txt new file mode 100644 index 0000000..0d43768 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-OLD-Semicolon-ctest-stderr.txt @@ -0,0 +1 @@ +Unable to find executable: AfterSemi diff --git a/Tests/RunCMake/add_test/CMP0110-OLD-Semicolon-ctest-stdout.txt b/Tests/RunCMake/add_test/CMP0110-OLD-Semicolon-ctest-stdout.txt new file mode 100644 index 0000000..0a6ebed --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-OLD-Semicolon-ctest-stdout.txt @@ -0,0 +1 @@ +Test #[0-9]+: BeforeSemi \.+\*\*\*Not Run diff --git a/Tests/RunCMake/add_test/CMP0110-OLD-Semicolon.cmake b/Tests/RunCMake/add_test/CMP0110-OLD-Semicolon.cmake new file mode 100644 index 0000000..283aeed --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-OLD-Semicolon.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0110 OLD) +include(CMP0110-Common-Semicolon.cmake) diff --git a/Tests/RunCMake/add_test/CMP0110-OLD-Space-ctest-result.txt b/Tests/RunCMake/add_test/CMP0110-OLD-Space-ctest-result.txt new file mode 100644 index 0000000..45a4fb7 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-OLD-Space-ctest-result.txt @@ -0,0 +1 @@ +8 diff --git a/Tests/RunCMake/add_test/CMP0110-OLD-Space-ctest-stderr.txt b/Tests/RunCMake/add_test/CMP0110-OLD-Space-ctest-stderr.txt new file mode 100644 index 0000000..2ded1d4 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-OLD-Space-ctest-stderr.txt @@ -0,0 +1 @@ +Unable to find executable: AfterSpace diff --git a/Tests/RunCMake/add_test/CMP0110-OLD-Space-ctest-stdout.txt b/Tests/RunCMake/add_test/CMP0110-OLD-Space-ctest-stdout.txt new file mode 100644 index 0000000..059c625 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-OLD-Space-ctest-stdout.txt @@ -0,0 +1 @@ +Test #[0-9]+: BeforeSpace \.+\*\*\*Not Run diff --git a/Tests/RunCMake/add_test/CMP0110-OLD-Space.cmake b/Tests/RunCMake/add_test/CMP0110-OLD-Space.cmake new file mode 100644 index 0000000..46f7c26 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-OLD-Space.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0110 OLD) +include(CMP0110-Common-Space.cmake) diff --git a/Tests/RunCMake/add_test/CMP0110-OLD-ValidSpecialChars-ctest-stdout.txt b/Tests/RunCMake/add_test/CMP0110-OLD-ValidSpecialChars-ctest-stdout.txt new file mode 100644 index 0000000..ae1a0b1 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-OLD-ValidSpecialChars-ctest-stdout.txt @@ -0,0 +1 @@ +Test #[0-9]+: abc_\.\+-012 \.+[ ]*Passed diff --git a/Tests/RunCMake/add_test/CMP0110-OLD-ValidSpecialChars.cmake b/Tests/RunCMake/add_test/CMP0110-OLD-ValidSpecialChars.cmake new file mode 100644 index 0000000..ffc6462 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-OLD-ValidSpecialChars.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0110 OLD) +include(CMP0110-Common-ValidSpecialChars.cmake) diff --git a/Tests/RunCMake/add_test/CMP0110-Test.cmake b/Tests/RunCMake/add_test/CMP0110-Test.cmake new file mode 100644 index 0000000..3f1dfad --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-Test.cmake @@ -0,0 +1,3 @@ +if(NOT DEFINED ENV{CMAKE_add_test_ENVVAR}) + message(FATAL_ERROR "Setting property on test did not succeed!") +endif() diff --git a/Tests/RunCMake/add_test/CMP0110-WARN-AlphaNumeric-ctest-stdout.txt b/Tests/RunCMake/add_test/CMP0110-WARN-AlphaNumeric-ctest-stdout.txt new file mode 100644 index 0000000..ed939bf --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-WARN-AlphaNumeric-ctest-stdout.txt @@ -0,0 +1 @@ +Test #[0-9]+: abcdefghijklmnopqrstuvwxyz0123456789 \.+[ ]*Passed diff --git a/Tests/RunCMake/add_test/CMP0110-WARN-AlphaNumeric.cmake b/Tests/RunCMake/add_test/CMP0110-WARN-AlphaNumeric.cmake new file mode 100644 index 0000000..d2af2aa --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-WARN-AlphaNumeric.cmake @@ -0,0 +1,2 @@ +# CMP0110 not set +include(CMP0110-Common-AlphaNumeric.cmake) diff --git a/Tests/RunCMake/add_test/CMP0110-WARN-BracketArgument-ctest-stdout.txt b/Tests/RunCMake/add_test/CMP0110-WARN-BracketArgument-ctest-stdout.txt new file mode 100644 index 0000000..093f5d4 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-WARN-BracketArgument-ctest-stdout.txt @@ -0,0 +1 @@ +Test #[0-9]+: InBracketBeforeSemi;InBracketAfterSemi \.+[ ]+Passed diff --git a/Tests/RunCMake/add_test/CMP0110-WARN-BracketArgument-stderr.txt b/Tests/RunCMake/add_test/CMP0110-WARN-BracketArgument-stderr.txt new file mode 100644 index 0000000..19e60c1 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-WARN-BracketArgument-stderr.txt @@ -0,0 +1,11 @@ +CMake Warning \(dev\) in CMakeLists\.txt: + Policy CMP0110 is not set: add_test\(\) supports arbitrary characters in test + names\. Run "cmake --help-policy CMP0110" for policy details\. Use the + cmake_policy command to set the policy and suppress this warning\. + + The following name given to add_test\(\) is invalid if CMP0110 is not set or + set to OLD: + + `\[=\[InBracketBeforeSemi;InBracketAfterSemi\]=\]´ + +This warning is for project developers\. Use -Wno-dev to suppress it\. diff --git a/Tests/RunCMake/add_test/CMP0110-WARN-BracketArgument.cmake b/Tests/RunCMake/add_test/CMP0110-WARN-BracketArgument.cmake new file mode 100644 index 0000000..7887658 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-WARN-BracketArgument.cmake @@ -0,0 +1,2 @@ +# CMP0110 not set +include(CMP0110-Common-BracketArgument.cmake) diff --git a/Tests/RunCMake/add_test/CMP0110-WARN-EscapedSpecialChars-ctest-stderr.txt b/Tests/RunCMake/add_test/CMP0110-WARN-EscapedSpecialChars-ctest-stderr.txt new file mode 100644 index 0000000..ec2cf2c --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-WARN-EscapedSpecialChars-ctest-stderr.txt @@ -0,0 +1,5 @@ +CMake Error at CTestTestfile.cmake:[0-9]+: + Parse error\. Function missing ending "\)"\. End of file reached\. + + +No tests were found!!! diff --git a/Tests/RunCMake/add_test/CMP0110-WARN-EscapedSpecialChars-stderr.txt b/Tests/RunCMake/add_test/CMP0110-WARN-EscapedSpecialChars-stderr.txt new file mode 100644 index 0000000..057f2d6 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-WARN-EscapedSpecialChars-stderr.txt @@ -0,0 +1,11 @@ +CMake Warning \(dev\) in CMakeLists\.txt: + Policy CMP0110 is not set: add_test\(\) supports arbitrary characters in test + names\. Run "cmake --help-policy CMP0110" for policy details\. Use the + cmake_policy command to set the policy and suppress this warning\. + + The following name given to add_test\(\) is invalid if CMP0110 is not set or + set to OLD: + + `\(\) #´ + +This warning is for project developers\. Use -Wno-dev to suppress it\. diff --git a/Tests/RunCMake/add_test/CMP0110-WARN-EscapedSpecialChars.cmake b/Tests/RunCMake/add_test/CMP0110-WARN-EscapedSpecialChars.cmake new file mode 100644 index 0000000..ca27462 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-WARN-EscapedSpecialChars.cmake @@ -0,0 +1,2 @@ +# CMP0110 not set +include(CMP0110-Common-EscapedSpecialChars.cmake) diff --git a/Tests/RunCMake/add_test/CMP0110-WARN-FormerInvalidSpecialChars-ctest-result.txt b/Tests/RunCMake/add_test/CMP0110-WARN-FormerInvalidSpecialChars-ctest-result.txt new file mode 100644 index 0000000..45a4fb7 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-WARN-FormerInvalidSpecialChars-ctest-result.txt @@ -0,0 +1 @@ +8 diff --git a/Tests/RunCMake/add_test/CMP0110-WARN-FormerInvalidSpecialChars-ctest-stderr.txt b/Tests/RunCMake/add_test/CMP0110-WARN-FormerInvalidSpecialChars-ctest-stderr.txt new file mode 100644 index 0000000..c656b4c --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-WARN-FormerInvalidSpecialChars-ctest-stderr.txt @@ -0,0 +1 @@ +Unable to find executable: diff --git a/Tests/RunCMake/add_test/CMP0110-WARN-FormerInvalidSpecialChars-ctest-stdout.txt b/Tests/RunCMake/add_test/CMP0110-WARN-FormerInvalidSpecialChars-ctest-stdout.txt new file mode 100644 index 0000000..d3b0fac --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-WARN-FormerInvalidSpecialChars-ctest-stdout.txt @@ -0,0 +1 @@ +Test #[0-9]+: \$\[\] \.+\*\*\*Not Run diff --git a/Tests/RunCMake/add_test/CMP0110-WARN-FormerInvalidSpecialChars-stderr.txt b/Tests/RunCMake/add_test/CMP0110-WARN-FormerInvalidSpecialChars-stderr.txt new file mode 100644 index 0000000..4f20ab9 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-WARN-FormerInvalidSpecialChars-stderr.txt @@ -0,0 +1,13 @@ +CMake Warning \(dev\) in CMakeLists\.txt: + Policy CMP0110 is not set: add_test\(\) supports arbitrary characters in test + names\. Run "cmake --help-policy CMP0110" for policy details\. Use the + cmake_policy command to set the policy and suppress this warning\. + + The following name given to add_test\(\) is invalid if CMP0110 is not set or + set to OLD: + + `\$\[\] #;[ ] + + "\\´ + +This warning is for project developers\. Use -Wno-dev to suppress it. diff --git a/Tests/RunCMake/add_test/CMP0110-WARN-FormerInvalidSpecialChars.cmake b/Tests/RunCMake/add_test/CMP0110-WARN-FormerInvalidSpecialChars.cmake new file mode 100644 index 0000000..3b689c2 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-WARN-FormerInvalidSpecialChars.cmake @@ -0,0 +1,2 @@ +# CMP0110 not set +include(CMP0110-Common-FormerInvalidSpecialChars.cmake) diff --git a/Tests/RunCMake/add_test/CMP0110-WARN-FormerInvalidSpecialCharsMC-ctest-stderr.txt b/Tests/RunCMake/add_test/CMP0110-WARN-FormerInvalidSpecialCharsMC-ctest-stderr.txt new file mode 100644 index 0000000..06ad927 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-WARN-FormerInvalidSpecialCharsMC-ctest-stderr.txt @@ -0,0 +1,3 @@ +CMake Error at CTestTestfile.cmake:[0-9]+: + Parse error. Function missing ending "\)". Instead found unterminated + string with text "\\ NOT_AVAILABLE\) diff --git a/Tests/RunCMake/add_test/CMP0110-WARN-FormerInvalidSpecialCharsMC-stderr.txt b/Tests/RunCMake/add_test/CMP0110-WARN-FormerInvalidSpecialCharsMC-stderr.txt new file mode 100644 index 0000000..4f20ab9 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-WARN-FormerInvalidSpecialCharsMC-stderr.txt @@ -0,0 +1,13 @@ +CMake Warning \(dev\) in CMakeLists\.txt: + Policy CMP0110 is not set: add_test\(\) supports arbitrary characters in test + names\. Run "cmake --help-policy CMP0110" for policy details\. Use the + cmake_policy command to set the policy and suppress this warning\. + + The following name given to add_test\(\) is invalid if CMP0110 is not set or + set to OLD: + + `\$\[\] #;[ ] + + "\\´ + +This warning is for project developers\. Use -Wno-dev to suppress it. diff --git a/Tests/RunCMake/add_test/CMP0110-WARN-FormerInvalidSpecialCharsMC.cmake b/Tests/RunCMake/add_test/CMP0110-WARN-FormerInvalidSpecialCharsMC.cmake new file mode 100644 index 0000000..f77ff5c --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-WARN-FormerInvalidSpecialCharsMC.cmake @@ -0,0 +1 @@ +include(CMP0110-WARN-FormerInvalidSpecialChars.cmake NO_POLICY_SCOPE) diff --git a/Tests/RunCMake/add_test/CMP0110-WARN-GeneratorExpressionSyntax.cmake b/Tests/RunCMake/add_test/CMP0110-WARN-GeneratorExpressionSyntax.cmake new file mode 100644 index 0000000..77c9ed2 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-WARN-GeneratorExpressionSyntax.cmake @@ -0,0 +1,2 @@ +# CMP0110 not set +include(CMP0110-Common-GeneratorExpressionSyntax.cmake) diff --git a/Tests/RunCMake/add_test/CMP0110-WARN-LeadingAndTrailingWhitespace-ctest-stdout.txt b/Tests/RunCMake/add_test/CMP0110-WARN-LeadingAndTrailingWhitespace-ctest-stdout.txt new file mode 100644 index 0000000..870483e --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-WARN-LeadingAndTrailingWhitespace-ctest-stdout.txt @@ -0,0 +1 @@ +Test #[0-9]+: SurroundedByWhitespace \.+[ ]*Passed diff --git a/Tests/RunCMake/add_test/CMP0110-WARN-LeadingAndTrailingWhitespace-stderr.txt b/Tests/RunCMake/add_test/CMP0110-WARN-LeadingAndTrailingWhitespace-stderr.txt new file mode 100644 index 0000000..a392fed --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-WARN-LeadingAndTrailingWhitespace-stderr.txt @@ -0,0 +1,11 @@ +CMake Warning \(dev\) in CMakeLists\.txt: + Policy CMP0110 is not set: add_test\(\) supports arbitrary characters in test + names\. Run "cmake --help-policy CMP0110" for policy details\. Use the + cmake_policy command to set the policy and suppress this warning\. + + The following name given to add_test\(\) is invalid if CMP0110 is not set or + set to OLD: + + ` SurroundedByWhitespace ´ + +This warning is for project developers\. Use -Wno-dev to suppress it\. diff --git a/Tests/RunCMake/add_test/CMP0110-WARN-LeadingAndTrailingWhitespace.cmake b/Tests/RunCMake/add_test/CMP0110-WARN-LeadingAndTrailingWhitespace.cmake new file mode 100644 index 0000000..322bb4a --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-WARN-LeadingAndTrailingWhitespace.cmake @@ -0,0 +1,2 @@ +# CMP0110 not set +include(CMP0110-Common-LeadingAndTrailingWhitespace.cmake) diff --git a/Tests/RunCMake/add_test/CMP0110-WARN-OtherSpecialChars-ctest-stdout.txt b/Tests/RunCMake/add_test/CMP0110-WARN-OtherSpecialChars-ctest-stdout.txt new file mode 100644 index 0000000..8ee3ea9 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-WARN-OtherSpecialChars-ctest-stdout.txt @@ -0,0 +1 @@ +Test #[0-9]+: !§%&/ü:\*😤~ \.+[ ]*Passed diff --git a/Tests/RunCMake/add_test/CMP0110-WARN-OtherSpecialChars.cmake b/Tests/RunCMake/add_test/CMP0110-WARN-OtherSpecialChars.cmake new file mode 100644 index 0000000..19fa6e6 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-WARN-OtherSpecialChars.cmake @@ -0,0 +1,2 @@ +# CMP0110 not set +include(CMP0110-Common-OtherSpecialChars.cmake) diff --git a/Tests/RunCMake/add_test/CMP0110-WARN-Quote-ctest-stdout.txt b/Tests/RunCMake/add_test/CMP0110-WARN-Quote-ctest-stdout.txt new file mode 100644 index 0000000..23dafd4 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-WARN-Quote-ctest-stdout.txt @@ -0,0 +1 @@ +Test #[0-9]+: BeforeQuote""AfterEscapedQuote \.+[ ]+Passed diff --git a/Tests/RunCMake/add_test/CMP0110-WARN-Quote-stderr.txt b/Tests/RunCMake/add_test/CMP0110-WARN-Quote-stderr.txt new file mode 100644 index 0000000..39f3a92 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-WARN-Quote-stderr.txt @@ -0,0 +1,11 @@ +CMake Warning \(dev\) in CMakeLists\.txt: + Policy CMP0110 is not set: add_test\(\) supports arbitrary characters in test + names\. Run "cmake --help-policy CMP0110" for policy details\. Use the + cmake_policy command to set the policy and suppress this warning\. + + The following name given to add_test\(\) is invalid if CMP0110 is not set or + set to OLD: + + `BeforeQuote""AfterEscapedQuote´ + +This warning is for project developers\. Use -Wno-dev to suppress it\. diff --git a/Tests/RunCMake/add_test/CMP0110-WARN-Quote.cmake b/Tests/RunCMake/add_test/CMP0110-WARN-Quote.cmake new file mode 100644 index 0000000..33aaad0 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-WARN-Quote.cmake @@ -0,0 +1,2 @@ +# CMP0110 not set +include(CMP0110-Common-Quote.cmake) diff --git a/Tests/RunCMake/add_test/CMP0110-WARN-Semicolon-ctest-result.txt b/Tests/RunCMake/add_test/CMP0110-WARN-Semicolon-ctest-result.txt new file mode 100644 index 0000000..45a4fb7 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-WARN-Semicolon-ctest-result.txt @@ -0,0 +1 @@ +8 diff --git a/Tests/RunCMake/add_test/CMP0110-WARN-Semicolon-ctest-stderr.txt b/Tests/RunCMake/add_test/CMP0110-WARN-Semicolon-ctest-stderr.txt new file mode 100644 index 0000000..0d43768 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-WARN-Semicolon-ctest-stderr.txt @@ -0,0 +1 @@ +Unable to find executable: AfterSemi diff --git a/Tests/RunCMake/add_test/CMP0110-WARN-Semicolon-ctest-stdout.txt b/Tests/RunCMake/add_test/CMP0110-WARN-Semicolon-ctest-stdout.txt new file mode 100644 index 0000000..0a6ebed --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-WARN-Semicolon-ctest-stdout.txt @@ -0,0 +1 @@ +Test #[0-9]+: BeforeSemi \.+\*\*\*Not Run diff --git a/Tests/RunCMake/add_test/CMP0110-WARN-Semicolon-stderr.txt b/Tests/RunCMake/add_test/CMP0110-WARN-Semicolon-stderr.txt new file mode 100644 index 0000000..5101618 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-WARN-Semicolon-stderr.txt @@ -0,0 +1,11 @@ +CMake Warning \(dev\) in CMakeLists\.txt: + Policy CMP0110 is not set: add_test\(\) supports arbitrary characters in test + names\. Run "cmake --help-policy CMP0110" for policy details\. Use the + cmake_policy command to set the policy and suppress this warning\. + + The following name given to add_test\(\) is invalid if CMP0110 is not set or + set to OLD: + + `BeforeSemi;AfterSemi´ + +This warning is for project developers\. Use -Wno-dev to suppress it\. diff --git a/Tests/RunCMake/add_test/CMP0110-WARN-Semicolon.cmake b/Tests/RunCMake/add_test/CMP0110-WARN-Semicolon.cmake new file mode 100644 index 0000000..c5da394 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-WARN-Semicolon.cmake @@ -0,0 +1,2 @@ +# CMP0110 not set +include(CMP0110-Common-Semicolon.cmake) diff --git a/Tests/RunCMake/add_test/CMP0110-WARN-Space-ctest-result.txt b/Tests/RunCMake/add_test/CMP0110-WARN-Space-ctest-result.txt new file mode 100644 index 0000000..45a4fb7 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-WARN-Space-ctest-result.txt @@ -0,0 +1 @@ +8 diff --git a/Tests/RunCMake/add_test/CMP0110-WARN-Space-ctest-stderr.txt b/Tests/RunCMake/add_test/CMP0110-WARN-Space-ctest-stderr.txt new file mode 100644 index 0000000..2ded1d4 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-WARN-Space-ctest-stderr.txt @@ -0,0 +1 @@ +Unable to find executable: AfterSpace diff --git a/Tests/RunCMake/add_test/CMP0110-WARN-Space-ctest-stdout.txt b/Tests/RunCMake/add_test/CMP0110-WARN-Space-ctest-stdout.txt new file mode 100644 index 0000000..059c625 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-WARN-Space-ctest-stdout.txt @@ -0,0 +1 @@ +Test #[0-9]+: BeforeSpace \.+\*\*\*Not Run diff --git a/Tests/RunCMake/add_test/CMP0110-WARN-Space-stderr.txt b/Tests/RunCMake/add_test/CMP0110-WARN-Space-stderr.txt new file mode 100644 index 0000000..862eaa2 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-WARN-Space-stderr.txt @@ -0,0 +1,11 @@ +CMake Warning \(dev\) in CMakeLists\.txt: + Policy CMP0110 is not set: add_test\(\) supports arbitrary characters in test + names\. Run "cmake --help-policy CMP0110" for policy details\. Use the + cmake_policy command to set the policy and suppress this warning\. + + The following name given to add_test\(\) is invalid if CMP0110 is not set or + set to OLD: + + `BeforeSpace AfterSpace´ + +This warning is for project developers\. Use -Wno-dev to suppress it\. diff --git a/Tests/RunCMake/add_test/CMP0110-WARN-Space.cmake b/Tests/RunCMake/add_test/CMP0110-WARN-Space.cmake new file mode 100644 index 0000000..1f3234c --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-WARN-Space.cmake @@ -0,0 +1,2 @@ +# CMP0110 not set +include(CMP0110-Common-Space.cmake) diff --git a/Tests/RunCMake/add_test/CMP0110-WARN-ValidSpecialChars-ctest-stdout.txt b/Tests/RunCMake/add_test/CMP0110-WARN-ValidSpecialChars-ctest-stdout.txt new file mode 100644 index 0000000..ae1a0b1 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-WARN-ValidSpecialChars-ctest-stdout.txt @@ -0,0 +1 @@ +Test #[0-9]+: abc_\.\+-012 \.+[ ]*Passed diff --git a/Tests/RunCMake/add_test/CMP0110-WARN-ValidSpecialChars.cmake b/Tests/RunCMake/add_test/CMP0110-WARN-ValidSpecialChars.cmake new file mode 100644 index 0000000..687c899 --- /dev/null +++ b/Tests/RunCMake/add_test/CMP0110-WARN-ValidSpecialChars.cmake @@ -0,0 +1,2 @@ +# CMP0110 not set +include(CMP0110-Common-ValidSpecialChars.cmake) diff --git a/Tests/RunCMake/add_test/CMakeLists.txt b/Tests/RunCMake/add_test/CMakeLists.txt new file mode 100644 index 0000000..ee8fc29 --- /dev/null +++ b/Tests/RunCMake/add_test/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.18) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake NO_POLICY_SCOPE) diff --git a/Tests/RunCMake/add_test/RunCMakeTest.cmake b/Tests/RunCMake/add_test/RunCMakeTest.cmake new file mode 100644 index 0000000..bf6cbff --- /dev/null +++ b/Tests/RunCMake/add_test/RunCMakeTest.cmake @@ -0,0 +1,35 @@ +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() -- cgit v0.12