Merge topic 'cleanup-CTestTestMemcheck'

e8e67ae CTestTestMemcheck: Fix matching of malloc debug messages
8ea62fd CTestTestMemcheck: Tolerate trailing "==..." lines from valgrind
f169f48 CTestTestMemcheck: Refactor output expectation regex generation
This commit is contained in:
Brad King 2013-10-07 15:43:36 -04:00 committed by CMake Topic Stage
commit 64064c6616
1 changed files with 27 additions and 10 deletions

View File

@ -35,14 +35,31 @@ target_link_libraries(memcheck_fail CMakeLib)
# same filenames. # same filenames.
add_subdirectory(NoLogDummyChecker) add_subdirectory(NoLogDummyChecker)
if (APPLE) if(APPLE)
# filter out additional messages by Guard Malloc integrated in Xcode # filter out additional messages by Guard Malloc integrated in Xcode
set(GUARD_MALLOC_MSG "(ctest\([0-9]+\) malloc: [^\n]*\n)*") set(guard_malloc_msg "ctest\\([0-9]+\\) malloc: ")
set(NORMAL_CTEST_OUTPUT "\n1/1 MemCheck #1: RunCMake \\.+ Passed +[0-9]+\\.[0-9]+ sec\n${GUARD_MALLOC_MSG}\n${GUARD_MALLOC_MSG}100% tests passed, 0 tests failed out of 1\n.*\n-- Processing memory checking output: \n${GUARD_MALLOC_MSG}Memory checking results:\n${GUARD_MALLOC_MSG}") set(guard_malloc_lines "(${guard_malloc_msg}[^\n]*\n)*")
else () set(guard_malloc_output "${guard_malloc_msg}|")
set(NORMAL_CTEST_OUTPUT "\n1/1 MemCheck #1: RunCMake \\.+ Passed +[0-9]+\\.[0-9]+ sec\n\n100% tests passed, 0 tests failed out of 1\n.*\n-- Processing memory checking output: \nMemory checking results:\n") else()
endif () set(guard_malloc_msg "")
set(BULLSEYE_MSG "(BullseyeCoverage[^\n]*\n)?") set(guard_malloc_lines "")
set(guard_malloc_output "")
endif()
# When this entire test runs under coverage or memcheck tools
# they may add output to the end, so match known cases:
# - Bullseye adds a "BullseyeCoverage..." line.
# - Valgrind memcheck may add extra "==..." lines.
set(other_tool_output "((${guard_malloc_output}BullseyeCoverage|==)[^\n]*\n)*")
string(REPLACE "\r\n" "\n" ctest_and_tool_outputs "
1/1 MemCheck #1: RunCMake \\.+ Passed +[0-9]+\\.[0-9]+ sec
${guard_malloc_lines}
100% tests passed, 0 tests failed out of 1
.*
-- Processing memory checking output:( )
${guard_malloc_lines}Memory checking results:
${other_tool_output}")
function(gen_mc_test_internal NAME CHECKER) function(gen_mc_test_internal NAME CHECKER)
set(SUBTEST_NAME "${NAME}") set(SUBTEST_NAME "${NAME}")
@ -146,7 +163,7 @@ set_tests_properties(CTestTestMemcheckDummyValgrind
CTestTestMemcheckDummyValgrindPrePost CTestTestMemcheckDummyValgrindPrePost
CTestTestMemcheckDummyPurify CTestTestMemcheckDummyPurify
PROPERTIES PROPERTIES
PASS_REGULAR_EXPRESSION "${NORMAL_CTEST_OUTPUT}${BULLSEYE_MSG}$") PASS_REGULAR_EXPRESSION "${ctest_and_tool_outputs}$")
foreach (_pp Pre Post) foreach (_pp Pre Post)
string(TOLOWER ${_pp} _pp_lower) string(TOLOWER ${_pp} _pp_lower)
@ -157,7 +174,7 @@ endforeach ()
set_tests_properties(CTestTestMemcheckDummyValgrindIgnoreMemcheck set_tests_properties(CTestTestMemcheckDummyValgrindIgnoreMemcheck
PROPERTIES PROPERTIES
PASS_REGULAR_EXPRESSION "\n2/2 Test #2: RunCMakeAgain .*${NORMAL_CTEST_OUTPUT}${BULLSEYE_MSG}$") PASS_REGULAR_EXPRESSION "\n2/2 Test #2: RunCMakeAgain .*${ctest_and_tool_outputs}$")
set_tests_properties(CTestTestMemcheckDummyBC PROPERTIES set_tests_properties(CTestTestMemcheckDummyBC PROPERTIES
PASS_REGULAR_EXPRESSION "\n1/1 MemCheck #1: RunCMake \\.+ Passed +[0-9]+.[0-9]+ sec\n\n100% tests passed, 0 tests failed out of 1\n(.*\n)?Error parsing XML in stream at line 1: no element found\n") PASS_REGULAR_EXPRESSION "\n1/1 MemCheck #1: RunCMake \\.+ Passed +[0-9]+.[0-9]+ sec\n\n100% tests passed, 0 tests failed out of 1\n(.*\n)?Error parsing XML in stream at line 1: no element found\n")