ctest: Report StartTestTime in Test.xml only for tests that started

Fix commit fd55647d16 (ctest: Record `StartTestTime` entry for each
test in Test.xml, 2026-02-12) to not report an uninitialized field.
This commit is contained in:
Brad King
2026-02-14 18:39:42 -05:00
parent fa69e8348d
commit 14e93d31c1
2 changed files with 4 additions and 2 deletions
+3 -1
View File
@@ -1531,7 +1531,9 @@ 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);
if (result.StartTestTime) {
xml.Element("StartTestTime", *result.StartTestTime);
}
}
void cmCTestTestHandler::WriteTestResultFooter(cmXMLWriter& xml,
+1 -1
View File
@@ -194,7 +194,7 @@ public:
std::string TestMeasurementsOutput;
std::string InstrumentationFile;
int TestCount = 0;
cmDuration StartTestTime;
cm::optional<cmDuration> StartTestTime;
cmCTestTestProperties* Properties = nullptr;
};