mirror of
https://github.com/Kitware/CMake.git
synced 2025-10-14 02:08:27 +08:00
CTest: Exit coverage handling early if no binary dir
Check for the existence of the Binary directory string before checking for coverage files. If the directory is not specified, write an error message and do not do any checking. Fixes: #22102
This commit is contained in:
@@ -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;
|
||||
|
@@ -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.$
|
@@ -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)
|
||||
|
Reference in New Issue
Block a user