From 8f6092fc20015ac4afd38ab8067737a5b3eb35e7 Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 24 Jul 2024 09:37:28 -0400 Subject: Tests: Move ctest --print-labels case into RunCMake.CTestCommandLine --- Tests/CMakeLists.txt | 5 ----- Tests/RunCMake/CTestCommandLine/PrintLabels-stdout.txt | 6 ++++++ Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake | 14 ++++++++++++++ 3 files changed, 20 insertions(+), 5 deletions(-) create mode 100644 Tests/RunCMake/CTestCommandLine/PrintLabels-stdout.txt diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 0ff2cdc..6e482cd 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -3078,11 +3078,6 @@ if(BUILD_TESTING) --output-on-failure -C "\${CTestTest_CONFIG}") endif() - add_test(CTestTestPrintLabels ${CMAKE_CTEST_COMMAND} --print-labels) - set_tests_properties(CTestTestPrintLabels PROPERTIES LABELS "Label1;Label2") - set_tests_properties(CTestTestPrintLabels PROPERTIES PASS_REGULAR_EXPRESSION - "All Labels:.* Label1.* Label2") - configure_file( "${CMake_SOURCE_DIR}/Tests/CTestTestLabelRegExp/test.cmake.in" "${CMake_BINARY_DIR}/Tests/CTestTestLabelRegExp/test.cmake" diff --git a/Tests/RunCMake/CTestCommandLine/PrintLabels-stdout.txt b/Tests/RunCMake/CTestCommandLine/PrintLabels-stdout.txt new file mode 100644 index 0000000..21791aa --- /dev/null +++ b/Tests/RunCMake/CTestCommandLine/PrintLabels-stdout.txt @@ -0,0 +1,6 @@ +^Test project [^ +]*/Tests/RunCMake/CTestCommandLine/PrintLabels +All Labels: + Label1 + Label2 + Label3$ diff --git a/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake index c1c26ed..b2374ca 100644 --- a/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake +++ b/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake @@ -23,6 +23,20 @@ set_tests_properties(Long_Test_Name_That_Is_Over_Fifty_Characters_In_Length PROP run_cmake_command(FailureLabels ${CMAKE_CTEST_COMMAND}) endblock() +block() + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/PrintLabels) + set(RunCMake_TEST_NO_CLEAN 1) + file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") + file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") + file(WRITE "${RunCMake_TEST_BINARY_DIR}/CTestTestfile.cmake" " +add_test(A \"${CMAKE_COMMAND}\" -E true) +set_tests_properties(A PROPERTIES LABELS \"Label1;Label2\") +add_test(B \"${CMAKE_COMMAND}\" -E true) +set_tests_properties(B PROPERTIES LABELS \"Label3\") +") + run_cmake_command(PrintLabels ${CMAKE_CTEST_COMMAND} --print-labels) +endblock() + run_cmake_command(repeat-opt-bad1 ${CMAKE_CTEST_COMMAND} --repeat until-pass ) -- cgit v0.12 From fd3019380d708873db4aad26380f4be11bb3bdda Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 24 Jul 2024 09:38:33 -0400 Subject: Tests: Removed unused LABELS on CMake's own tests In commit 44ad3f0b7f (ctest: Support multiple -L and -LE options to mean "AND", 2021-03-20, v3.21.0-rc1~424^2) we added several labels to CMake's own tests, perhaps as a way to demonstrate the change made by the commit. However, they have not been maintained or added to other tests they cover. Since commit 49e9f817de (ctest: Display test labels in failure summary, 2024-06-14) the labels are displayed next to failed test names, making them more visible. Remove these unnecessary labels. --- Tests/CMakeTests/CMakeLists.txt | 1 - Tests/QtAutogen/Tests.cmake | 2 -- Tests/RunCMake/CMakeLists.txt | 4 ---- 3 files changed, 7 deletions(-) diff --git a/Tests/CMakeTests/CMakeLists.txt b/Tests/CMakeTests/CMakeLists.txt index 16e631b..c769952 100644 --- a/Tests/CMakeTests/CMakeLists.txt +++ b/Tests/CMakeTests/CMakeLists.txt @@ -7,7 +7,6 @@ macro(AddCMakeTest TestName PreArgs) add_test(NAME CMake.${TestName} COMMAND ${CMAKE_EXECUTABLE} ${PreArgs} -P "${CMAKE_CURRENT_BINARY_DIR}/${TestName}Test.cmake" ${ARGN}) - set_tests_properties("CMake.${TestName}" PROPERTIES LABELS "CMake;command") endmacro() diff --git a/Tests/QtAutogen/Tests.cmake b/Tests/QtAutogen/Tests.cmake index d37be1c..bd0c598 100644 --- a/Tests/QtAutogen/Tests.cmake +++ b/Tests/QtAutogen/Tests.cmake @@ -47,9 +47,7 @@ ADD_AUTOGEN_TEST(UnityMocSource) if(QT_TEST_ALLOW_QT_MACROS) ADD_AUTOGEN_TEST(MocCMP0071) - set_property(TEST "Qt${QT_TEST_VERSION}Autogen.MocCMP0071" APPEND PROPERTY LABELS "policy") ADD_AUTOGEN_TEST(MocCMP0100) - set_property(TEST "Qt${QT_TEST_VERSION}Autogen.MocCMP0100" APPEND PROPERTY LABELS "policy") ADD_AUTOGEN_TEST(MocInclude) ADD_AUTOGEN_TEST(MocIncludeSymlink) ADD_AUTOGEN_TEST(MocSkipSource) diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index a595960..6f87b4e 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -35,10 +35,6 @@ macro(add_RunCMake_test test) ${TEST_ARGS} -P "${CMAKE_CURRENT_SOURCE_DIR}/${Test_Dir}/RunCMakeTest.cmake" ) - set_tests_properties("RunCMake.${test}" PROPERTIES LABELS "CMake;run") - if(${test} MATCHES ^CMP) - set_property(TEST "RunCMake.${test}" APPEND PROPERTY LABELS "policy") - endif() endmacro() function(add_RunCMake_test_group test types) -- cgit v0.12