diff options
author | Brad King <brad.king@kitware.com> | 2015-09-17 14:55:56 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2015-09-18 15:32:05 (GMT) |
commit | 6e3151f6ccd035ffd704d3cb0162c873d5e95e15 (patch) | |
tree | fb9af5b6228bc9e382f9e9db5cfdf4692c966a54 | |
parent | fa73ee025fb979fe8668483ca04f8be8f69b2f5b (diff) | |
download | CMake-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.
-rw-r--r-- | Help/command/ctest_test.rst | 3 | ||||
-rw-r--r-- | Help/manual/cmake-variables.7.rst | 2 | ||||
-rw-r--r-- | Help/variable/CTEST_CUSTOM_MAXIMUM_FAILED_TEST_OUTPUT_SIZE.rst | 6 | ||||
-rw-r--r-- | Help/variable/CTEST_CUSTOM_MAXIMUM_PASSED_TEST_OUTPUT_SIZE.rst | 6 | ||||
-rw-r--r-- | Tests/RunCMake/ctest_test/CMakeLists.txt.in | 1 | ||||
-rw-r--r-- | Tests/RunCMake/ctest_test/RunCMakeTest.cmake | 15 | ||||
-rw-r--r-- | Tests/RunCMake/ctest_test/TestOutputSize-check.cmake | 17 |
7 files changed, 50 insertions, 0 deletions
diff --git a/Help/command/ctest_test.rst b/Help/command/ctest_test.rst index 162db69..412e323 100644 --- a/Help/command/ctest_test.rst +++ b/Help/command/ctest_test.rst @@ -85,3 +85,6 @@ The options are: been printed to the console. Output from the underlying test command is not affected. Summary info detailing the percentage of passing tests is also unaffected by the ``QUIET`` option. + +See also the :variable:`CTEST_CUSTOM_MAXIMUM_PASSED_TEST_OUTPUT_SIZE` +and :variable:`CTEST_CUSTOM_MAXIMUM_FAILED_TEST_OUTPUT_SIZE` variables. diff --git a/Help/manual/cmake-variables.7.rst b/Help/manual/cmake-variables.7.rst index e0dbdeb..660d544 100644 --- a/Help/manual/cmake-variables.7.rst +++ b/Help/manual/cmake-variables.7.rst @@ -374,6 +374,8 @@ Variables for CTest /variable/CTEST_COVERAGE_COMMAND /variable/CTEST_COVERAGE_EXTRA_FLAGS /variable/CTEST_CURL_OPTIONS + /variable/CTEST_CUSTOM_MAXIMUM_FAILED_TEST_OUTPUT_SIZE + /variable/CTEST_CUSTOM_MAXIMUM_PASSED_TEST_OUTPUT_SIZE /variable/CTEST_CVS_CHECKOUT /variable/CTEST_CVS_COMMAND /variable/CTEST_CVS_UPDATE_OPTIONS diff --git a/Help/variable/CTEST_CUSTOM_MAXIMUM_FAILED_TEST_OUTPUT_SIZE.rst b/Help/variable/CTEST_CUSTOM_MAXIMUM_FAILED_TEST_OUTPUT_SIZE.rst new file mode 100644 index 0000000..1b4bb01 --- /dev/null +++ b/Help/variable/CTEST_CUSTOM_MAXIMUM_FAILED_TEST_OUTPUT_SIZE.rst @@ -0,0 +1,6 @@ +CTEST_CUSTOM_MAXIMUM_FAILED_TEST_OUTPUT_SIZE +-------------------------------------------- + +Specify the maximum amount of output from a failed test that will +be collected by the :command:`ctest_test` command. If not set, +the default is 300 KiB. diff --git a/Help/variable/CTEST_CUSTOM_MAXIMUM_PASSED_TEST_OUTPUT_SIZE.rst b/Help/variable/CTEST_CUSTOM_MAXIMUM_PASSED_TEST_OUTPUT_SIZE.rst new file mode 100644 index 0000000..168e84e --- /dev/null +++ b/Help/variable/CTEST_CUSTOM_MAXIMUM_PASSED_TEST_OUTPUT_SIZE.rst @@ -0,0 +1,6 @@ +CTEST_CUSTOM_MAXIMUM_PASSED_TEST_OUTPUT_SIZE +-------------------------------------------- + +Specify the maximum amount of output from a passed test that will +be collected by the :command:`ctest_test` command. If not set, +the default is 1 KiB. diff --git a/Tests/RunCMake/ctest_test/CMakeLists.txt.in b/Tests/RunCMake/ctest_test/CMakeLists.txt.in index cedf379..e61b556 100644 --- a/Tests/RunCMake/ctest_test/CMakeLists.txt.in +++ b/Tests/RunCMake/ctest_test/CMakeLists.txt.in @@ -2,3 +2,4 @@ cmake_minimum_required(VERSION 3.1) project(CTestTest@CASE_NAME@ NONE) include(CTest) add_test(NAME RunCMakeVersion COMMAND "${CMAKE_COMMAND}" --version) +@CASE_CMAKELISTS_SUFFIX_CODE@ diff --git a/Tests/RunCMake/ctest_test/RunCMakeTest.cmake b/Tests/RunCMake/ctest_test/RunCMakeTest.cmake index 76dc143..e2f380c 100644 --- a/Tests/RunCMake/ctest_test/RunCMakeTest.cmake +++ b/Tests/RunCMake/ctest_test/RunCMakeTest.cmake @@ -59,3 +59,18 @@ function(run_TestChangeId) run_ctest(TestChangeId) endfunction() run_TestChangeId() + +function(run_TestOutputSize) + set(CASE_CTEST_TEST_ARGS EXCLUDE RunCMakeVersion) + set(CASE_TEST_PREFIX_CODE [[ +set(CTEST_CUSTOM_MAXIMUM_PASSED_TEST_OUTPUT_SIZE 10) +set(CTEST_CUSTOM_MAXIMUM_FAILED_TEST_OUTPUT_SIZE 12) + ]]) + set(CASE_CMAKELISTS_SUFFIX_CODE [[ +add_test(NAME PassingTest COMMAND ${CMAKE_COMMAND} -E echo PassingTestOutput) +add_test(NAME FailingTest COMMAND ${CMAKE_COMMAND} -E no_such_command) + ]]) + + run_ctest(TestOutputSize) +endfunction() +run_TestOutputSize() 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() |