1
0
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:
Joseph Snyder
2021-05-19 11:46:21 -04:00
committed by Brad King
parent cf470d8dac
commit 5d5610b04f
3 changed files with 14 additions and 0 deletions

View File

@@ -289,6 +289,13 @@ int cmCTestCoverageHandler::ProcessHandler()
this->CTest->GetCTestConfiguration("SourceDirectory"); this->CTest->GetCTestConfiguration("SourceDirectory");
std::string binaryDir = this->CTest->GetCTestConfiguration("BuildDirectory"); 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(); this->LoadLabels();
cmGeneratedFileStream ofs; cmGeneratedFileStream ofs;

View File

@@ -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.$

View File

@@ -360,6 +360,10 @@ run_NoTests()
# Check the configuration type variable is passed # Check the configuration type variable is passed
run_ctest(check-configuration-type) run_ctest(check-configuration-type)
run_cmake_command(EmptyDirCoverage-ctest
${CMAKE_CTEST_COMMAND} -C Debug -M Experimental -T Coverage
)
function(run_MemCheckSan case opts) function(run_MemCheckSan case opts)
# Use a single build tree for a few tests without cleaning. # Use a single build tree for a few tests without cleaning.
set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/MemCheckSan${case}-build) set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/MemCheckSan${case}-build)