Browse Source

Merge topic 'ctest-upload-xml-time'

b47ccc6ba0 ctest: include "Time" element in Upload.xml

Acked-by: Kitware Robot <[email protected]>
Acked-by: buildbot <[email protected]>
Merge-request: !9292
Brad King 1 year ago
parent
commit
7c286ed5ad

+ 2 - 0
Source/CTest/cmCTestUploadHandler.cxx

@@ -2,6 +2,7 @@
    file Copyright.txt or https://cmake.org/licensing for details.  */
 #include "cmCTestUploadHandler.h"
 
+#include <chrono>
 #include <ostream>
 #include <string>
 
@@ -54,6 +55,7 @@ int cmCTestUploadHandler::ProcessHandler()
                 std::string("ctest-") + cmVersion::GetCMakeVersion());
   this->CTest->AddSiteProperties(xml);
   xml.StartElement("Upload");
+  xml.Element("Time", std::chrono::system_clock::now());
 
   for (std::string const& file : this->Files) {
     cmCTestOptionalLog(this->CTest, OUTPUT,

+ 12 - 0
Tests/RunCMake/ctest_upload/UploadQuiet-check.cmake

@@ -0,0 +1,12 @@
+file(GLOB upload_xml_file "${RunCMake_TEST_BINARY_DIR}/Testing/*/Upload.xml")
+if(upload_xml_file)
+  file(READ "${upload_xml_file}" upload_xml LIMIT 4096)
+  if(NOT upload_xml MATCHES "<Time>")
+    string(REPLACE "\n" "\n  " upload_xml "  ${upload_xml}")
+    set(RunCMake_TEST_FAILED
+      "Upload.xml does not contain a <Time> attribute:\n${upload_xml}"
+      )
+  endif()
+else()
+  set(RunCMake_TEST_FAILED "Upload.xml not found")
+endif()