summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/ctest_test/TestOutputSize-check.cmake
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2015-09-17 14:55:56 (GMT)
committerBrad King <brad.king@kitware.com>2015-09-18 15:32:05 (GMT)
commit6e3151f6ccd035ffd704d3cb0162c873d5e95e15 (patch)
treefb9af5b6228bc9e382f9e9db5cfdf4692c966a54 /Tests/RunCMake/ctest_test/TestOutputSize-check.cmake
parentfa73ee025fb979fe8668483ca04f8be8f69b2f5b (diff)
downloadCMake-6e3151f6ccd035ffd704d3cb0162c873d5e95e15.zip
CMake-6e3151f6ccd035ffd704d3cb0162c873d5e95e15.tar.gz
CMake-6e3151f6ccd035ffd704d3cb0162c873d5e95e15.tar.bz2
CTest: Document and test custom output size settings
Add documentation and tests for the existing CTEST_CUSTOM_MAXIMUM_PASSED_TEST_OUTPUT_SIZE CTEST_CUSTOM_MAXIMUM_FAILED_TEST_OUTPUT_SIZE CTest variables.
Diffstat (limited to 'Tests/RunCMake/ctest_test/TestOutputSize-check.cmake')
-rw-r--r--Tests/RunCMake/ctest_test/TestOutputSize-check.cmake17
1 files changed, 17 insertions, 0 deletions
diff --git a/Tests/RunCMake/ctest_test/TestOutputSize-check.cmake b/Tests/RunCMake/ctest_test/TestOutputSize-check.cmake
new file mode 100644
index 0000000..918d242
--- /dev/null
+++ b/Tests/RunCMake/ctest_test/TestOutputSize-check.cmake
@@ -0,0 +1,17 @@
+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("${test_xml}" MATCHES [[(<Test Status="passed">.*</Test>).*(<Test Status="failed">.*</Test>)]])
+ set(test_passed "${CMAKE_MATCH_1}")
+ set(test_failed "${CMAKE_MATCH_2}")
+ else()
+ set(RunCMake_TEST_FAILED "Test.xml does not contain a passed then failed test:\n ${test_xml}")
+ endif()
+ if(NOT "${test_passed}" MATCHES [[<Value>PassingTes\.\.\..*10 bytes]])
+ set(RunCMake_TEST_FAILED "Test.xml passed test output not truncated at 10 bytes:\n ${test_passed}")
+ elseif(NOT "${test_failed}" MATCHES [[<Value>CMake Error:\.\.\..*12 bytes]])
+ set(RunCMake_TEST_FAILED "Test.xml failed test output not truncated at 12 bytes:\n ${test_failed}")
+ endif()
+else()
+ set(RunCMake_TEST_FAILED "Test.xml not found")
+endif()