summaryrefslogtreecommitdiffstats
path: root/Tests
diff options
context:
space:
mode:
authorZack Galbreath <zack.galbreath@kitware.com>2015-07-08 01:50:32 (GMT)
committerBrad King <brad.king@kitware.com>2015-07-17 14:26:28 (GMT)
commit601ff0ec55517bc2a80e9a8cc2340f1c18b93490 (patch)
tree01bd5763d85ce64de94a3893539a205a58cb25a0 /Tests
parent7a409983292e0917cf1299d55ca601a92fd4a36e (diff)
downloadCMake-601ff0ec55517bc2a80e9a8cc2340f1c18b93490.zip
CMake-601ff0ec55517bc2a80e9a8cc2340f1c18b93490.tar.gz
CMake-601ff0ec55517bc2a80e9a8cc2340f1c18b93490.tar.bz2
CTest: Optionally add a ChangeId attribute on XML Site tags
Add variable CTEST_CHANGE_ID to configure the setting. This allows CTest clients to give CDash information about what change is being tested so that CDash can take actions to report the results (e.g. to a pull request page).
Diffstat (limited to 'Tests')
-rw-r--r--Tests/RunCMake/ctest_build/BuildChangeId-check.cmake12
-rw-r--r--Tests/RunCMake/ctest_build/RunCMakeTest.cmake9
-rw-r--r--Tests/RunCMake/ctest_test/RunCMakeTest.cmake10
-rw-r--r--Tests/RunCMake/ctest_test/TestChangeId-check.cmake12
-rw-r--r--Tests/RunCMake/ctest_test/test.cmake.in1
5 files changed, 44 insertions, 0 deletions
diff --git a/Tests/RunCMake/ctest_build/BuildChangeId-check.cmake b/Tests/RunCMake/ctest_build/BuildChangeId-check.cmake
new file mode 100644
index 0000000..074801f
--- /dev/null
+++ b/Tests/RunCMake/ctest_build/BuildChangeId-check.cmake
@@ -0,0 +1,12 @@
+file(GLOB build_xml_file "${RunCMake_TEST_BINARY_DIR}/Testing/*/Build.xml")
+if(build_xml_file)
+ file(READ "${build_xml_file}" build_xml LIMIT 4096)
+ if(NOT build_xml MATCHES [[ChangeId="&lt;&gt;1"]])
+ string(REPLACE "\n" "\n " build_xml " ${build_xml}")
+ set(RunCMake_TEST_FAILED
+ "Build.xml does not have expected ChangeId:\n${build_xml}"
+ )
+ endif()
+else()
+ set(RunCMake_TEST_FAILED "Build.xml not found")
+endif()
diff --git a/Tests/RunCMake/ctest_build/RunCMakeTest.cmake b/Tests/RunCMake/ctest_build/RunCMakeTest.cmake
index c6f732c..324f25c 100644
--- a/Tests/RunCMake/ctest_build/RunCMakeTest.cmake
+++ b/Tests/RunCMake/ctest_build/RunCMakeTest.cmake
@@ -31,3 +31,12 @@ endif()
endif()
endfunction()
run_BuildFailure()
+
+function(run_BuildChangeId)
+ set(CASE_TEST_PREFIX_CODE [[
+ set(CTEST_CHANGE_ID "<>1")
+ ]])
+
+ run_ctest(BuildChangeId)
+endfunction()
+run_BuildChangeId()
diff --git a/Tests/RunCMake/ctest_test/RunCMakeTest.cmake b/Tests/RunCMake/ctest_test/RunCMakeTest.cmake
index 21d0447..76dc143 100644
--- a/Tests/RunCMake/ctest_test/RunCMakeTest.cmake
+++ b/Tests/RunCMake/ctest_test/RunCMakeTest.cmake
@@ -49,3 +49,13 @@ set(CASE_CTEST_TEST_LOAD "ERR3")
run_ctest_test(TestLoadOrder TEST_LOAD "ERR4")
unset(ENV{__CTEST_FAKE_LOAD_AVERAGE_FOR_TESTING})
+unset(CASE_CTEST_TEST_LOAD)
+
+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_test/TestChangeId-check.cmake b/Tests/RunCMake/ctest_test/TestChangeId-check.cmake
new file mode 100644
index 0000000..b9884f1
--- /dev/null
+++ b/Tests/RunCMake/ctest_test/TestChangeId-check.cmake
@@ -0,0 +1,12 @@
+file(GLOB test_xml_file "${RunCMake_TEST_BINARY_DIR}/Testing/*/Test.xml")
+if(test_xml_file)
+ file(READ "${test_xml_file}" test_xml LIMIT 4096)
+ if(NOT test_xml MATCHES [[ChangeId="&lt;&gt;1"]])
+ string(REPLACE "\n" "\n " test_xml " ${test_xml}")
+ set(RunCMake_TEST_FAILED
+ "Test.xml does not have expected ChangeId:\n${test_xml}"
+ )
+ endif()
+else()
+ set(RunCMake_TEST_FAILED "Test.xml not found")
+endif()
diff --git a/Tests/RunCMake/ctest_test/test.cmake.in b/Tests/RunCMake/ctest_test/test.cmake.in
index a8de6a3..50b936d 100644
--- a/Tests/RunCMake/ctest_test/test.cmake.in
+++ b/Tests/RunCMake/ctest_test/test.cmake.in
@@ -1,4 +1,5 @@
cmake_minimum_required(VERSION 3.1)
+@CASE_TEST_PREFIX_CODE@
set(CTEST_SITE "test-site")
set(CTEST_BUILD_NAME "test-build-name")