Explorar o código

Merge topic 'ctest_xml_tweaks'

d8af0700a3 ctest: consistently format generator name
95db11fdb1 ctest: Include ChangeId in Update.xml

Acked-by: Kitware Robot <[email protected]>
Merge-request: !3259
Kyle Edwards %!s(int64=6) %!d(string=hai) anos
pai
achega
a7eb2877b8

+ 4 - 0
Source/CTest/cmCTestUpdateHandler.cxx

@@ -199,6 +199,10 @@ int cmCTestUpdateHandler::ProcessHandler()
   xml.Element("UpdateCommand", vc->GetUpdateCommandLine());
   xml.Element("UpdateType",
               cmCTestUpdateHandlerUpdateToString(this->UpdateType));
+  std::string changeId = this->CTest->GetCTestConfiguration("ChangeId");
+  if (!changeId.empty()) {
+    xml.Element("ChangeId", changeId);
+  }
 
   bool loadedMods = vc->WriteXML(xml);
 

+ 1 - 1
Source/CTest/cmCTestUploadHandler.cxx

@@ -51,7 +51,7 @@ int cmCTestUploadHandler::ProcessHandler()
                   this->CTest->GetTestModelString());
   xml.Attribute("Name", this->CTest->GetCTestConfiguration("Site"));
   xml.Attribute("Generator",
-                std::string("ctest") + cmVersion::GetCMakeVersion());
+                std::string("ctest-") + cmVersion::GetCMakeVersion());
   this->CTest->AddSiteProperties(xml);
   xml.StartElement("Upload");
 

+ 1 - 1
Source/cmCTest.cxx

@@ -1523,7 +1523,7 @@ int cmCTest::GenerateCTestNotesOutput(cmXMLWriter& xml,
                 this->Impl->CurrentTag + "-" + this->GetTestModelString());
   xml.Attribute("Name", this->GetCTestConfiguration("Site"));
   xml.Attribute("Generator",
-                std::string("ctest") + cmVersion::GetCMakeVersion());
+                std::string("ctest-") + cmVersion::GetCMakeVersion());
   this->AddSiteProperties(xml);
   xml.StartElement("Notes");
 

+ 1 - 0
Tests/RunCMake/CMakeLists.txt

@@ -259,6 +259,7 @@ add_RunCMake_test(ctest_submit)
 add_RunCMake_test(ctest_test)
 add_RunCMake_test(ctest_disabled_test)
 add_RunCMake_test(ctest_skipped_test)
+add_RunCMake_test(ctest_update -DGIT_EXECUTABLE=${GIT_EXECUTABLE})
 add_RunCMake_test(ctest_upload)
 add_RunCMake_test(ctest_fixtures)
 add_RunCMake_test(file)

+ 4 - 0
Tests/RunCMake/ctest_update/CMakeLists.txt.in

@@ -0,0 +1,4 @@
+cmake_minimum_required(VERSION 3.1)
+project(CTestTest@CASE_NAME@ NONE)
+include(CTest)
+@CASE_CMAKELISTS_SUFFIX_CODE@

+ 17 - 0
Tests/RunCMake/ctest_update/RunCMakeTest.cmake

@@ -0,0 +1,17 @@
+include(RunCTest)
+set(CASE_CTEST_UPDATE_ARGS "")
+function(run_ctest_update CASE_NAME)
+  set(CASE_CTEST_UPDATE_ARGS "${ARGN}")
+  run_ctest(${CASE_NAME})
+endfunction()
+
+run_ctest_update(TestQuiet QUIET)
+
+function(run_TestChangeId)
+  set(CASE_TEST_PREFIX_CODE [[
+    set(CTEST_CHANGE_ID "<>1")
+  ]])
+
+  run_ctest(TestChangeId)
+endfunction()
+run_TestChangeId()

+ 12 - 0
Tests/RunCMake/ctest_update/UpdateChangeId-check.cmake

@@ -0,0 +1,12 @@
+file(GLOB update_xml_file "${RunCMake_TEST_BINARY_DIR}/Testing/*/Update.xml")
+if(update_xml_file)
+  file(READ "${update_xml_file}" update_xml LIMIT 4096)
+  if(NOT update_xml MATCHES [[ChangeId="&lt;&gt;1"]])
+    string(REPLACE "\n" "\n  " update_xml "  ${update_xml}")
+    set(RunCMake_TEST_FAILED
+      "Update.xml does not have expected ChangeId:\n${update_xml}"
+      )
+  endif()
+else()
+  set(RunCMake_TEST_FAILED "Update.xml not found")
+endif()

+ 16 - 0
Tests/RunCMake/ctest_update/test.cmake.in

@@ -0,0 +1,16 @@
+cmake_minimum_required(VERSION 3.1)
+@CASE_TEST_PREFIX_CODE@
+
+set(CTEST_SITE                          "test-site")
+set(CTEST_BUILD_NAME                    "test-build-name")
+set(CTEST_SOURCE_DIRECTORY              "@RunCMake_BINARY_DIR@/@CASE_NAME@")
+set(CTEST_BINARY_DIRECTORY              "@RunCMake_BINARY_DIR@/@CASE_NAME@-build")
+set(CTEST_CMAKE_GENERATOR               "@RunCMake_GENERATOR@")
+set(CTEST_CMAKE_GENERATOR_PLATFORM      "@RunCMake_GENERATOR_PLATFORM@")
+set(CTEST_CMAKE_GENERATOR_TOOLSET       "@RunCMake_GENERATOR_TOOLSET@")
+set(CTEST_BUILD_CONFIGURATION           "$ENV{CMAKE_CONFIG_TYPE}")
+set(CTEST_UPDATE_COMMAND                "@GIT_EXECUTABLE@")
+
+set(ctest_test_args "@CASE_CTEST_UPDATE_ARGS@")
+ctest_start(Experimental)
+ctest_update(${ctest_update_args})