mirror of
https://gitlab.kitware.com/cmake/cmake.git
synced 2026-09-25 04:09:36 +03:00
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:
@@ -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();
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -194,6 +194,7 @@ public:
|
||||
std::string TestMeasurementsOutput;
|
||||
std::string InstrumentationFile;
|
||||
int TestCount = 0;
|
||||
std::chrono::milliseconds StartTestTime;
|
||||
cmCTestTestProperties* Properties = nullptr;
|
||||
};
|
||||
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user