diff options
author | Brad King <brad.king@kitware.com> | 2021-06-03 12:08:33 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2021-06-03 12:08:42 (GMT) |
commit | 4297357087aa64153128f6bcadbbe368266e59ad (patch) | |
tree | 240c94f272bf979a63737537aea5df9b38bf529c | |
parent | dcadb290ad699640b82479b9154341270a249fee (diff) | |
parent | 5d5610b04f51c780d4e5b7f2fd24268f773bea3d (diff) | |
download | CMake-4297357087aa64153128f6bcadbbe368266e59ad.zip CMake-4297357087aa64153128f6bcadbbe368266e59ad.tar.gz CMake-4297357087aa64153128f6bcadbbe368266e59ad.tar.bz2 |
Merge topic 'ctest-coverage-no-dir'
5d5610b04f CTest: Exit coverage handling early if no binary dir
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !6144
-rw-r--r-- | Source/CTest/cmCTestCoverageHandler.cxx | 7 | ||||
-rw-r--r-- | Tests/RunCMake/CTestCommandLine/EmptyDirCoverage-ctest-stderr.txt | 3 | ||||
-rw-r--r-- | Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake | 4 |
3 files changed, 14 insertions, 0 deletions
diff --git a/Source/CTest/cmCTestCoverageHandler.cxx b/Source/CTest/cmCTestCoverageHandler.cxx index 3d7d031..57b1dda 100644 --- a/Source/CTest/cmCTestCoverageHandler.cxx +++ b/Source/CTest/cmCTestCoverageHandler.cxx @@ -289,6 +289,13 @@ int cmCTestCoverageHandler::ProcessHandler() this->CTest->GetCTestConfiguration("SourceDirectory"); std::string binaryDir = this->CTest->GetCTestConfiguration("BuildDirectory"); + if (binaryDir.empty()) { + cmCTestLog(this->CTest, ERROR_MESSAGE, + "Binary directory is not set. " + "No coverage checking will be performed." + << std::endl); + return 0; + } this->LoadLabels(); cmGeneratedFileStream ofs; diff --git a/Tests/RunCMake/CTestCommandLine/EmptyDirCoverage-ctest-stderr.txt b/Tests/RunCMake/CTestCommandLine/EmptyDirCoverage-ctest-stderr.txt new file mode 100644 index 0000000..e6f9325 --- /dev/null +++ b/Tests/RunCMake/CTestCommandLine/EmptyDirCoverage-ctest-stderr.txt @@ -0,0 +1,3 @@ +Cannot find file: [^ +]*/Tests/RunCMake/CTestCommandLine/EmptyDirCoverage-ctest-build/DartConfiguration.tcl +Binary directory is not set. No coverage checking will be performed.$ diff --git a/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake index afec011..4b654f8 100644 --- a/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake +++ b/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake @@ -360,6 +360,10 @@ run_NoTests() # Check the configuration type variable is passed run_ctest(check-configuration-type) +run_cmake_command(EmptyDirCoverage-ctest + ${CMAKE_CTEST_COMMAND} -C Debug -M Experimental -T Coverage + ) + function(run_MemCheckSan case opts) # Use a single build tree for a few tests without cleaning. set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/MemCheckSan${case}-build) |