From d328dc6853e211dc05c4abcf62cc64b9c91235a2 Mon Sep 17 00:00:00 2001 From: Bill Hoffman Date: Thu, 28 Jul 2016 15:12:43 -0400 Subject: CTest: Add CAPTURE_CMAKE_ERROR val to `ctest_*` commands If a `ctest_*` command has CAPTURE_CMAKE_ERROR then any errors generated by cmake during that command will cause the value to be assigned `-1`. This will prevent a `ctest -S` script from returning non-zero unless the script explicitly calls `message(FATAL_ERROR)`. --- Help/command/ctest_build.rst | 5 + Help/command/ctest_configure.rst | 7 +- Help/command/ctest_coverage.rst | 5 + Help/command/ctest_test.rst | 5 + Help/command/ctest_upload.rst | 6 +- Source/CTest/cmCTestHandlerCommand.cxx | 112 ++++++++++++++++++++- Source/CTest/cmCTestHandlerCommand.h | 1 + Source/CTest/cmCTestUploadCommand.cxx | 8 ++ Source/CTest/cmCTestUploadCommand.h | 1 + Tests/RunCMake/CMakeLists.txt | 1 + Tests/RunCMake/ctest_cmake_error/CMakeLists.txt.in | 4 + .../CTestCaptureErrorNonZero-stderr.txt | 4 + .../CTestCaptureErrorZero-stderr.txt | 4 + .../CTestCaptureErrorZero-stdout.txt | 1 + .../ctest_cmake_error/CTestConfig.cmake.in | 1 + .../ctest_cmake_error/CoverageQuiet-stdout.txt | 1 + .../RunCMake/ctest_cmake_error/RunCMakeTest.cmake | 10 ++ Tests/RunCMake/ctest_cmake_error/test.cmake.in | 22 ++++ 18 files changed, 192 insertions(+), 6 deletions(-) create mode 100644 Tests/RunCMake/ctest_cmake_error/CMakeLists.txt.in create mode 100644 Tests/RunCMake/ctest_cmake_error/CTestCaptureErrorNonZero-stderr.txt create mode 100644 Tests/RunCMake/ctest_cmake_error/CTestCaptureErrorZero-stderr.txt create mode 100644 Tests/RunCMake/ctest_cmake_error/CTestCaptureErrorZero-stdout.txt create mode 100644 Tests/RunCMake/ctest_cmake_error/CTestConfig.cmake.in create mode 100644 Tests/RunCMake/ctest_cmake_error/CoverageQuiet-stdout.txt create mode 100644 Tests/RunCMake/ctest_cmake_error/RunCMakeTest.cmake create mode 100644 Tests/RunCMake/ctest_cmake_error/test.cmake.in diff --git a/Help/command/ctest_build.rst b/Help/command/ctest_build.rst index e1b7793..d3ceb2d 100644 --- a/Help/command/ctest_build.rst +++ b/Help/command/ctest_build.rst @@ -13,6 +13,7 @@ Perform the :ref:`CTest Build Step` as a :ref:`Dashboard Client`. [NUMBER_ERRORS ] [NUMBER_WARNINGS ] [RETURN_VALUE ] + [CAPTURE_CMAKE_ERROR ] ) Build the project and store results in ``Build.xml`` @@ -66,6 +67,10 @@ The options are: ``RETURN_VALUE `` Store the return value of the native build tool in the given variable. +``CAPTURE_CMAKE_ERROR `` + Store in the ```` variable -1 if there are any errors running + the command and prevent ctest from returning non-zero if an error occurs. + ``QUIET`` Suppress any CTest-specific non-error output that would have been printed to the console otherwise. The summary of warnings / errors, diff --git a/Help/command/ctest_configure.rst b/Help/command/ctest_configure.rst index 851c292..b11e77c 100644 --- a/Help/command/ctest_configure.rst +++ b/Help/command/ctest_configure.rst @@ -6,7 +6,8 @@ Perform the :ref:`CTest Configure Step` as a :ref:`Dashboard Client`. :: ctest_configure([BUILD ] [SOURCE ] [APPEND] - [OPTIONS ] [RETURN_VALUE ] [QUIET]) + [OPTIONS ] [RETURN_VALUE ] [QUIET] + [CAPTURE_CMAKE_ERROR ]) Configure the project build tree and record results in ``Configure.xml`` for submission with the :command:`ctest_submit` command. @@ -33,6 +34,10 @@ The options are: Store in the ```` variable the return value of the native configuration tool. +``CAPTURE_CMAKE_ERROR `` + Store in the ```` variable -1 if there are any errors running + the command and prevent ctest from returning non-zero if an error occurs. + ``QUIET`` Suppress any CTest-specific non-error messages that would have otherwise been printed to the console. Output from the underlying diff --git a/Help/command/ctest_coverage.rst b/Help/command/ctest_coverage.rst index 12429b9..ec1ee25 100644 --- a/Help/command/ctest_coverage.rst +++ b/Help/command/ctest_coverage.rst @@ -8,6 +8,7 @@ Perform the :ref:`CTest Coverage Step` as a :ref:`Dashboard Client`. ctest_coverage([BUILD ] [APPEND] [LABELS