summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2022-03-09 17:17:33 (GMT)
committerKitware Robot <kwrobot@kitware.com>2022-03-09 17:17:44 (GMT)
commitcbd36eac23628f74ae3b50f9d1b8a0478c3e317a (patch)
tree2a1a3b85f60dabb52eb3e7f2c5348a557c17b777 /Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake
parent51e81d1f7354fc425b3fc210900cab37ca00926f (diff)
parent140704d443e73c2dc74ac8192a109ae0c21e834a (diff)
downloadCMake-cbd36eac23628f74ae3b50f9d1b8a0478c3e317a.zip
CMake-cbd36eac23628f74ae3b50f9d1b8a0478c3e317a.tar.gz
CMake-cbd36eac23628f74ae3b50f9d1b8a0478c3e317a.tar.bz2
Merge topic 'ctest_truncate'
140704d443 ctest: add option for output truncation 359e5b17d8 presets: bump version to v5 4634de335b cmCTestTestHandler: refactor CleanTestOutput method Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !6993
Diffstat (limited to 'Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake')
-rw-r--r--Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake21
1 files changed, 21 insertions, 0 deletions
diff --git a/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake
index 7da95a2..5b198bd 100644
--- a/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake
@@ -274,6 +274,27 @@ function(run_TestOutputSize)
endfunction()
run_TestOutputSize()
+# Test --test-output-truncation
+function(run_TestOutputTruncation mode expected)
+ set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/TestOutputTruncation_${mode})
+ set(RunCMake_TEST_NO_CLEAN 1)
+ set(TRUNCATED_OUTPUT ${expected}) # used in TestOutputTruncation-check.cmake
+ file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}")
+ file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}")
+ file(WRITE "${RunCMake_TEST_BINARY_DIR}/CTestTestfile.cmake" "
+ add_test(Truncation_${mode} \"${CMAKE_COMMAND}\" -E echo 123456789)
+")
+ run_cmake_command(TestOutputTruncation
+ ${CMAKE_CTEST_COMMAND} -M Experimental -T Test
+ --no-compress-output
+ --test-output-size-passed 5
+ --test-output-truncation ${mode}
+ )
+endfunction()
+run_TestOutputTruncation("head" "\\.\\.\\.6789")
+run_TestOutputTruncation("middle" "12\\.\\.\\..*\\.\\.\\.89")
+run_TestOutputTruncation("tail" "12345\.\.\.")
+
# Test --stop-on-failure
function(run_stop_on_failure)
set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/stop-on-failure)