summaryrefslogtreecommitdiffstats
path: root/Source/CTest/cmCTestRunTest.cxx
diff options
context:
space:
mode:
authorKyle Edwards <kyle.edwards@kitware.com>2023-07-20 20:57:02 (GMT)
committerKyle Edwards <kyle.edwards@kitware.com>2023-08-10 20:47:51 (GMT)
commitc8c1dd0d9540acbe6172afe192c149fe04d0625b (patch)
treedfbd13051070176f318fcdb1fb0ae10f1e7912e1 /Source/CTest/cmCTestRunTest.cxx
parent3f5a5a5856790107bba5cad6d9d45d1170b986f1 (diff)
downloadCMake-c8c1dd0d9540acbe6172afe192c149fe04d0625b.zip
CMake-c8c1dd0d9540acbe6172afe192c149fe04d0625b.tar.gz
CMake-c8c1dd0d9540acbe6172afe192c149fe04d0625b.tar.bz2
CTest: Add ability to dynamically generate resource spec file
Issue: #25106
Diffstat (limited to 'Source/CTest/cmCTestRunTest.cxx')
-rw-r--r--Source/CTest/cmCTestRunTest.cxx22
1 files changed, 22 insertions, 0 deletions
diff --git a/Source/CTest/cmCTestRunTest.cxx b/Source/CTest/cmCTestRunTest.cxx
index 45933a5..4c57cf6 100644
--- a/Source/CTest/cmCTestRunTest.cxx
+++ b/Source/CTest/cmCTestRunTest.cxx
@@ -152,6 +152,18 @@ cmCTestRunTest::EndTestResult cmCTestRunTest::EndTest(size_t completed,
}
}
}
+ std::string resourceSpecParseError;
+ if (!this->TestProperties->GeneratedResourceSpecFile.empty()) {
+ this->MultiTestHandler.ResourceSpecFile =
+ this->TestProperties->GeneratedResourceSpecFile;
+ if (!this->MultiTestHandler.InitResourceAllocator(
+ resourceSpecParseError)) {
+ reason = "Invalid resource spec file";
+ forceFail = true;
+ } else {
+ this->MultiTestHandler.CheckResourcesAvailable();
+ }
+ }
std::ostringstream outputStream;
if (res == cmProcess::State::Exited) {
bool success = !forceFail &&
@@ -260,6 +272,16 @@ cmCTestRunTest::EndTestResult cmCTestRunTest::EndTest(size_t completed,
cmCTestLog(this->CTest, HANDLER_OUTPUT, this->ProcessOutput << std::endl);
}
+ if (!resourceSpecParseError.empty()) {
+ cmCTestLog(this->CTest, ERROR_MESSAGE,
+ resourceSpecParseError << std::endl);
+ } else if (!this->TestProperties->GeneratedResourceSpecFile.empty()) {
+ cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
+ "Using generated resource spec file "
+ << this->TestProperties->GeneratedResourceSpecFile
+ << std::endl);
+ }
+
if (this->TestHandler->LogFile) {
*this->TestHandler->LogFile << "Test time = " << buf << std::endl;
}