瀏覽代碼

Merge topic 'ctest-coverage-no-dir'

5d5610b04f CTest: Exit coverage handling early if no binary dir

Acked-by: Kitware Robot <[email protected]>
Merge-request: !6144
Brad King 4 年之前
父節點
當前提交
4297357087

+ 7 - 0
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;

+ 3 - 0
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.$

+ 4 - 0
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)