diff options
45 files changed, 376 insertions, 271 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 642f904..857ef73 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -219,6 +219,16 @@ test:fedora34-makefiles-nospace: CMAKE_CI_BUILD_NAME: fedora34_makefiles_nospace CMAKE_CI_JOB_NIGHTLY: "true" +test:cuda9.2-nvidia: + extends: + - .cuda9.2_nvidia + - .cmake_test_linux_release + - .linux_builder_tags_cuda + - .run_dependent + - .needs_centos6_x86_64 + variables: + CMAKE_CI_JOB_NIGHTLY: "true" + test:cuda10.2-nvidia: extends: - .cuda10.2_nvidia diff --git a/.gitlab/ci/configure_common.cmake b/.gitlab/ci/configure_common.cmake index 436e582..a711f3b 100644 --- a/.gitlab/ci/configure_common.cmake +++ b/.gitlab/ci/configure_common.cmake @@ -6,8 +6,8 @@ set(CMAKE_SKIP_INSTALL_ALL_DEPENDENCY "ON" CACHE BOOL "") set(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/install" CACHE PATH "") set(CMake_TEST_INSTALL "OFF" CACHE BOOL "") -if (NOT "$ENV{CMAKE_BUILD_TYPE}" STREQUAL "") - set(CMAKE_BUILD_TYPE "$ENV{CMAKE_BUILD_TYPE}" CACHE STRING "") +if (NOT "$ENV{CMAKE_CI_BUILD_TYPE}" STREQUAL "") + set(CMAKE_BUILD_TYPE "$ENV{CMAKE_CI_BUILD_TYPE}" CACHE STRING "") endif () if (NOT configure_no_sccache) diff --git a/.gitlab/ci/configure_cuda9.2_nvidia.cmake b/.gitlab/ci/configure_cuda9.2_nvidia.cmake new file mode 100644 index 0000000..519699b --- /dev/null +++ b/.gitlab/ci/configure_cuda9.2_nvidia.cmake @@ -0,0 +1,3 @@ +set(CMake_TEST_CUDA "NVIDIA" CACHE STRING "") + +include("${CMAKE_CURRENT_LIST_DIR}/configure_external_test.cmake") diff --git a/.gitlab/ci/docker/cuda9.2/Dockerfile b/.gitlab/ci/docker/cuda9.2/Dockerfile new file mode 100644 index 0000000..7eae886 --- /dev/null +++ b/.gitlab/ci/docker/cuda9.2/Dockerfile @@ -0,0 +1,5 @@ +FROM nvidia/cuda:9.2-devel-ubuntu16.04 +MAINTAINER Brad King <brad.king@kitware.com> + +COPY install_deps.sh /root/install_deps.sh +RUN sh /root/install_deps.sh diff --git a/.gitlab/ci/docker/cuda9.2/install_deps.sh b/.gitlab/ci/docker/cuda9.2/install_deps.sh new file mode 100755 index 0000000..146f982 --- /dev/null +++ b/.gitlab/ci/docker/cuda9.2/install_deps.sh @@ -0,0 +1,14 @@ +#!/bin/sh + +set -e + +apt-get update + +# Install development tools. +apt-get install -y \ + g++ \ + clang-3.8 \ + curl \ + git + +apt-get clean diff --git a/.gitlab/ci/env_cuda9.2_nvidia.sh b/.gitlab/ci/env_cuda9.2_nvidia.sh new file mode 100644 index 0000000..16bfba4 --- /dev/null +++ b/.gitlab/ci/env_cuda9.2_nvidia.sh @@ -0,0 +1,4 @@ +export CC=/usr/bin/clang-3.8 +export CXX=/usr/bin/clang++-3.8 +export CUDAHOSTCXX=/usr/bin/g++-5 +export CUDACXX=/usr/local/cuda/bin/nvcc diff --git a/.gitlab/ci/gitlab_ci.cmake b/.gitlab/ci/gitlab_ci.cmake index f166215..697162c 100644 --- a/.gitlab/ci/gitlab_ci.cmake +++ b/.gitlab/ci/gitlab_ci.cmake @@ -26,8 +26,8 @@ set(CTEST_SITE "gitlab-ci") set(ctest_model "Experimental") # Default to Release builds. -if (NOT "$ENV{CMAKE_BUILD_TYPE}" STREQUAL "") - set(CTEST_BUILD_CONFIGURATION "$ENV{CMAKE_BUILD_TYPE}") +if (NOT "$ENV{CMAKE_CI_BUILD_TYPE}" STREQUAL "") + set(CTEST_BUILD_CONFIGURATION "$ENV{CMAKE_CI_BUILD_TYPE}") endif () if (NOT CTEST_BUILD_CONFIGURATION) set(CTEST_BUILD_CONFIGURATION "Release") diff --git a/.gitlab/os-linux.yml b/.gitlab/os-linux.yml index 8ce795e..65a4282 100644 --- a/.gitlab/os-linux.yml +++ b/.gitlab/os-linux.yml @@ -90,7 +90,7 @@ variables: CMAKE_CONFIGURATION: fedora34_clang_analyzer - CMAKE_BUILD_TYPE: Debug + CMAKE_CI_BUILD_TYPE: Debug CTEST_NO_WARNINGS_ALLOWED: 1 CMake_SKIP_INSTALL: 1 @@ -168,7 +168,7 @@ .fedora_memcheck: variables: - CMAKE_BUILD_TYPE: RelWithDebInfo + CMAKE_CI_BUILD_TYPE: RelWithDebInfo .fedora_asan_addon: extends: .fedora_memcheck @@ -208,6 +208,21 @@ ### CUDA builds +.cuda9.2: + image: "kitware/cmake:ci-cuda9.2-x86_64-2021-07-01" + + variables: + GIT_CLONE_PATH: "$CI_BUILDS_DIR/cmake ci" + CMAKE_ARCH: x86_64 + CTEST_LABELS: "CUDA" + +.cuda9.2_nvidia: + extends: .cuda9.2 + + variables: + CMAKE_CONFIGURATION: cuda9.2_nvidia + CMAKE_GENERATOR: "Ninja Multi-Config" + .cuda10.2: image: "kitware/cmake:ci-cuda10.2-x86_64-2021-06-16" diff --git a/.gitlab/os-windows.yml b/.gitlab/os-windows.yml index fb72ff1..90ff0a8 100644 --- a/.gitlab/os-windows.yml +++ b/.gitlab/os-windows.yml @@ -28,7 +28,7 @@ # Debug and RelWithDebinfo build types use the `/Zi` which results in # uncacheable compiations. # https://github.com/mozilla/sccache/issues/242 - CMAKE_BUILD_TYPE: Release + CMAKE_CI_BUILD_TYPE: Release CTEST_NO_WARNINGS_ALLOWED: 1 .windows_vs2019_x64_ninja: diff --git a/Help/command/ctest_test.rst b/Help/command/ctest_test.rst index 03ec1a4..ede0c97 100644 --- a/Help/command/ctest_test.rst +++ b/Help/command/ctest_test.rst @@ -186,29 +186,33 @@ Check the `CDash test measurement documentation <https://github.com/Kitware/CDash/blob/master/docs/test_measurements.md>`_ for more information on the types of test measurements that CDash recognizes. +Starting in version 3.22, CTest can parse custom measurements from tags named +``<CTestMeasurement>`` or ``<CTestMeasurementFile>``. The older names +``<DartMeasurement>`` and ``<DartMeasurementFile>`` are still supported. + The following example demonstrates how to output a variety of custom test measurements. .. code-block:: c++ std::cout << - "<DartMeasurement type=\"numeric/double\" name=\"score\">28.3</DartMeasurement>" + "<CTestMeasurement type=\"numeric/double\" name=\"score\">28.3</CTestMeasurement>" << std::endl; std::cout << - "<DartMeasurement type=\"text/string\" name=\"color\">red</DartMeasurement>" + "<CTestMeasurement type=\"text/string\" name=\"color\">red</CTestMeasurement>" << std::endl; std::cout << - "<DartMeasurement type=\"text/link\" name=\"CMake URL\">https://cmake.org</DartMeasurement>" + "<CTestMeasurement type=\"text/link\" name=\"CMake URL\">https://cmake.org</CTestMeasurement>" << std::endl; std::cout << - "<DartMeasurement type=\"text/preformatted\" name=\"Console Output\">" << + "<CTestMeasurement type=\"text/preformatted\" name=\"Console Output\">" << "line 1.\n" << " \033[31;1m line 2. Bold red, and indented!\033[0;0ml\n" << "line 3. Not bold or indented...\n" << - "</DartMeasurement>" << std::endl; + "</CTestMeasurement>" << std::endl; Image Measurements """""""""""""""""" @@ -218,16 +222,16 @@ The following example demonstrates how to upload test images to CDash. .. code-block:: c++ std::cout << - "<DartMeasurementFile type=\"image/jpg\" name=\"TestImage\">" << - "/dir/to/test_img.jpg</DartMeasurementFile>" << std::endl; + "<CTestMeasurementFile type=\"image/jpg\" name=\"TestImage\">" << + "/dir/to/test_img.jpg</CTestMeasurementFile>" << std::endl; std::cout << - "<DartMeasurementFile type=\"image/gif\" name=\"ValidImage\">" << - "/dir/to/valid_img.gif</DartMeasurementFile>" << std::endl; + "<CTestMeasurementFile type=\"image/gif\" name=\"ValidImage\">" << + "/dir/to/valid_img.gif</CTestMeasurementFile>" << std::endl; std::cout << - "<DartMeasurementFile type=\"image/png\" name=\"AlgoResult\"> << - "/dir/to/img.png</DartMeasurementFile>" + "<CTestMeasurementFile type=\"image/png\" name=\"AlgoResult\"> << + "/dir/to/img.png</CTestMeasurementFile>" << std::endl; Images will be displayed together in an interactive comparison mode on CDash @@ -253,8 +257,10 @@ The following example demonstrates how to upload non-image files to CDash. .. code-block:: c++ std::cout << - "<DartMeasurementFile type=\"file\" name=\"MyTestInputData\">" << - "/dir/to/data.csv</DartMeasurementFile>" << std::endl; + "<CTestMeasurementFile type=\"file\" name=\"TestInputData1\">" << + "/dir/to/data1.csv</CTestMeasurementFile>\n" << + "<CTestMeasurementFile type=\"file\" name=\"TestInputData2\">" << + "/dir/to/data2.csv</CTestMeasurementFile>" << std::endl; If the name of the file to upload is known at configure time, you can use the :prop_test:`ATTACHED_FILES` or :prop_test:`ATTACHED_FILES_ON_FAIL` test diff --git a/Help/command/file.rst b/Help/command/file.rst index b6ed416..943bf7c 100644 --- a/Help/command/file.rst +++ b/Help/command/file.rst @@ -189,8 +189,10 @@ the ``<format>`` and ``UTC`` options. Recursively get the list of libraries depended on by the given files. Please note that this sub-command is not intended to be used in project mode. -Instead, use it in an :command:`install(CODE)` or :command:`install(SCRIPT)` -block. For example: +It is intended for use at install time, either from code generated by the +:command:`install(RUNTIME_DEPENDENCY_SET)` command, or from code provided by +the project via :command:`install(CODE)` or :command:`install(SCRIPT)`. +For example: .. code-block:: cmake @@ -703,10 +705,14 @@ Move a file or directory within a filesystem from ``<oldname>`` to The options are: ``RESULT <result>`` + .. versionadded:: 3.21 + Set ``<result>`` variable to ``0`` on success or an error message otherwise. If ``RESULT`` is not specified and the operation fails, an error is emitted. ``NO_REPLACE`` + .. versionadded:: 3.21 + If the ``<newname>`` path already exists, do not replace it. If ``RESULT <result>`` is used, the result variable will be set to ``NO_REPLACE``. Otherwise, an error is emitted. diff --git a/Help/command/install.rst b/Help/command/install.rst index acfaa48..c6af489 100644 --- a/Help/command/install.rst +++ b/Help/command/install.rst @@ -346,10 +346,10 @@ top level: This option causes all runtime dependencies of installed executable, shared library, and module targets to be added to the specified runtime dependency - set. This set can then be installed later on with an + set. This set can then be installed with an `install(RUNTIME_DEPENDENCY_SET)`_ command. - This argument and the ``RUNTIME_DEPENDENCIES`` argument are mutually + This keyword and the ``RUNTIME_DEPENDENCIES`` keyword are mutually exclusive. ``RUNTIME_DEPENDENCIES`` @@ -361,13 +361,28 @@ top level: arguments are used to determine the properties (``DESTINATION``, ``COMPONENT``, etc.) of the installation of these dependencies. - ``RUNTIME_DEPENDENCIES`` is semantically equivalent to calling - ``install(TARGETS ... RUNTIME_DEPENDENCY_SET)`` and then - `install(RUNTIME_DEPENDENCY_SET)`_ with a randomly generated name. It accepts - all of the same options as `install(RUNTIME_DEPENDENCY_SET)`_. + ``RUNTIME_DEPENDENCIES`` is semantically equivalent to the following pair + of calls: - This argument and the ``RUNTIME_DEPENDENCY_SET`` argument are mutually - exclusive. + .. code-block:: cmake + + install(TARGETS ... RUNTIME_DEPENDENCY_SET <set-name>) + install(RUNTIME_DEPENDENCY_SET <set-name> args...) + + where ``<set-name>`` will be a randomly generated set name. + The ``args...`` may include any of the following keywords supported by + the `install(RUNTIME_DEPENDENCY_SET)`_ command: + + * ``DIRECTORIES`` + * ``PRE_INCLUDE_REGEXES`` + * ``PRE_EXCLUDE_REGEXES`` + * ``POST_INCLUDE_REGEXES`` + * ``POST_EXCLUDE_REGEXES`` + * ``POST_INCLUDE_FILES`` + * ``POST_EXCLUDE_FILES`` + + The ``RUNTIME_DEPENDENCIES`` and ``RUNTIME_DEPENDENCY_SET`` keywords are + mutually exclusive. One or more groups of properties may be specified in a single call to the ``TARGETS`` form of this command. A target may be installed more than @@ -446,14 +461,10 @@ not installed. In the case of :prop_tgt:`FRAMEWORK` libraries, :prop_tgt:`MACOSX_BUNDLE` executables, and :prop_tgt:`BUNDLE` CFBundles, the entire directory is installed. -``IMPORTED_RUNTIME_ARTIFACTS`` accepts the following additional arguments: - -``RUNTIME_DEPENDENCY_SET`` - - This option causes all runtime dependencies of installed executable, shared - library, and module targets to be added to the specified runtime dependency - set. This set can then be installed later on with an - `install(RUNTIME_DEPENDENCY_SET)`_ command. +The ``RUNTIME_DEPENDENCY_SET`` option causes the runtime artifacts of the +imported executable, shared library, and module library ``targets`` to be +added to the ``<set-name>`` runtime dependency set. This set can then be +installed with an `install(RUNTIME_DEPENDENCY_SET)`_ command. Installing Files ^^^^^^^^^^^^^^^^ @@ -693,7 +704,8 @@ Custom Installation Logic .. code-block:: cmake install([[SCRIPT <file>] [CODE <code>]] - [COMPONENT <component>] [EXCLUDE_FROM_ALL] [ALL_COMPONENTS] [...]) + [ALL_COMPONENTS | COMPONENT <component>] + [EXCLUDE_FROM_ALL] [...]) The ``SCRIPT`` form will invoke the given CMake script files during installation. If the script file name is a relative path it will be @@ -708,11 +720,11 @@ example, the code will print a message during installation. -The option ``ALL_COMPONENTS`` - .. versionadded:: 3.21 - - Run the custom installation script code for every component of a - component-specific installation. +.. versionadded:: 3.21 + When the ``ALL_COMPONENTS`` option is given, the custom installation + script code will be executed for every component of a component-specific + installation. This option is mutually exclusive with the ``COMPONENT`` + option. .. versionadded:: 3.14 ``<file>`` or ``<code>`` may use "generator expressions" with the syntax @@ -836,50 +848,46 @@ Installing Runtime Dependencies [PRE_EXCLUDE_REGEXES regexes...] [POST_INCLUDE_REGEXES regexes...] [POST_EXCLUDE_REGEXES regexes...] + [POST_INCLUDE_FILES files...] + [POST_EXCLUDE_FILES files...] [DIRECTORIES directories...] ) -Installs a runtime dependency set created by one or more +Installs a runtime dependency set previously created by one or more `install(TARGETS)`_ or `install(IMPORTED_RUNTIME_ARTIFACTS)`_ commands. The dependencies of targets belonging to a runtime dependency set are installed in the ``RUNTIME`` destination and component on DLL platforms, and in the ``LIBRARY`` destination and component on non-DLL platforms. macOS frameworks -are installed in the ``FRAMEWORK`` destination and component. The generated -install script calls :command:`file(GET_RUNTIME_DEPENDENCIES)` on the -build-tree files to calculate the runtime dependencies, with the build-tree -executable files as the ``EXECUTABLES`` argument, the build-tree shared -libraries as the ``LIBRARIES`` argument, and the build-tree modules as the -``MODULES`` argument. If one of the executables is a :prop_tgt:`MACOSX_BUNDLE` -executable on a macOS platform, that executable is passed as the -``BUNDLE_EXECUTABLE`` argument. If ``RUNTIME_DEPENDENCY_SET`` is specified on -a macOS platform, at most one :prop_tgt:`MACOSX_BUNDLE` executable may be in -the runtime dependency set. The :prop_tgt:`MACOSX_BUNDLE` property has no -effect on non-macOS platforms. Targets built within the build tree will never -be installed as runtime dependencies, nor will their own dependencies, unless -the targets themselves are installed with `install(TARGETS)`_. - -This argument accepts the following sub-arguments: - -``DIRECTORIES <directories>`` - List of directories to be passed as the ``DIRECTORIES`` argument of - :command:`file(GET_RUNTIME_DEPENDENCIES)`. This argument supports - :manual:`generator expressions <cmake-generator-expressions(7)>`. If a - ``DIRECTORIES`` argument evaluates to an empty string, it is not passed to - :command:`file(GET_RUNTIME_DEPENDENCIES)`. - -``PRE_INCLUDE_REGEXES <regexes>``, ``PRE_EXCLUDE_REGEXES <regexes>``, ``POST_INCLUDE_REGEXES <regexes>``, ``POST_EXCLUDE_REGEXES <regexes>`` - List of regular expressions to be passed as their respective arguments to - :command:`file(GET_RUNTIME_DEPENDENCIES)`. These arguments support - :manual:`generator expressions <cmake-generator-expressions(7)>`. If an - argument evaluates to an empty string, it is not passed to - :command:`file(GET_RUNTIME_DEPENDENCIES)`. - -``POST_INCLUDE_FILES <files>``, ``POST_EXCLUDE_FILES <files>`` - List of files to be passed as their respective arguments to - :command:`file(GET_RUNTIME_DEPENDENCIES)`. These arguments support - :manual:`generator expressions <cmake-generator-expressions(7)>`. If an - argument evaluates to an empty string, it is not passed to - :command:`file(GET_RUNTIME_DEPENDENCIES)`. +are installed in the ``FRAMEWORK`` destination and component. +Targets built within the build tree will never be installed as runtime +dependencies, nor will their own dependencies, unless the targets themselves +are installed with `install(TARGETS)`_. + +The generated install script calls :command:`file(GET_RUNTIME_DEPENDENCIES)` +on the build-tree files to calculate the runtime dependencies. The build-tree +executable files are passed as the ``EXECUTABLES`` argument, the build-tree +shared libraries as the ``LIBRARIES`` argument, and the build-tree modules as +the ``MODULES`` argument. On macOS, if one of the executables is a +:prop_tgt:`MACOSX_BUNDLE`, that executable is passed as the +``BUNDLE_EXECUTABLE`` argument. At most one such bundle executable may be in +the runtime dependency set on macOS. The :prop_tgt:`MACOSX_BUNDLE` property +has no effect on other platforms. Note that +:command:`file(GET_RUNTIME_DEPENDENCIES)` only supports collecting the runtime +dependencies for Windows, Linux and macOS platforms, so +``install(RUNTIME_DEPENDENCY_SET)`` has the same limitation. + +The following sub-arguments are forwarded through as the corresponding +arguments to :command:`file(GET_RUNTIME_DEPENDENCIES)` (for those that provide +a non-empty list of directories, regular expressions or files). They all +support :manual:`generator expressions <cmake-generator-expressions(7)>`. + +* ``DIRECTORIES <directories>`` +* ``PRE_INCLUDE_REGEXES <regexes>`` +* ``PRE_EXCLUDE_REGEXES <regexes>`` +* ``POST_INCLUDE_REGEXES <regexes>`` +* ``POST_EXCLUDE_REGEXES <regexes>`` +* ``POST_INCLUDE_FILES <files>`` +* ``POST_EXCLUDE_FILES <files>`` Generated Installation Script ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/Modules/FindCUDAToolkit.cmake b/Modules/FindCUDAToolkit.cmake index 8801cb1..4c535b9 100644 --- a/Modules/FindCUDAToolkit.cmake +++ b/Modules/FindCUDAToolkit.cmake @@ -844,9 +844,9 @@ if(CUDAToolkit_FOUND) mark_as_advanced(CUDA_${lib_name}_LIBRARY) if (NOT TARGET CUDA::${lib_name} AND CUDA_${lib_name}_LIBRARY) - add_library(CUDA::${lib_name} IMPORTED INTERFACE) + add_library(CUDA::${lib_name} UNKNOWN IMPORTED) target_include_directories(CUDA::${lib_name} SYSTEM INTERFACE "${CUDAToolkit_INCLUDE_DIRS}") - target_link_libraries(CUDA::${lib_name} INTERFACE "${CUDA_${lib_name}_LIBRARY}") + set_property(TARGET CUDA::${lib_name} PROPERTY IMPORTED_LOCATION "${CUDA_${lib_name}_LIBRARY}") foreach(dep ${arg_DEPS}) if(TARGET CUDA::${dep}) target_link_libraries(CUDA::${lib_name} INTERFACE CUDA::${dep}) diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index 6446b04..d8ba784 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -960,6 +960,7 @@ set(CTEST_SRCS cmCTest.cxx CTest/cmCTestSubmitHandler.cxx CTest/cmCTestTestCommand.cxx CTest/cmCTestTestHandler.cxx + CTest/cmCTestTestMeasurementXMLParser.cxx CTest/cmCTestUpdateCommand.cxx CTest/cmCTestUpdateHandler.cxx CTest/cmCTestUploadCommand.cxx diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 23a44e7..b4bfbcc 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,7 +1,7 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 21) -set(CMake_VERSION_PATCH 20210702) +set(CMake_VERSION_PATCH 20210706) #set(CMake_VERSION_RC 0) set(CMake_VERSION_IS_DIRTY 0) diff --git a/Source/CTest/cmCTestMemCheckHandler.cxx b/Source/CTest/cmCTestMemCheckHandler.cxx index 125d003..6bb8e79 100644 --- a/Source/CTest/cmCTestMemCheckHandler.cxx +++ b/Source/CTest/cmCTestMemCheckHandler.cxx @@ -305,7 +305,7 @@ int cmCTestMemCheckHandler::GetDefectCount() const return this->DefectCount; } -void cmCTestMemCheckHandler::GenerateDartOutput(cmXMLWriter& xml) +void cmCTestMemCheckHandler::GenerateCTestXML(cmXMLWriter& xml) { if (!this->CTest->GetProduceXML()) { return; diff --git a/Source/CTest/cmCTestMemCheckHandler.h b/Source/CTest/cmCTestMemCheckHandler.h index b200c43..a63a24d 100644 --- a/Source/CTest/cmCTestMemCheckHandler.h +++ b/Source/CTest/cmCTestMemCheckHandler.h @@ -119,9 +119,9 @@ private: bool InitializeMemoryChecking(); /** - * Generate the Dart compatible output + * Generate CTest DynamicAnalysis.xml files */ - void GenerateDartOutput(cmXMLWriter& xml) override; + void GenerateCTestXML(cmXMLWriter& xml) override; std::vector<std::string> CustomPreMemCheck; std::vector<std::string> CustomPostMemCheck; diff --git a/Source/CTest/cmCTestRunTest.cxx b/Source/CTest/cmCTestRunTest.cxx index 50072c5..4e9b0f0 100644 --- a/Source/CTest/cmCTestRunTest.cxx +++ b/Source/CTest/cmCTestRunTest.cxx @@ -262,7 +262,7 @@ bool cmCTestRunTest::EndTest(size_t completed, size_t total, bool started) *this->TestHandler->LogFile << "Test time = " << buf << std::endl; } - this->DartProcessing(); + this->ParseOutputForMeasurements(); // if this is doing MemCheck then all the output needs to be put into // Output since that is what is parsed by cmCTestMemCheckHandler @@ -698,18 +698,22 @@ void cmCTestRunTest::ComputeArguments() } } -void cmCTestRunTest::DartProcessing() +void cmCTestRunTest::ParseOutputForMeasurements() { if (!this->ProcessOutput.empty() && - this->ProcessOutput.find("<DartMeasurement") != std::string::npos) { - if (this->TestHandler->DartStuff.find(this->ProcessOutput)) { - this->TestResult.DartString = this->TestHandler->DartStuff.match(1); + (this->ProcessOutput.find("<DartMeasurement") != std::string::npos || + this->ProcessOutput.find("<CTestMeasurement") != std::string::npos)) { + if (this->TestHandler->AllTestMeasurementsRegex.find( + this->ProcessOutput)) { + this->TestResult.TestMeasurementsOutput = + this->TestHandler->AllTestMeasurementsRegex.match(1); // keep searching and replacing until none are left - while (this->TestHandler->DartStuff1.find(this->ProcessOutput)) { + while (this->TestHandler->SingleTestMeasurementRegex.find( + this->ProcessOutput)) { // replace the exact match for the string cmSystemTools::ReplaceString( - this->ProcessOutput, this->TestHandler->DartStuff1.match(1).c_str(), - ""); + this->ProcessOutput, + this->TestHandler->SingleTestMeasurementRegex.match(1).c_str(), ""); } } } diff --git a/Source/CTest/cmCTestRunTest.h b/Source/CTest/cmCTestRunTest.h index 863ac1b..a4981c3 100644 --- a/Source/CTest/cmCTestRunTest.h +++ b/Source/CTest/cmCTestRunTest.h @@ -109,7 +109,7 @@ public: private: bool NeedsToRepeat(); - void DartProcessing(); + void ParseOutputForMeasurements(); void ExeNotFound(std::string exe); bool ForkProcess(cmDuration testTimeOut, bool explicitTimeout, std::vector<std::string>* environment, diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx index aeaf696..72b86c1 100644 --- a/Source/CTest/cmCTestTestHandler.cxx +++ b/Source/CTest/cmCTestTestHandler.cxx @@ -32,6 +32,7 @@ #include "cmCTest.h" #include "cmCTestMultiProcessHandler.h" #include "cmCTestResourceGroupsLexerHelper.h" +#include "cmCTestTestMeasurementXMLParser.h" #include "cmDuration.h" #include "cmExecutionStatus.h" #include "cmGeneratedFileStream.h" @@ -303,16 +304,23 @@ cmCTestTestHandler::cmCTestTestHandler() // Support for JUnit XML output. this->JUnitXMLFileName = ""; - // regex to detect <DartMeasurement>...</DartMeasurement> - this->DartStuff.compile("(<DartMeasurement.*/DartMeasurement[a-zA-Z]*>)"); - // regex to detect each individual <DartMeasurement>...</DartMeasurement> - this->DartStuff1.compile( - "(<DartMeasurement[^<]*</DartMeasurement[a-zA-Z]*>)"); + // Regular expressions to scan test output for custom measurements. - // regex to detect <CTestDetails>...</CTestDetails> + // Capture the whole section of test output from the first opening + // <(CTest|Dart)Measurement*> tag to the last </(CTest|Dart)Measurement*> + // closing tag. + this->AllTestMeasurementsRegex.compile( + "(<(CTest|Dart)Measurement.*/(CTest|Dart)Measurement[a-zA-Z]*>)"); + + // Capture a single <(CTest|Dart)Measurement*> XML element. + this->SingleTestMeasurementRegex.compile( + "(<(CTest|Dart)Measurement[^<]*</(CTest|Dart)Measurement[a-zA-Z]*>)"); + + // Capture content from <CTestDetails>...</CTestDetails> this->CustomCompletionStatusRegex.compile( "<CTestDetails>(.*)</CTestDetails>"); - // regex to detect <CTestLabel>...</CTestLabel> + + // Capture content from <CTestLabel>...</CTestLabel> this->CustomLabelRegex.compile("<CTestLabel>(.*)</CTestLabel>"); } @@ -694,7 +702,7 @@ bool cmCTestTestHandler::GenerateXML() return false; } cmXMLWriter xml(xmlfile); - this->GenerateDartOutput(xml); + this->GenerateCTestXML(xml); } return true; @@ -1402,7 +1410,7 @@ void cmCTestTestHandler::GenerateTestCommand( { } -void cmCTestTestHandler::GenerateDartOutput(cmXMLWriter& xml) +void cmCTestTestHandler::GenerateCTestXML(cmXMLWriter& xml) { if (!this->CTest->GetProduceXML()) { return; @@ -1438,7 +1446,7 @@ void cmCTestTestHandler::GenerateDartOutput(cmXMLWriter& xml) xml.Element("Value", result.ReturnValue); xml.EndElement(); // NamedMeasurement } - this->GenerateRegressionImages(xml, result.DartString); + this->RecordCustomTestMeasurements(xml, result.TestMeasurementsOutput); xml.StartElement("NamedMeasurement"); xml.Attribute("type", "numeric/double"); xml.Attribute("name", "Execution Time"); @@ -1978,124 +1986,48 @@ void cmCTestTestHandler::ExpandTestsToRunInformationForRerunFailed() } } -// Just for convenience -#define SPACE_REGEX "[ \t\r\n]" -void cmCTestTestHandler::GenerateRegressionImages(cmXMLWriter& xml, - const std::string& dart) -{ - cmsys::RegularExpression twoattributes( - "<DartMeasurement" SPACE_REGEX - "*(name|type|encoding|compression)=\"([^\"]*)\"" SPACE_REGEX - "*(name|type|encoding|compression)=\"([^\"]*)\"" SPACE_REGEX - "*>([^<]*)</DartMeasurement>"); - cmsys::RegularExpression threeattributes( - "<DartMeasurement" SPACE_REGEX - "*(name|type|encoding|compression)=\"([^\"]*)\"" SPACE_REGEX - "*(name|type|encoding|compression)=\"([^\"]*)\"" SPACE_REGEX - "*(name|type|encoding|compression)=\"([^\"]*)\"" SPACE_REGEX - "*>([^<]*)</DartMeasurement>"); - cmsys::RegularExpression fourattributes( - "<DartMeasurement" SPACE_REGEX - "*(name|type|encoding|compression)=\"([^\"]*)\"" SPACE_REGEX - "*(name|type|encoding|compression)=\"([^\"]*)\"" SPACE_REGEX - "*(name|type|encoding|compression)=\"([^\"]*)\"" SPACE_REGEX - "*(name|type|encoding|compression)=\"([^\"]*)\"" SPACE_REGEX - "*>([^<]*)</DartMeasurement>"); - cmsys::RegularExpression cdatastart( - "<DartMeasurement" SPACE_REGEX - "*(name|type|encoding|compression)=\"([^\"]*)\"" SPACE_REGEX - "*(name|type|encoding|compression)=\"([^\"]*)\"" SPACE_REGEX - "*>" SPACE_REGEX "*<!\\[CDATA\\["); - cmsys::RegularExpression cdataend("]]>" SPACE_REGEX "*</DartMeasurement>"); - cmsys::RegularExpression measurementfile( - "<DartMeasurementFile" SPACE_REGEX - "*(name|type|encoding|compression)=\"([^\"]*)\"" SPACE_REGEX - "*(name|type|encoding|compression)=\"([^\"]*)\"" SPACE_REGEX - "*>([^<]*)</DartMeasurementFile>"); - - bool done = false; - std::string cxml = dart; - while (!done) { - if (twoattributes.find(cxml)) { - xml.StartElement("NamedMeasurement"); - xml.Attribute(twoattributes.match(1).c_str(), twoattributes.match(2)); - xml.Attribute(twoattributes.match(3).c_str(), twoattributes.match(4)); - xml.Element("Value", twoattributes.match(5)); - xml.EndElement(); - cxml.erase(twoattributes.start(), - twoattributes.end() - twoattributes.start()); - } else if (threeattributes.find(cxml)) { - xml.StartElement("NamedMeasurement"); - xml.Attribute(threeattributes.match(1).c_str(), - threeattributes.match(2)); - xml.Attribute(threeattributes.match(3).c_str(), - threeattributes.match(4)); - xml.Attribute(threeattributes.match(5).c_str(), - threeattributes.match(6)); - xml.Element("Value", twoattributes.match(7)); - xml.EndElement(); - cxml.erase(threeattributes.start(), - threeattributes.end() - threeattributes.start()); - } else if (fourattributes.find(cxml)) { +void cmCTestTestHandler::RecordCustomTestMeasurements(cmXMLWriter& xml, + std::string content) +{ + while (this->SingleTestMeasurementRegex.find(content)) { + // Extract regex match from content and parse it as an XML element. + auto measurement_str = this->SingleTestMeasurementRegex.match(1); + auto parser = cmCTestTestMeasurementXMLParser(); + parser.Parse(measurement_str.c_str()); + + if (parser.ElementName == "CTestMeasurement" || + parser.ElementName == "DartMeasurement") { xml.StartElement("NamedMeasurement"); - xml.Attribute(fourattributes.match(1).c_str(), fourattributes.match(2)); - xml.Attribute(fourattributes.match(3).c_str(), fourattributes.match(4)); - xml.Attribute(fourattributes.match(5).c_str(), fourattributes.match(6)); - xml.Attribute(fourattributes.match(7).c_str(), fourattributes.match(8)); - xml.Element("Value", twoattributes.match(9)); + xml.Attribute("type", parser.MeasurementType); + xml.Attribute("name", parser.MeasurementName); + xml.Element("Value", parser.CharacterData); xml.EndElement(); - cxml.erase(fourattributes.start(), - fourattributes.end() - fourattributes.start()); - } else if (cdatastart.find(cxml) && cdataend.find(cxml)) { - xml.StartElement("NamedMeasurement"); - xml.Attribute(cdatastart.match(1).c_str(), cdatastart.match(2)); - xml.Attribute(cdatastart.match(3).c_str(), cdatastart.match(4)); - xml.StartElement("Value"); - xml.CData( - cxml.substr(cdatastart.end(), cdataend.start() - cdatastart.end())); - xml.EndElement(); // Value - xml.EndElement(); // NamedMeasurement - cxml.erase(cdatastart.start(), cdataend.end() - cdatastart.start()); - } else if (measurementfile.find(cxml)) { - const std::string& filename = - cmCTest::CleanString(measurementfile.match(5)); - if (cmSystemTools::FileExists(filename)) { + } else if (parser.ElementName == "CTestMeasurementFile" || + parser.ElementName == "DartMeasurementFile") { + const std::string& filename = cmCTest::CleanString(parser.CharacterData); + if (!cmSystemTools::FileExists(filename)) { + xml.StartElement("NamedMeasurement"); + xml.Attribute("name", parser.MeasurementName); + xml.Attribute("text", "text/string"); + xml.Element("Value", "File " + filename + " not found"); + xml.EndElement(); + cmCTestOptionalLog( + this->CTest, HANDLER_OUTPUT, + "File \"" << filename << "\" not found." << std::endl, this->Quiet); + } else { long len = cmSystemTools::FileLength(filename); - std::string k1 = measurementfile.match(1); - std::string v1 = measurementfile.match(2); - std::string k2 = measurementfile.match(3); - std::string v2 = measurementfile.match(4); if (len == 0) { - if (cmSystemTools::LowerCase(k1) == "type") { - v1 = "text/string"; - } - if (cmSystemTools::LowerCase(k2) == "type") { - v2 = "text/string"; - } - xml.StartElement("NamedMeasurement"); - xml.Attribute(k1.c_str(), v1); - xml.Attribute(k2.c_str(), v2); + xml.Attribute("name", parser.MeasurementName); + xml.Attribute("type", "text/string"); xml.Attribute("encoding", "none"); xml.Element("Value", "Image " + filename + " is empty"); xml.EndElement(); } else { - std::string type; - std::string name; - if (cmSystemTools::LowerCase(k1) == "type") { - type = v1; - } else if (cmSystemTools::LowerCase(k2) == "type") { - type = v2; - } - if (cmSystemTools::LowerCase(k1) == "name") { - name = v1; - } else if (cmSystemTools::LowerCase(k2) == "name") { - name = v2; - } - if (type == "file") { + if (parser.MeasurementType == "file") { // Treat this measurement like an "ATTACHED_FILE" when the type // is explicitly "file" (not an image). - this->AttachFile(xml, filename, name); + this->AttachFile(xml, filename, parser.MeasurementName); } else { cmsys::ifstream ifs(filename.c_str(), std::ios::in @@ -2112,10 +2044,8 @@ void cmCTestTestHandler::GenerateRegressionImages(cmXMLWriter& xml, encoded_buffer.get(), 1); xml.StartElement("NamedMeasurement"); - xml.Attribute(measurementfile.match(1).c_str(), - measurementfile.match(2)); - xml.Attribute(measurementfile.match(3).c_str(), - measurementfile.match(4)); + xml.Attribute("name", parser.MeasurementName); + xml.Attribute("type", parser.MeasurementType); xml.Attribute("encoding", "base64"); std::ostringstream ostr; for (size_t cc = 0; cc < rlen; cc++) { @@ -2128,25 +2058,11 @@ void cmCTestTestHandler::GenerateRegressionImages(cmXMLWriter& xml, xml.EndElement(); // NamedMeasurement } } - } else { - int idx = 4; - if (measurementfile.match(1) == "name") { - idx = 2; - } - xml.StartElement("NamedMeasurement"); - xml.Attribute("name", measurementfile.match(idx)); - xml.Attribute("text", "text/string"); - xml.Element("Value", "File " + filename + " not found"); - xml.EndElement(); - cmCTestOptionalLog( - this->CTest, HANDLER_OUTPUT, - "File \"" << filename << "\" not found." << std::endl, this->Quiet); } - cxml.erase(measurementfile.start(), - measurementfile.end() - measurementfile.start()); - } else { - done = true; } + + // Remove this element from content. + cmSystemTools::ReplaceString(content, measurement_str.c_str(), ""); } } diff --git a/Source/CTest/cmCTestTestHandler.h b/Source/CTest/cmCTestTestHandler.h index cc19984..1b42647 100644 --- a/Source/CTest/cmCTestTestHandler.h +++ b/Source/CTest/cmCTestTestHandler.h @@ -177,7 +177,7 @@ public: std::string CompletionStatus; std::string CustomCompletionStatus; std::string Output; - std::string DartString; + std::string TestMeasurementsOutput; int TestCount; cmCTestTestProperties* Properties; }; @@ -276,9 +276,9 @@ public: private: /** - * Generate the Dart compatible output + * Write test results in CTest's Test.xml format */ - virtual void GenerateDartOutput(cmXMLWriter& xml); + virtual void GenerateCTestXML(cmXMLWriter& xml); /** * Write test results in JUnit XML format @@ -348,8 +348,7 @@ private: cmCTestResourceSpec ResourceSpec; std::string ResourceSpecFile; - void GenerateRegressionImages(cmXMLWriter& xml, const std::string& dart); - cmsys::RegularExpression DartStuff1; + void RecordCustomTestMeasurements(cmXMLWriter& xml, std::string content); void CheckLabelFilter(cmCTestTestProperties& it); void CheckLabelFilterExclude(cmCTestTestProperties& it); void CheckLabelFilterInclude(cmCTestTestProperties& it); @@ -358,7 +357,8 @@ private: bool UseUnion; ListOfTests TestList; size_t TotalNumberOfTests; - cmsys::RegularExpression DartStuff; + cmsys::RegularExpression AllTestMeasurementsRegex; + cmsys::RegularExpression SingleTestMeasurementRegex; cmsys::RegularExpression CustomCompletionStatusRegex; cmsys::RegularExpression CustomLabelRegex; diff --git a/Source/CTest/cmCTestTestMeasurementXMLParser.cxx b/Source/CTest/cmCTestTestMeasurementXMLParser.cxx new file mode 100644 index 0000000..636be24 --- /dev/null +++ b/Source/CTest/cmCTestTestMeasurementXMLParser.cxx @@ -0,0 +1,26 @@ +/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying + file Copyright.txt or https://cmake.org/licensing for details. */ + +#include "cmCTestTestMeasurementXMLParser.h" + +#include <cstring> + +void cmCTestTestMeasurementXMLParser::StartElement(const std::string& name, + const char** attributes) +{ + this->CharacterData.clear(); + this->ElementName = name; + for (const char** attr = attributes; *attr; attr += 2) { + if (strcmp(attr[0], "name") == 0) { + this->MeasurementName = attr[1]; + } else if (strcmp(attr[0], "type") == 0) { + this->MeasurementType = attr[1]; + } + } +} + +void cmCTestTestMeasurementXMLParser::CharacterDataHandler(const char* data, + int length) +{ + this->CharacterData.append(data, length); +} diff --git a/Source/CTest/cmCTestTestMeasurementXMLParser.h b/Source/CTest/cmCTestTestMeasurementXMLParser.h new file mode 100644 index 0000000..b2c3eb3 --- /dev/null +++ b/Source/CTest/cmCTestTestMeasurementXMLParser.h @@ -0,0 +1,21 @@ +/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying + file Copyright.txt or https://cmake.org/licensing for details. */ + +#include <string> + +#include "cmXMLParser.h" + +class cmCTestTestMeasurementXMLParser : public cmXMLParser +{ +public: + cmCTestTestMeasurementXMLParser() {} + std::string CharacterData; + std::string ElementName; + std::string MeasurementName; + std::string MeasurementType; + +protected: + void StartElement(const std::string& name, const char** atts) override; + void EndElement(const std::string& /*name*/) override {} + void CharacterDataHandler(const char* data, int length) override; +}; diff --git a/Source/cmQtAutoGenInitializer.cxx b/Source/cmQtAutoGenInitializer.cxx index 2894201..4dd78e5 100644 --- a/Source/cmQtAutoGenInitializer.cxx +++ b/Source/cmQtAutoGenInitializer.cxx @@ -1111,11 +1111,30 @@ bool cmQtAutoGenInitializer::InitAutogenTarget() // Register info file as generated by CMake this->Makefile->AddCMakeOutputFile(this->AutogenTarget.InfoFile); + // Determine whether to use a depfile for the AUTOGEN target. + const bool useNinjaDepfile = this->QtVersion >= IntegerVersion(5, 15) && + this->GlobalGen->GetName().find("Ninja") != std::string::npos; + // Files provided by the autogen target std::vector<std::string> autogenByproducts; + std::vector<std::string> timestampByproducts; if (this->Moc.Enabled) { this->AddGeneratedSource(this->Moc.CompilationFile, this->Moc, true); - autogenByproducts.push_back(this->Moc.CompilationFileGenex); + if (useNinjaDepfile) { + if (this->MultiConfig) { + // Make all mocs_compilation_<CONFIG>.cpp files byproducts of the + // ${target}_autogen/timestamp custom command. + // We cannot just use Moc.CompilationFileGenex here, because that + // custom command runs cmake_autogen for each configuration. + for (const auto& p : this->Moc.CompilationFile.Config) { + timestampByproducts.push_back(p.second); + } + } else { + timestampByproducts.push_back(this->Moc.CompilationFileGenex); + } + } else { + autogenByproducts.push_back(this->Moc.CompilationFileGenex); + } } if (this->Uic.Enabled) { @@ -1265,8 +1284,6 @@ bool cmQtAutoGenInitializer::InitAutogenTarget() this->AutogenTarget.DependFiles.begin(), this->AutogenTarget.DependFiles.end()); - const bool useNinjaDepfile = this->QtVersion >= IntegerVersion(5, 15) && - this->GlobalGen->GetName().find("Ninja") != std::string::npos; if (useNinjaDepfile) { // Create a custom command that generates a timestamp file and // has a depfile assigned. The depfile is created by JobDepFilesMergeT. @@ -1327,8 +1344,9 @@ bool cmQtAutoGenInitializer::InitAutogenTarget() this->AddGeneratedSource(outputFile, this->Moc); const std::string no_main_dependency; this->LocalGen->AddCustomCommandToOutput( - outputFile, dependencies, no_main_dependency, commandLines, - autogenComment.c_str(), this->Dir.Work.c_str(), + { outputFile }, timestampByproducts, dependencies, no_main_dependency, + /*implicit_depends=*/{}, commandLines, autogenComment.c_str(), + this->Dir.Work.c_str(), /*cmp0116=*/cmPolicies::NEW, /*replace=*/false, /*escapeOldStyle=*/false, /*uses_terminal=*/false, diff --git a/Tests/RunCMake/CPack/RPM/default_expected_stderr.txt b/Tests/RunCMake/CPack/RPM/default_expected_stderr.txt index 6c87ca0..404076b 100644 --- a/Tests/RunCMake/CPack/RPM/default_expected_stderr.txt +++ b/Tests/RunCMake/CPack/RPM/default_expected_stderr.txt @@ -1 +1,2 @@ -^(CPackRPM: Will use GENERATED spec file: (/[^/]*)*/Tests/RunCMake/RPM\.[^/]*/CPack/[^-]*(-package-target)?-build((-[^-]*-subtest/)|/)_CPack_Packages/.*/RPM/SPECS/[^\.]*\.spec(\n|$))*$ +^(CPackRPM: Will use GENERATED spec file: (/[^/]*)*/Tests/RunCMake/RPM\.[^/]*/CPack/[^-]*(-package-target)?-build((-[^-]*-subtest/)|/)_CPack_Packages/.*/RPM/SPECS/[^\.]*\.spec( +|$))*$ diff --git a/Tests/RunCMake/GoogleTest/GoogleTest-discovery-POST_BUILD-timeout-test-stdout.txt b/Tests/RunCMake/GoogleTest/GoogleTest-discovery-POST_BUILD-timeout-test-stdout.txt index d9de3f8..904ed11 100644 --- a/Tests/RunCMake/GoogleTest/GoogleTest-discovery-POST_BUILD-timeout-test-stdout.txt +++ b/Tests/RunCMake/GoogleTest/GoogleTest-discovery-POST_BUILD-timeout-test-stdout.txt @@ -8,11 +8,13 @@ Debug/discovery_timeout_test_NOT_BUILT Debug/discovery_timeout_test_NOT_BUILT(\.exe)? Debug/discovery_timeout_test_NOT_BUILT Debug/discovery_timeout_test_NOT_BUILT(\.exe)? -[^\n]+discovery_timeout_test_NOT_BUILT +\.+\*\*\*Not Run +[0-9.]+ sec +[^ +]+discovery_timeout_test_NOT_BUILT +\.+\*\*\*Not Run +[0-9.]+ sec + 0% tests passed, 1 tests failed out of 1 + Total Test time \(real\) = +[0-9.]+ sec + The following tests FAILED: -[^\n]+discovery_timeout_test_NOT_BUILT \(Not Run\) +[^ +]+discovery_timeout_test_NOT_BUILT \(Not Run\) diff --git a/Tests/RunCMake/GoogleTest/GoogleTest-property-timeout1-stdout.txt b/Tests/RunCMake/GoogleTest/GoogleTest-property-timeout1-stdout.txt index 0dda49d..5febfbf 100644 --- a/Tests/RunCMake/GoogleTest/GoogleTest-property-timeout1-stdout.txt +++ b/Tests/RunCMake/GoogleTest/GoogleTest-property-timeout1-stdout.txt @@ -1,10 +1,12 @@ Test project .*GoogleTest-build [ \t]*Start [0-9]+: property_timeout.case_no_discovery -[^\n]+property_timeout.case_no_discovery +\.+\*\*\*Timeout +[0-9.]+ sec +[^ +]+property_timeout.case_no_discovery +\.+\*\*\*Timeout +[0-9.]+ sec + 0% tests passed, 1 tests failed out of 1 + Total Test time \(real\) = +[0-9.]+ sec + The following tests FAILED: -[^\n]*property_timeout.case_no_discovery \(Timeout\) +[^ +]*property_timeout.case_no_discovery \(Timeout\) diff --git a/Tests/RunCMake/GoogleTest/GoogleTest-property-timeout2-stdout.txt b/Tests/RunCMake/GoogleTest/GoogleTest-property-timeout2-stdout.txt index 72cea55..c9c7198 100644 --- a/Tests/RunCMake/GoogleTest/GoogleTest-property-timeout2-stdout.txt +++ b/Tests/RunCMake/GoogleTest/GoogleTest-property-timeout2-stdout.txt @@ -1,10 +1,12 @@ Test project .*GoogleTest-build [ \t]*Start [0-9]+: property_timeout.case_with_discovery -[^\n]+property_timeout.case_with_discovery +\.+\*\*\*Timeout +[0-9.]+ sec +[^ +]+property_timeout.case_with_discovery +\.+\*\*\*Timeout +[0-9.]+ sec + 0% tests passed, 1 tests failed out of 1 + Total Test time \(real\) = +[0-9.]+ sec + The following tests FAILED: -[^\n]*property_timeout.case_with_discovery \(Timeout\) +[^ +]*property_timeout.case_with_discovery \(Timeout\) diff --git a/Tests/RunCMake/add_subdirectory/CMP0082-NEW-install-component-stdout.txt b/Tests/RunCMake/add_subdirectory/CMP0082-NEW-install-component-stdout.txt index 7d76ed9..169f0cc 100644 --- a/Tests/RunCMake/add_subdirectory/CMP0082-NEW-install-component-stdout.txt +++ b/Tests/RunCMake/add_subdirectory/CMP0082-NEW-install-component-stdout.txt @@ -1,4 +1,5 @@ -^-- Install configuration: "[^\n]*" +^-- Install configuration: "[^ +]*" -- Install component: "Unspecified" -- sub -- top$ diff --git a/Tests/RunCMake/add_subdirectory/CMP0082-NEW-install-stdout.txt b/Tests/RunCMake/add_subdirectory/CMP0082-NEW-install-stdout.txt index 35b0bb5..426114b 100644 --- a/Tests/RunCMake/add_subdirectory/CMP0082-NEW-install-stdout.txt +++ b/Tests/RunCMake/add_subdirectory/CMP0082-NEW-install-stdout.txt @@ -1,3 +1,4 @@ -^-- Install configuration: "[^\n]*" +^-- Install configuration: "[^ +]*" -- sub -- top$ diff --git a/Tests/RunCMake/add_subdirectory/CMP0082-OLD-install-component-stdout.txt b/Tests/RunCMake/add_subdirectory/CMP0082-OLD-install-component-stdout.txt index 4b39789..b26500e 100644 --- a/Tests/RunCMake/add_subdirectory/CMP0082-OLD-install-component-stdout.txt +++ b/Tests/RunCMake/add_subdirectory/CMP0082-OLD-install-component-stdout.txt @@ -1,4 +1,5 @@ -^-- Install configuration: "[^\n]*" +^-- Install configuration: "[^ +]*" -- Install component: "Unspecified" -- top -- sub$ diff --git a/Tests/RunCMake/add_subdirectory/CMP0082-OLD-install-stdout.txt b/Tests/RunCMake/add_subdirectory/CMP0082-OLD-install-stdout.txt index 8f3a5f7..fcd556c 100644 --- a/Tests/RunCMake/add_subdirectory/CMP0082-OLD-install-stdout.txt +++ b/Tests/RunCMake/add_subdirectory/CMP0082-OLD-install-stdout.txt @@ -1,3 +1,4 @@ -^-- Install configuration: "[^\n]*" +^-- Install configuration: "[^ +]*" -- top -- sub$ diff --git a/Tests/RunCMake/add_subdirectory/CMP0082-WARN-Nested-install-component-stdout.txt b/Tests/RunCMake/add_subdirectory/CMP0082-WARN-Nested-install-component-stdout.txt index 4b39789..b26500e 100644 --- a/Tests/RunCMake/add_subdirectory/CMP0082-WARN-Nested-install-component-stdout.txt +++ b/Tests/RunCMake/add_subdirectory/CMP0082-WARN-Nested-install-component-stdout.txt @@ -1,4 +1,5 @@ -^-- Install configuration: "[^\n]*" +^-- Install configuration: "[^ +]*" -- Install component: "Unspecified" -- top -- sub$ diff --git a/Tests/RunCMake/add_subdirectory/CMP0082-WARN-Nested-install-stdout.txt b/Tests/RunCMake/add_subdirectory/CMP0082-WARN-Nested-install-stdout.txt index 8f3a5f7..fcd556c 100644 --- a/Tests/RunCMake/add_subdirectory/CMP0082-WARN-Nested-install-stdout.txt +++ b/Tests/RunCMake/add_subdirectory/CMP0082-WARN-Nested-install-stdout.txt @@ -1,3 +1,4 @@ -^-- Install configuration: "[^\n]*" +^-- Install configuration: "[^ +]*" -- top -- sub$ diff --git a/Tests/RunCMake/add_subdirectory/CMP0082-WARN-NestedSub-install-component-stdout.txt b/Tests/RunCMake/add_subdirectory/CMP0082-WARN-NestedSub-install-component-stdout.txt index 4b39789..b26500e 100644 --- a/Tests/RunCMake/add_subdirectory/CMP0082-WARN-NestedSub-install-component-stdout.txt +++ b/Tests/RunCMake/add_subdirectory/CMP0082-WARN-NestedSub-install-component-stdout.txt @@ -1,4 +1,5 @@ -^-- Install configuration: "[^\n]*" +^-- Install configuration: "[^ +]*" -- Install component: "Unspecified" -- top -- sub$ diff --git a/Tests/RunCMake/add_subdirectory/CMP0082-WARN-NestedSub-install-stdout.txt b/Tests/RunCMake/add_subdirectory/CMP0082-WARN-NestedSub-install-stdout.txt index 8f3a5f7..fcd556c 100644 --- a/Tests/RunCMake/add_subdirectory/CMP0082-WARN-NestedSub-install-stdout.txt +++ b/Tests/RunCMake/add_subdirectory/CMP0082-WARN-NestedSub-install-stdout.txt @@ -1,3 +1,4 @@ -^-- Install configuration: "[^\n]*" +^-- Install configuration: "[^ +]*" -- top -- sub$ diff --git a/Tests/RunCMake/add_subdirectory/CMP0082-WARN-NoTopInstall-install-component-stdout.txt b/Tests/RunCMake/add_subdirectory/CMP0082-WARN-NoTopInstall-install-component-stdout.txt index f7a331d..c6020bd 100644 --- a/Tests/RunCMake/add_subdirectory/CMP0082-WARN-NoTopInstall-install-component-stdout.txt +++ b/Tests/RunCMake/add_subdirectory/CMP0082-WARN-NoTopInstall-install-component-stdout.txt @@ -1,3 +1,4 @@ -^-- Install configuration: "[^\n]*" +^-- Install configuration: "[^ +]*" -- Install component: "Unspecified" -- sub$ diff --git a/Tests/RunCMake/add_subdirectory/CMP0082-WARN-NoTopInstall-install-stdout.txt b/Tests/RunCMake/add_subdirectory/CMP0082-WARN-NoTopInstall-install-stdout.txt index 6f22ae2..658386b 100644 --- a/Tests/RunCMake/add_subdirectory/CMP0082-WARN-NoTopInstall-install-stdout.txt +++ b/Tests/RunCMake/add_subdirectory/CMP0082-WARN-NoTopInstall-install-stdout.txt @@ -1,2 +1,3 @@ -^-- Install configuration: "[^\n]*" +^-- Install configuration: "[^ +]*" -- sub$ diff --git a/Tests/RunCMake/add_subdirectory/CMP0082-WARN-None-install-component-stdout.txt b/Tests/RunCMake/add_subdirectory/CMP0082-WARN-None-install-component-stdout.txt index 157ab37..ad070d5 100644 --- a/Tests/RunCMake/add_subdirectory/CMP0082-WARN-None-install-component-stdout.txt +++ b/Tests/RunCMake/add_subdirectory/CMP0082-WARN-None-install-component-stdout.txt @@ -1,3 +1,4 @@ -^-- Install configuration: "[^\n]*" +^-- Install configuration: "[^ +]*" -- Install component: "Unspecified" -- top$ diff --git a/Tests/RunCMake/add_subdirectory/CMP0082-WARN-None-install-stdout.txt b/Tests/RunCMake/add_subdirectory/CMP0082-WARN-None-install-stdout.txt index 9e15872..5a44e46 100644 --- a/Tests/RunCMake/add_subdirectory/CMP0082-WARN-None-install-stdout.txt +++ b/Tests/RunCMake/add_subdirectory/CMP0082-WARN-None-install-stdout.txt @@ -1,2 +1,3 @@ -^-- Install configuration: "[^\n]*" +^-- Install configuration: "[^ +]*" -- top$ diff --git a/Tests/RunCMake/add_subdirectory/CMP0082-WARN-install-component-stdout.txt b/Tests/RunCMake/add_subdirectory/CMP0082-WARN-install-component-stdout.txt index 4b39789..b26500e 100644 --- a/Tests/RunCMake/add_subdirectory/CMP0082-WARN-install-component-stdout.txt +++ b/Tests/RunCMake/add_subdirectory/CMP0082-WARN-install-component-stdout.txt @@ -1,4 +1,5 @@ -^-- Install configuration: "[^\n]*" +^-- Install configuration: "[^ +]*" -- Install component: "Unspecified" -- top -- sub$ diff --git a/Tests/RunCMake/add_subdirectory/CMP0082-WARN-install-stdout.txt b/Tests/RunCMake/add_subdirectory/CMP0082-WARN-install-stdout.txt index 8f3a5f7..fcd556c 100644 --- a/Tests/RunCMake/add_subdirectory/CMP0082-WARN-install-stdout.txt +++ b/Tests/RunCMake/add_subdirectory/CMP0082-WARN-install-stdout.txt @@ -1,3 +1,4 @@ -^-- Install configuration: "[^\n]*" +^-- Install configuration: "[^ +]*" -- top -- sub$ diff --git a/Tests/RunCMake/ctest_test/RunCMakeTest.cmake b/Tests/RunCMake/ctest_test/RunCMakeTest.cmake index 31bc075..a211c66 100644 --- a/Tests/RunCMake/ctest_test/RunCMakeTest.cmake +++ b/Tests/RunCMake/ctest_test/RunCMakeTest.cmake @@ -158,13 +158,25 @@ add_test( COMMAND ${CMAKE_COMMAND} -E echo <DartMeasurement type="numeric/double" name="my_custom_value">1.4847</DartMeasurement>) add_test( + NAME double_measurement2 + COMMAND ${CMAKE_COMMAND} -E + echo <CTestMeasurement type="numeric/double" name="another_custom_value">1.8474</CTestMeasurement>) +add_test( NAME img_measurement COMMAND ${CMAKE_COMMAND} -E echo <DartMeasurementFile name="TestImage" type="image/png">]] ${IMAGE_DIR}/cmake-logo-16.png [[</DartMeasurementFile>) add_test( + NAME img_measurement2 + COMMAND ${CMAKE_COMMAND} -E + echo <CTestMeasurementFile name="TestImage2" type="image/png">]] ${IMAGE_DIR}/cmake-logo-16.png [[</CTestMeasurementFile>) +add_test( NAME file_measurement COMMAND ${CMAKE_COMMAND} -E echo <DartMeasurementFile name="my_test_input_data" type="file">]] ${IMAGE_DIR}/cmake-logo-16.png [[</DartMeasurementFile>) +add_test( + NAME file_measurement2 + COMMAND ${CMAKE_COMMAND} -E + echo <CTestMeasurementFile name="another_test_input_data" type="file">]] ${IMAGE_DIR}/cmake-logo-16.png [[</CTestMeasurementFile>) ]]) run_ctest(TestMeasurements) endfunction() diff --git a/Tests/RunCMake/ctest_test/TestExtraLabels-check.cmake b/Tests/RunCMake/ctest_test/TestExtraLabels-check.cmake index beb39de..eaa50d1 100644 --- a/Tests/RunCMake/ctest_test/TestExtraLabels-check.cmake +++ b/Tests/RunCMake/ctest_test/TestExtraLabels-check.cmake @@ -20,9 +20,6 @@ if(NOT n_matches EQUAL 1) endif() # Check test output. -if(NOT _test_contents MATCHES "before") - string(APPEND RunCMake_TEST_FAILED "Could not find expected string 'before' in Test.xml") -endif() -if(NOT _test_contents MATCHES "after") - string(APPEND RunCMake_TEST_FAILED "Could not find expected string 'after' in Test.xml") +if(NOT _test_contents MATCHES "<Value>before\nafter\n</Value>") + string(APPEND RunCMake_TEST_FAILED "Could not find expected output in Test.xml") endif() diff --git a/Tests/RunCMake/ctest_test/TestMeasurements-check.cmake b/Tests/RunCMake/ctest_test/TestMeasurements-check.cmake index 0095db0..7e0928d 100644 --- a/Tests/RunCMake/ctest_test/TestMeasurements-check.cmake +++ b/Tests/RunCMake/ctest_test/TestMeasurements-check.cmake @@ -10,13 +10,31 @@ endif() if(NOT _test_contents MATCHES "<Value>1.4847</Value>") string(APPEND RunCMake_TEST_FAILED "Could not find expected measurement value in Test.xml") endif() +# Check the other double measurement. +if(NOT _test_contents MATCHES [[NamedMeasurement type="numeric/double" name="another_custom_value"]]) + string(APPEND RunCMake_TEST_FAILED + "Could not find expected <NamedMeasurement> tag(2) for type='numeric/double' in Test.xml") +endif() +if(NOT _test_contents MATCHES "<Value>1.8474</Value>") + string(APPEND RunCMake_TEST_FAILED "Could not find expected measurement value(2) in Test.xml") +endif() # Check img measurement. if(NOT _test_contents MATCHES [[NamedMeasurement name="TestImage" type="image/png" encoding="base64"]]) string(APPEND RunCMake_TEST_FAILED "Could not find expected <NamedMeasurement> tag for type='image/png' in Test.xml") endif() +# Check img measurement 2. +if(NOT _test_contents MATCHES [[NamedMeasurement name="TestImage2" type="image/png" encoding="base64"]]) + string(APPEND RunCMake_TEST_FAILED + "Could not find expected <NamedMeasurement> tag(2) for type='image/png' in Test.xml") +endif() # Check file measurement. if(NOT _test_contents MATCHES [[NamedMeasurement name="my_test_input_data" encoding="base64" compression="tar/gzip" filename="cmake-logo-16.png" type="file"]]) string(APPEND RunCMake_TEST_FAILED "Could not find expected <NamedMeasurement> tag for type='file' in Test.xml") endif() +# Check file measurement 2. +if(NOT _test_contents MATCHES [[NamedMeasurement name="another_test_input_data" encoding="base64" compression="tar/gzip" filename="cmake-logo-16.png" type="file"]]) + string(APPEND RunCMake_TEST_FAILED + "Could not find expected <NamedMeasurement> tag(2) for type='file' in Test.xml") +endif() |