summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2021-06-10 12:19:50 (GMT)
committerKitware Robot <kwrobot@kitware.com>2021-06-10 12:20:18 (GMT)
commitcf85c6bf85398213d965a41f81b604142456bd23 (patch)
treee2839b851e32fd0ad491116cc7d2fd9ea1c34a00 /Tests/RunCMake
parent49c165450f05a125f7e7b81e9eb0c7ba4a3b595a (diff)
parent02f1271bdf810107ad5d3c0cffb74b472d706054 (diff)
downloadCMake-cf85c6bf85398213d965a41f81b604142456bd23.zip
CMake-cf85c6bf85398213d965a41f81b604142456bd23.tar.gz
CMake-cf85c6bf85398213d965a41f81b604142456bd23.tar.bz2
Merge topic 'ctest_custom_details'
02f1271bdf ctest: allow test output to override the 'details' field Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !6204
Diffstat (limited to 'Tests/RunCMake')
-rw-r--r--Tests/RunCMake/ctest_test/RunCMakeTest.cmake12
-rw-r--r--Tests/RunCMake/ctest_test/TestCompletionStatus-check.cmake16
2 files changed, 28 insertions, 0 deletions
diff --git a/Tests/RunCMake/ctest_test/RunCMakeTest.cmake b/Tests/RunCMake/ctest_test/RunCMakeTest.cmake
index 76a63f0..f07a12b 100644
--- a/Tests/RunCMake/ctest_test/RunCMakeTest.cmake
+++ b/Tests/RunCMake/ctest_test/RunCMakeTest.cmake
@@ -169,3 +169,15 @@ add_test(
run_ctest(TestMeasurements)
endfunction()
run_measurements()
+
+# Verify that test output can override the Completion Status.
+function(run_completion_status)
+ set(CASE_CMAKELISTS_SUFFIX_CODE [[
+add_test(
+ NAME custom_details
+ COMMAND ${CMAKE_COMMAND} -E
+ echo test output\n<CTestDetails>CustomDetails</CTestDetails>\nmore output)
+ ]])
+ run_ctest(TestCompletionStatus)
+endfunction()
+run_completion_status()
diff --git a/Tests/RunCMake/ctest_test/TestCompletionStatus-check.cmake b/Tests/RunCMake/ctest_test/TestCompletionStatus-check.cmake
new file mode 100644
index 0000000..10de2ed
--- /dev/null
+++ b/Tests/RunCMake/ctest_test/TestCompletionStatus-check.cmake
@@ -0,0 +1,16 @@
+file(READ "${RunCMake_TEST_BINARY_DIR}/Testing/TAG" _tag)
+string(REGEX REPLACE "^([^\n]*)\n.*$" "\\1" _date "${_tag}")
+file(READ "${RunCMake_TEST_BINARY_DIR}/Testing/${_date}/Test.xml" _test_contents)
+
+# Check custom completion status.
+if(NOT _test_contents MATCHES [[<Value>CustomDetails</Value>]])
+ string(APPEND RunCMake_TEST_FAILED
+ "Could not find expected <Value>CustomDetails</Value> in Test.xml")
+endif()
+# Check test output.
+if(NOT _test_contents MATCHES "test output")
+ string(APPEND RunCMake_TEST_FAILED "Could not find expected string 'test output' in Test.xml")
+endif()
+if(NOT _test_contents MATCHES "more output")
+ string(APPEND RunCMake_TEST_FAILED "Could not find expected string 'more output' in Test.xml")
+endif()