summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2024-03-08 14:28:26 (GMT)
committerKitware Robot <kwrobot@kitware.com>2024-03-08 14:28:44 (GMT)
commitd68cf1553d62a6bbed510f19f21a5fcfabc39638 (patch)
tree01e5982c89f5ba3b80b5e4b93d6ce25978d04fd7 /Source
parentdd8e84a8facbea761d95dc91c15d8d21e848cd6f (diff)
parentca0a9def2e95ed92ce866faa3c70015b9ab6123d (diff)
downloadCMake-d68cf1553d62a6bbed510f19f21a5fcfabc39638.zip
CMake-d68cf1553d62a6bbed510f19f21a5fcfabc39638.tar.gz
CMake-d68cf1553d62a6bbed510f19f21a5fcfabc39638.tar.bz2
Merge topic 'ctest-tests-from-file' into release-3.29
ca0a9def2e ctest: Exit with failure when tests-from-file input is missing 60433fc6e8 Tests: Generalize ctest tests-from-file test cases Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !9317
Diffstat (limited to 'Source')
-rw-r--r--Source/CTest/cmCTestTestHandler.cxx20
-rw-r--r--Source/CTest/cmCTestTestHandler.h4
2 files changed, 14 insertions, 10 deletions
diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx
index dc16f66..ebb5073 100644
--- a/Source/CTest/cmCTestTestHandler.cxx
+++ b/Source/CTest/cmCTestTestHandler.cxx
@@ -1845,11 +1845,15 @@ bool cmCTestTestHandler::GetListOfTests()
}
if (!this->TestListFile.empty()) {
- this->TestsToRunByName = this->ReadTestListFile(this->TestListFile);
+ if (!this->ReadTestListFile(this->TestListFile, this->TestsToRunByName)) {
+ return false;
+ }
}
if (!this->ExcludeTestListFile.empty()) {
- this->TestsToExcludeByName =
- this->ReadTestListFile(this->ExcludeTestListFile);
+ if (!this->ReadTestListFile(this->ExcludeTestListFile,
+ this->TestsToExcludeByName)) {
+ return false;
+ }
}
cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
@@ -2020,11 +2024,10 @@ void cmCTestTestHandler::ExpandTestsToRunInformationForRerunFailed()
}
}
-std::set<std::string> cmCTestTestHandler::ReadTestListFile(
- const std::string& testListFileName) const
+bool cmCTestTestHandler::ReadTestListFile(
+ std::string const& testListFileName, std::set<std::string>& testNames) const
{
- std::set<std::string> testNames;
-
+ testNames.clear();
cmsys::ifstream ifs(testListFileName.c_str());
if (ifs) {
std::string line;
@@ -2043,9 +2046,10 @@ std::set<std::string> cmCTestTestHandler::ReadTestListFile(
"Problem reading test list file: "
<< testListFileName
<< " while generating list of tests to run." << std::endl);
+ return false;
}
- return testNames;
+ return true;
}
void cmCTestTestHandler::RecordCustomTestMeasurements(cmXMLWriter& xml,
diff --git a/Source/CTest/cmCTestTestHandler.h b/Source/CTest/cmCTestTestHandler.h
index 84e6098..e9c964b 100644
--- a/Source/CTest/cmCTestTestHandler.h
+++ b/Source/CTest/cmCTestTestHandler.h
@@ -341,8 +341,8 @@ private:
std::string GetTestStatus(cmCTestTestResult const&);
void ExpandTestsToRunInformation(size_t numPossibleTests);
void ExpandTestsToRunInformationForRerunFailed();
- std::set<std::string> ReadTestListFile(
- const std::string& testListFileName) const;
+ bool ReadTestListFile(std::string const& testListFileName,
+ std::set<std::string>& testNames) const;
std::vector<std::string> CustomPreTest;
std::vector<std::string> CustomPostTest;