diff options
author | Brad King <brad.king@kitware.com> | 2021-06-10 12:19:50 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2021-06-10 12:20:18 (GMT) |
commit | cf85c6bf85398213d965a41f81b604142456bd23 (patch) | |
tree | e2839b851e32fd0ad491116cc7d2fd9ea1c34a00 /Tests/RunCMake | |
parent | 49c165450f05a125f7e7b81e9eb0c7ba4a3b595a (diff) | |
parent | 02f1271bdf810107ad5d3c0cffb74b472d706054 (diff) | |
download | CMake-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.cmake | 12 | ||||
-rw-r--r-- | Tests/RunCMake/ctest_test/TestCompletionStatus-check.cmake | 16 |
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() |