ctest: Record StartTestTime entry for each test in Test.xml

Capture the time at which each test was started.  The time should be in
milliseconds to allow quick test runs to be differentiated.

Fixes: #26859
This commit is contained in:
Joseph Snyder
2026-02-12 14:40:04 -05:00
parent 23ae364fc1
commit fd55647d16
4 changed files with 10 additions and 0 deletions
+3
View File
@@ -365,6 +365,9 @@ cmCTestRunTest::EndTestResult cmCTestRunTest::EndTest(size_t completed,
if (!skipped) {
this->TestResult.CompletionStatus = "Completed";
}
this->TestResult.StartTestTime =
std::chrono::duration_cast<std::chrono::milliseconds>(
this->TestProcess->GetSystemStartTime().time_since_epoch());
this->TestResult.ExecutionTime = this->TestProcess->GetTotalTime();
this->MemCheckPostProcess();
this->ComputeWeightedCost();
+1
View File
@@ -1525,6 +1525,7 @@ void cmCTestTestHandler::WriteTestResultHeader(cmXMLWriter& xml,
xml.Element("Path", this->CTest->GetShortPathToFile(result.Path));
xml.Element("FullName", this->CTest->GetShortPathToFile(testPath));
xml.Element("FullCommandLine", result.FullCommandLine);
xml.Element("StartTestTime", result.StartTestTime);
}
void cmCTestTestHandler::WriteTestResultFooter(cmXMLWriter& xml,
+1
View File
@@ -194,6 +194,7 @@ public:
std::string TestMeasurementsOutput;
std::string InstrumentationFile;
int TestCount = 0;
std::chrono::milliseconds StartTestTime;
cmCTestTestProperties* Properties = nullptr;
};
+5
View File
@@ -113,6 +113,11 @@ private:
return std::chrono::system_clock::to_time_t(value);
}
static long long SafeContent(std::chrono::milliseconds value)
{
return value.count();
}
template <typename T>
static T SafeContent(T value)
{