ctest --test-output-truncation does nothing in dashboard script mode
The CTEST_CUSTOM_TEST_OUTPUT_TRUNCATION
variable works as advertised, but the --test-output-truncation
option appears to have no effect. I was unable to get it to change the truncation behavior in my local test script. The functionality was originally added in !6993 (merged).
I figured this would be something that the test suite would cover, and I found the TestOutputTruncation
sub-cases of the RunCMake.ctest_test
test case, but it turns out those test cases are malformed. Here's the problematic part of the tests:
# Test --test-output-truncation
function(run_TestOutputTruncation mode expected)
set(CASE_CTEST_TEST_ARGS EXCLUDE RunCMakeVersion)
set(TRUNCATED_OUTPUT ${expected}) # used in TestOutputTruncation-check.cmake
set(CASE_TEST_PREFIX_CODE [[
set( CTEST_CUSTOM_TEST_OUTPUT_TRUNCATION${mode})
]])
set(CASE_CMAKELISTS_SUFFIX_CODE [[
add_test(NAME Truncation_${mode} COMMAND ${CMAKE_COMMAND} -E echo 123456789)
]])
run_ctest(TestOutputTruncation)
endfunction()
run_TestOutputTruncation("head" "...6789")
run_TestOutputTruncation("middle" "12....*...89")
run_TestOutputTruncation("tail" "12345...")
The last three lines are specifying regular expressions to match, not literal output. The .
characters should be escaped. If we fix that to become the following instead:
run_TestOutputTruncation("head" [[\.\.\.6789]])
run_TestOutputTruncation("middle" [[12\.\.\..*\.\.\.89]])
run_TestOutputTruncation("tail" [[12345\.\.\.]])
The tests then fail, with the output confirming that the --test-output-truncation
option is not having any effect. In fact, there is no output truncation at all.