diff options
-rw-r--r-- | Source/CTest/cmCTestUpdateHandler.cxx | 4 | ||||
-rw-r--r-- | Tests/RunCMake/CMakeLists.txt | 1 | ||||
-rw-r--r-- | Tests/RunCMake/ctest_update/CMakeLists.txt.in | 4 | ||||
-rw-r--r-- | Tests/RunCMake/ctest_update/RunCMakeTest.cmake | 17 | ||||
-rw-r--r-- | Tests/RunCMake/ctest_update/UpdateChangeId-check.cmake | 12 | ||||
-rw-r--r-- | Tests/RunCMake/ctest_update/test.cmake.in | 16 |
6 files changed, 54 insertions, 0 deletions
diff --git a/Source/CTest/cmCTestUpdateHandler.cxx b/Source/CTest/cmCTestUpdateHandler.cxx index e3b7e9e..5cfc4a7 100644 --- a/Source/CTest/cmCTestUpdateHandler.cxx +++ b/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); diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index 4973e55..2b78171 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/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) diff --git a/Tests/RunCMake/ctest_update/CMakeLists.txt.in b/Tests/RunCMake/ctest_update/CMakeLists.txt.in new file mode 100644 index 0000000..ecf0e54 --- /dev/null +++ b/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@ diff --git a/Tests/RunCMake/ctest_update/RunCMakeTest.cmake b/Tests/RunCMake/ctest_update/RunCMakeTest.cmake new file mode 100644 index 0000000..0e1748f --- /dev/null +++ b/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() diff --git a/Tests/RunCMake/ctest_update/UpdateChangeId-check.cmake b/Tests/RunCMake/ctest_update/UpdateChangeId-check.cmake new file mode 100644 index 0000000..9269fbc --- /dev/null +++ b/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="<>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() diff --git a/Tests/RunCMake/ctest_update/test.cmake.in b/Tests/RunCMake/ctest_update/test.cmake.in new file mode 100644 index 0000000..abbef74 --- /dev/null +++ b/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}) |