From 1651dc96683282c0af8ef47973db9afa950d6bde Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 16 Dec 2014 13:50:30 -0500 Subject: Tests: Move CTestTestMemcheck cases into a RunCMake.CTestMemcheck test The CTestTestMemcheck test cases all try to check the ctest output with a regular expression. They fail intermittently due to ordering of the portions of the output that come from stdout and stderr being mixed. Convert all the test cases to use the RunCMake infrastructure to match stdout and stderr separately. --- Tests/CTestTestMemcheck/CMakeLists.txt | 249 --------------------- Tests/CTestTestMemcheck/CMakeLists.txt.in | 7 - Tests/CTestTestMemcheck/CTestConfig.cmake.in | 9 - Tests/CTestTestMemcheck/test.cmake.in | 26 --- Tests/CTestTestMemcheck/testAddressSanitizer.cmake | 58 ----- Tests/CTestTestMemcheck/testLeakSanitizer.cmake | 47 ---- Tests/CTestTestMemcheck/testMemorySanitizer.cmake | 27 --- Tests/CTestTestMemcheck/testThreadSanitizer.cmake | 47 ---- .../testUndefinedBehaviorSanitizer.cmake | 21 -- Tests/RunCMake/CMakeLists.txt | 13 ++ Tests/RunCMake/CTestMemcheck/CMakeLists.txt.in | 7 + Tests/RunCMake/CTestMemcheck/CTestConfig.cmake.in | 9 + .../CTestMemcheck/DummyAddressSanitizer-result.txt | 1 + .../CTestMemcheck/DummyAddressSanitizer-stderr.txt | 2 + .../CTestMemcheck/DummyAddressSanitizer-stdout.txt | 2 + Tests/RunCMake/CTestMemcheck/DummyBC-result.txt | 1 + Tests/RunCMake/CTestMemcheck/DummyBC-stderr.txt | 1 + Tests/RunCMake/CTestMemcheck/DummyBC-stdout.txt | 3 + .../CTestMemcheck/DummyBCNoLogFile-result.txt | 1 + .../CTestMemcheck/DummyBCNoLogFile-stderr.txt | 3 + .../CTestMemcheck/DummyBCNoLogFile-stdout.txt | 3 + .../CTestMemcheck/DummyLeakSanitizer-result.txt | 1 + .../CTestMemcheck/DummyLeakSanitizer-stderr.txt | 2 + .../CTestMemcheck/DummyLeakSanitizer-stdout.txt | 3 + .../CTestMemcheck/DummyMemorySanitizer-result.txt | 1 + .../CTestMemcheck/DummyMemorySanitizer-stderr.txt | 2 + .../CTestMemcheck/DummyMemorySanitizer-stdout.txt | 2 + .../RunCMake/CTestMemcheck/DummyPurify-result.txt | 1 + .../RunCMake/CTestMemcheck/DummyPurify-stderr.txt | 3 + .../RunCMake/CTestMemcheck/DummyPurify-stdout.txt | 6 + .../CTestMemcheck/DummyPurifyNoLogFile-result.txt | 1 + .../CTestMemcheck/DummyPurifyNoLogFile-stderr.txt | 2 + .../CTestMemcheck/DummyPurifyNoLogFile-stdout.txt | 3 + .../CTestMemcheck/DummyThreadSanitizer-result.txt | 1 + .../CTestMemcheck/DummyThreadSanitizer-stderr.txt | 2 + .../CTestMemcheck/DummyThreadSanitizer-stdout.txt | 13 ++ .../DummyUndefinedBehaviorSanitizer-result.txt | 1 + .../DummyUndefinedBehaviorSanitizer-stderr.txt | 2 + .../DummyUndefinedBehaviorSanitizer-stdout.txt | 2 + .../CTestMemcheck/DummyValgrind-result.txt | 1 + .../CTestMemcheck/DummyValgrind-stderr.txt | 3 + .../CTestMemcheck/DummyValgrind-stdout.txt | 6 + .../DummyValgrindCustomOptions-result.txt | 1 + .../DummyValgrindCustomOptions-stderr.txt | 2 + .../DummyValgrindCustomOptions-stdout.txt | 6 + .../CTestMemcheck/DummyValgrindFailPost-result.txt | 1 + .../CTestMemcheck/DummyValgrindFailPost-stderr.txt | 3 + .../CTestMemcheck/DummyValgrindFailPost-stdout.txt | 6 + .../CTestMemcheck/DummyValgrindFailPre-result.txt | 1 + .../CTestMemcheck/DummyValgrindFailPre-stderr.txt | 3 + .../CTestMemcheck/DummyValgrindFailPre-stdout.txt | 1 + .../DummyValgrindIgnoreMemcheck-result.txt | 1 + .../DummyValgrindIgnoreMemcheck-stderr.txt | 3 + .../DummyValgrindIgnoreMemcheck-stdout.txt | 7 + .../DummyValgrindInvalidSupFile-result.txt | 1 + .../DummyValgrindInvalidSupFile-stderr.txt | 2 + .../DummyValgrindInvalidSupFile-stdout.txt | 1 + .../DummyValgrindNoLogFile-result.txt | 1 + .../DummyValgrindNoLogFile-stderr.txt | 2 + .../DummyValgrindNoLogFile-stdout.txt | 3 + .../CTestMemcheck/DummyValgrindPrePost-result.txt | 1 + .../CTestMemcheck/DummyValgrindPrePost-stderr.txt | 3 + .../CTestMemcheck/DummyValgrindPrePost-stdout.txt | 6 + .../DummyValgrindTwoTargets-result.txt | 1 + .../DummyValgrindTwoTargets-stderr.txt | 3 + .../DummyValgrindTwoTargets-stdout.txt | 8 + Tests/RunCMake/CTestMemcheck/NotExist-result.txt | 1 + Tests/RunCMake/CTestMemcheck/NotExist-stderr.txt | 1 + Tests/RunCMake/CTestMemcheck/NotExist-stdout.txt | 1 + Tests/RunCMake/CTestMemcheck/RunCMakeTest.cmake | 144 ++++++++++++ Tests/RunCMake/CTestMemcheck/Unknown-result.txt | 1 + Tests/RunCMake/CTestMemcheck/Unknown-stderr.txt | 2 + Tests/RunCMake/CTestMemcheck/Unknown-stdout.txt | 1 + Tests/RunCMake/CTestMemcheck/test.cmake.in | 24 ++ .../CTestMemcheck/testAddressSanitizer.cmake | 58 +++++ .../RunCMake/CTestMemcheck/testLeakSanitizer.cmake | 47 ++++ .../CTestMemcheck/testMemorySanitizer.cmake | 27 +++ .../CTestMemcheck/testThreadSanitizer.cmake | 47 ++++ .../testUndefinedBehaviorSanitizer.cmake | 21 ++ 79 files changed, 546 insertions(+), 491 deletions(-) delete mode 100644 Tests/CTestTestMemcheck/CMakeLists.txt.in delete mode 100644 Tests/CTestTestMemcheck/CTestConfig.cmake.in delete mode 100644 Tests/CTestTestMemcheck/test.cmake.in delete mode 100644 Tests/CTestTestMemcheck/testAddressSanitizer.cmake delete mode 100644 Tests/CTestTestMemcheck/testLeakSanitizer.cmake delete mode 100644 Tests/CTestTestMemcheck/testMemorySanitizer.cmake delete mode 100644 Tests/CTestTestMemcheck/testThreadSanitizer.cmake delete mode 100644 Tests/CTestTestMemcheck/testUndefinedBehaviorSanitizer.cmake create mode 100644 Tests/RunCMake/CTestMemcheck/CMakeLists.txt.in create mode 100644 Tests/RunCMake/CTestMemcheck/CTestConfig.cmake.in create mode 100644 Tests/RunCMake/CTestMemcheck/DummyAddressSanitizer-result.txt create mode 100644 Tests/RunCMake/CTestMemcheck/DummyAddressSanitizer-stderr.txt create mode 100644 Tests/RunCMake/CTestMemcheck/DummyAddressSanitizer-stdout.txt create mode 100644 Tests/RunCMake/CTestMemcheck/DummyBC-result.txt create mode 100644 Tests/RunCMake/CTestMemcheck/DummyBC-stderr.txt create mode 100644 Tests/RunCMake/CTestMemcheck/DummyBC-stdout.txt create mode 100644 Tests/RunCMake/CTestMemcheck/DummyBCNoLogFile-result.txt create mode 100644 Tests/RunCMake/CTestMemcheck/DummyBCNoLogFile-stderr.txt create mode 100644 Tests/RunCMake/CTestMemcheck/DummyBCNoLogFile-stdout.txt create mode 100644 Tests/RunCMake/CTestMemcheck/DummyLeakSanitizer-result.txt create mode 100644 Tests/RunCMake/CTestMemcheck/DummyLeakSanitizer-stderr.txt create mode 100644 Tests/RunCMake/CTestMemcheck/DummyLeakSanitizer-stdout.txt create mode 100644 Tests/RunCMake/CTestMemcheck/DummyMemorySanitizer-result.txt create mode 100644 Tests/RunCMake/CTestMemcheck/DummyMemorySanitizer-stderr.txt create mode 100644 Tests/RunCMake/CTestMemcheck/DummyMemorySanitizer-stdout.txt create mode 100644 Tests/RunCMake/CTestMemcheck/DummyPurify-result.txt create mode 100644 Tests/RunCMake/CTestMemcheck/DummyPurify-stderr.txt create mode 100644 Tests/RunCMake/CTestMemcheck/DummyPurify-stdout.txt create mode 100644 Tests/RunCMake/CTestMemcheck/DummyPurifyNoLogFile-result.txt create mode 100644 Tests/RunCMake/CTestMemcheck/DummyPurifyNoLogFile-stderr.txt create mode 100644 Tests/RunCMake/CTestMemcheck/DummyPurifyNoLogFile-stdout.txt create mode 100644 Tests/RunCMake/CTestMemcheck/DummyThreadSanitizer-result.txt create mode 100644 Tests/RunCMake/CTestMemcheck/DummyThreadSanitizer-stderr.txt create mode 100644 Tests/RunCMake/CTestMemcheck/DummyThreadSanitizer-stdout.txt create mode 100644 Tests/RunCMake/CTestMemcheck/DummyUndefinedBehaviorSanitizer-result.txt create mode 100644 Tests/RunCMake/CTestMemcheck/DummyUndefinedBehaviorSanitizer-stderr.txt create mode 100644 Tests/RunCMake/CTestMemcheck/DummyUndefinedBehaviorSanitizer-stdout.txt create mode 100644 Tests/RunCMake/CTestMemcheck/DummyValgrind-result.txt create mode 100644 Tests/RunCMake/CTestMemcheck/DummyValgrind-stderr.txt create mode 100644 Tests/RunCMake/CTestMemcheck/DummyValgrind-stdout.txt create mode 100644 Tests/RunCMake/CTestMemcheck/DummyValgrindCustomOptions-result.txt create mode 100644 Tests/RunCMake/CTestMemcheck/DummyValgrindCustomOptions-stderr.txt create mode 100644 Tests/RunCMake/CTestMemcheck/DummyValgrindCustomOptions-stdout.txt create mode 100644 Tests/RunCMake/CTestMemcheck/DummyValgrindFailPost-result.txt create mode 100644 Tests/RunCMake/CTestMemcheck/DummyValgrindFailPost-stderr.txt create mode 100644 Tests/RunCMake/CTestMemcheck/DummyValgrindFailPost-stdout.txt create mode 100644 Tests/RunCMake/CTestMemcheck/DummyValgrindFailPre-result.txt create mode 100644 Tests/RunCMake/CTestMemcheck/DummyValgrindFailPre-stderr.txt create mode 100644 Tests/RunCMake/CTestMemcheck/DummyValgrindFailPre-stdout.txt create mode 100644 Tests/RunCMake/CTestMemcheck/DummyValgrindIgnoreMemcheck-result.txt create mode 100644 Tests/RunCMake/CTestMemcheck/DummyValgrindIgnoreMemcheck-stderr.txt create mode 100644 Tests/RunCMake/CTestMemcheck/DummyValgrindIgnoreMemcheck-stdout.txt create mode 100644 Tests/RunCMake/CTestMemcheck/DummyValgrindInvalidSupFile-result.txt create mode 100644 Tests/RunCMake/CTestMemcheck/DummyValgrindInvalidSupFile-stderr.txt create mode 100644 Tests/RunCMake/CTestMemcheck/DummyValgrindInvalidSupFile-stdout.txt create mode 100644 Tests/RunCMake/CTestMemcheck/DummyValgrindNoLogFile-result.txt create mode 100644 Tests/RunCMake/CTestMemcheck/DummyValgrindNoLogFile-stderr.txt create mode 100644 Tests/RunCMake/CTestMemcheck/DummyValgrindNoLogFile-stdout.txt create mode 100644 Tests/RunCMake/CTestMemcheck/DummyValgrindPrePost-result.txt create mode 100644 Tests/RunCMake/CTestMemcheck/DummyValgrindPrePost-stderr.txt create mode 100644 Tests/RunCMake/CTestMemcheck/DummyValgrindPrePost-stdout.txt create mode 100644 Tests/RunCMake/CTestMemcheck/DummyValgrindTwoTargets-result.txt create mode 100644 Tests/RunCMake/CTestMemcheck/DummyValgrindTwoTargets-stderr.txt create mode 100644 Tests/RunCMake/CTestMemcheck/DummyValgrindTwoTargets-stdout.txt create mode 100644 Tests/RunCMake/CTestMemcheck/NotExist-result.txt create mode 100644 Tests/RunCMake/CTestMemcheck/NotExist-stderr.txt create mode 100644 Tests/RunCMake/CTestMemcheck/NotExist-stdout.txt create mode 100644 Tests/RunCMake/CTestMemcheck/RunCMakeTest.cmake create mode 100644 Tests/RunCMake/CTestMemcheck/Unknown-result.txt create mode 100644 Tests/RunCMake/CTestMemcheck/Unknown-stderr.txt create mode 100644 Tests/RunCMake/CTestMemcheck/Unknown-stdout.txt create mode 100644 Tests/RunCMake/CTestMemcheck/test.cmake.in create mode 100644 Tests/RunCMake/CTestMemcheck/testAddressSanitizer.cmake create mode 100644 Tests/RunCMake/CTestMemcheck/testLeakSanitizer.cmake create mode 100644 Tests/RunCMake/CTestMemcheck/testMemorySanitizer.cmake create mode 100644 Tests/RunCMake/CTestMemcheck/testThreadSanitizer.cmake create mode 100644 Tests/RunCMake/CTestMemcheck/testUndefinedBehaviorSanitizer.cmake diff --git a/Tests/CTestTestMemcheck/CMakeLists.txt b/Tests/CTestTestMemcheck/CMakeLists.txt index 2023e74..5d6319a 100644 --- a/Tests/CTestTestMemcheck/CMakeLists.txt +++ b/Tests/CTestTestMemcheck/CMakeLists.txt @@ -1,13 +1,3 @@ -REGEX_ESCAPE_STRING(CTEST_ESCAPED_CMAKE_CURRENT_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}") - -get_filename_component(CTEST_REALPATH_CMAKE_CURRENT_BINARY_DIR - "${CMAKE_CURRENT_BINARY_DIR}" REALPATH -) - -REGEX_ESCAPE_STRING(CTEST_ESCAPED_REALPATH_CMAKE_CURRENT_BINARY_DIR - "${CTEST_REALPATH_CMAKE_CURRENT_BINARY_DIR}" -) - foreach (_retval 0 1) configure_file("${CMAKE_CURRENT_SOURCE_DIR}/memtester.cxx.in" "${CMAKE_CURRENT_BINARY_DIR}/ret${_retval}.cxx" @ONLY) endforeach () @@ -35,245 +25,6 @@ target_link_libraries(memcheck_fail CMakeLib) # same filenames. add_subdirectory(NoLogDummyChecker) -if(APPLE) - # filter out additional messages by Guard Malloc integrated in Xcode - set(guard_malloc_msg "ctest\\([0-9]+\\) malloc: ") - set(guard_malloc_lines "(${guard_malloc_msg}[^\n]*\n)*") - set(guard_malloc_output "${guard_malloc_msg}|") -else() - set(guard_malloc_msg "") - 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) - set(SUBTEST_NAME "${NAME}") - set(CHECKER_COMMAND "${CHECKER}") - foreach(_file IN ITEMS CMakeLists.txt CTestConfig.cmake test.cmake) - configure_file("${CMAKE_CURRENT_SOURCE_DIR}/${_file}.in" - "${CMAKE_CURRENT_BINARY_DIR}/${NAME}/${_file}" @ONLY) - endforeach() - add_test(NAME CTestTestMemcheck${NAME} - COMMAND ${CMAKE_CTEST_COMMAND} - -C $ - -S "${CMAKE_CURRENT_BINARY_DIR}/${NAME}/test.cmake" -V - --output-log "${CMAKE_CURRENT_BINARY_DIR}/${NAME}/testOutput.log" - ${ARGN} - ) -endfunction(gen_mc_test_internal) - -function(gen_mc_test NAME CHECKER) - gen_mc_test_internal(${NAME} "${CHECKER}" - -D PSEUDO_BC=$ - -D PSEUDO_PURIFY=$ - -D PSEUDO_VALGRIND=$ - -D ERROR_COMMAND=$ - ${ARGN} - ) -endfunction(gen_mc_test) - -function(gen_mcnl_test NAME CHECKER) - gen_mc_test_internal(${NAME} ${CHECKER} - -D PSEUDO_BC=$ - -D PSEUDO_PURIFY=$ - -D PSEUDO_VALGRIND=$ - ${ARGN} - ) - set_tests_properties(CTestTestMemcheck${NAME} - PROPERTIES - PASS_REGULAR_EXPRESSION "\nCannot find memory tester output file: ${CTEST_ESCAPED_CMAKE_CURRENT_BINARY_DIR}/${NAME}/Testing/Temporary/MemoryChecker.1.log\n(.*\n)?Error in read script: ${CTEST_ESCAPED_CMAKE_CURRENT_BINARY_DIR}/${NAME}/test.cmake\n") -endfunction(gen_mcnl_test) - -unset(CTEST_EXTRA_CONFIG) -unset(CTEST_EXTRA_CODE) -unset(CMAKELISTS_EXTRA_CODE) - -#----------------------------------------------------------------------------- -# add ThreadSanitizer test -set(CTEST_EXTRA_CODE -"set(CTEST_MEMORYCHECK_COMMAND_OPTIONS \"report_bugs=1 history_size=5 exitcode=55\") -") -set(CMAKELISTS_EXTRA_CODE -"add_test(NAME TestSan COMMAND \"${CMAKE_COMMAND}\" --P \"${CMAKE_CURRENT_SOURCE_DIR}/testThreadSanitizer.cmake\") -") -gen_mc_test_internal(DummyThreadSanitizer "" -DMEMCHECK_TYPE=ThreadSanitizer) -set_tests_properties(CTestTestMemcheckDummyThreadSanitizer PROPERTIES - PASS_REGULAR_EXPRESSION - ".*Memory checking results:.*data race.* - 1.*data race on vptr .ctor/dtor vs virtual call. - 1.*heap-use-after-free - 1.*thread leak - 1.*destroy of a locked mutex - 1.*double lock of a mutex - 1.*unlock of an unlocked mutex .or by a wrong thread. - 1.*read lock of a write locked mutex - 1.*read unlock of a write locked mutex - 1.*signal-unsafe call inside of a signal - 1.*signal handler spoils errno - 1.*lock-order-inversion .potential deadlock. - 1.*") -set(CMAKELISTS_EXTRA_CODE ) -set(CTEST_EXTRA_CODE) - -#----------------------------------------------------------------------------- -# add LeakSanitizer test -set(CTEST_EXTRA_CODE -"set(CTEST_MEMORYCHECK_SANITIZER_OPTIONS \"simulate_sanitizer=1 report_bugs=1 history_size=5 exitcode=55\") -") -set(CMAKELISTS_EXTRA_CODE -"add_test(NAME TestSan COMMAND \"${CMAKE_COMMAND}\" --P \"${CMAKE_CURRENT_SOURCE_DIR}/testLeakSanitizer.cmake\") -") -gen_mc_test_internal(DummyLeakSanitizer "" -DMEMCHECK_TYPE=AddressSanitizer) -set(CMAKELISTS_EXTRA_CODE ) -set(CTEST_EXTRA_CODE) -set_tests_properties(CTestTestMemcheckDummyLeakSanitizer PROPERTIES - PASS_REGULAR_EXPRESSION - ".*Memory checking results:.*Direct leak - 2.*Indirect leak - 1.*") - -#----------------------------------------------------------------------------- -# add AddressSanitizer test -set(CTEST_EXTRA_CODE -"set(CTEST_MEMORYCHECK_SANITIZER_OPTIONS \"simulate_sanitizer=1 report_bugs=1 history_size=5 exitcode=55\") -") -set(CMAKELISTS_EXTRA_CODE -"add_test(NAME TestSan COMMAND \"${CMAKE_COMMAND}\" --P \"${CMAKE_CURRENT_SOURCE_DIR}/testAddressSanitizer.cmake\") -") -gen_mc_test_internal(DummyAddressSanitizer "" -DMEMCHECK_TYPE=AddressSanitizer) -set(CMAKELISTS_EXTRA_CODE ) -set(CTEST_EXTRA_CODE) -set_tests_properties(CTestTestMemcheckDummyAddressSanitizer PROPERTIES - PASS_REGULAR_EXPRESSION - ".*Memory checking results:.*heap-buffer-overflow - 1.*") - -#----------------------------------------------------------------------------- -# add MemorySanitizer test -set(CTEST_EXTRA_CODE -"set(CTEST_MEMORYCHECK_COMMAND_OPTIONS \"simulate_sanitizer=1 report_bugs=1 history_size=5 exitcode=55\") -") - -set(CMAKELISTS_EXTRA_CODE -"add_test(NAME TestSan COMMAND \"${CMAKE_COMMAND}\" --P \"${CMAKE_CURRENT_SOURCE_DIR}/testMemorySanitizer.cmake\") -") -gen_mc_test_internal(DummyMemorySanitizer "" -DMEMCHECK_TYPE=MemorySanitizer) -set(CMAKELISTS_EXTRA_CODE ) -set(CTEST_EXTRA_CODE) -set_tests_properties(CTestTestMemcheckDummyMemorySanitizer PROPERTIES - PASS_REGULAR_EXPRESSION - ".*Memory checking results:.*use-of-uninitialized-value - 1.*") - -#----------------------------------------------------------------------------- -# add UndefinedBehaviorSanitizer test -set(CTEST_EXTRA_CODE -"set(CTEST_MEMORYCHECK_SANITIZER_OPTIONS \"simulate_sanitizer=1\") -") - -set(CMAKELISTS_EXTRA_CODE -"add_test(NAME TestSan COMMAND \"${CMAKE_COMMAND}\" --P \"${CMAKE_CURRENT_SOURCE_DIR}/testUndefinedBehaviorSanitizer.cmake\") -") -gen_mc_test_internal(DummyUndefinedBehaviorSanitizer "" -DMEMCHECK_TYPE=UndefinedBehaviorSanitizer) -set(CMAKELISTS_EXTRA_CODE ) -set(CTEST_EXTRA_CODE) -set_tests_properties(CTestTestMemcheckDummyUndefinedBehaviorSanitizer PROPERTIES - PASS_REGULAR_EXPRESSION - ".*Memory checking results:.*left shift of negative value -256 - 1.*") - -#----------------------------------------------------------------------------- - -gen_mc_test(DummyPurify "\${PSEUDO_PURIFY}") -gen_mc_test(DummyValgrind "\${PSEUDO_VALGRIND}") -gen_mc_test(DummyBC "\${PSEUDO_BC}") -gen_mcnl_test(DummyPurifyNoLogfile "\${PSEUDO_PURIFY}") -gen_mcnl_test(DummyValgrindNoLogfile "\${PSEUDO_VALGRIND}") -gen_mcnl_test(DummyBCNoLogfile "\${PSEUDO_BC}") - -set(CTEST_EXTRA_CODE "string(REPLACE \" \" \"\\\\ \" PRE_POST_COMMAND \"\${CTEST_MEMORYCHECK_COMMAND}\") - -set(CTEST_CUSTOM_PRE_MEMCHECK \"\${PRE_POST_COMMAND} pre command\") -set(CTEST_CUSTOM_POST_MEMCHECK \"\${PRE_POST_COMMAND} post command \") -") -gen_mc_test(DummyValgrindPrePost "\${PSEUDO_VALGRIND}") - -set(CTEST_EXTRA_CODE "set(CTEST_CUSTOM_POST_MEMCHECK \"\${ERROR_COMMAND}\")") -gen_mc_test(DummyValgrindFailPost "\${PSEUDO_VALGRIND}") - -set(CTEST_EXTRA_CODE "set(CTEST_CUSTOM_PRE_MEMCHECK \"\${ERROR_COMMAND}\")") -gen_mc_test(DummyValgrindFailPre "\${PSEUDO_VALGRIND}") - -unset(CTEST_EXTRA_CODE) -set(CTEST_EXTRA_CONFIG "set(CTEST_CUSTOM_MEMCHECK_IGNORE RunCMakeAgain)\n") -set(CMAKELISTS_EXTRA_CODE "add_test(NAME RunCMakeAgain COMMAND \"\${CMAKE_COMMAND}\" --version)") -gen_mc_test(DummyValgrindIgnoreMemcheck "\${PSEUDO_VALGRIND}") - -unset(CTEST_EXTRA_CONFIG) -gen_mc_test(DummyValgrindTwoTargets "\${PSEUDO_VALGRIND}" "-VV") - -set(CTEST_EXTRA_CONFIG "set(CTEST_MEMORYCHECK_SUPPRESSIONS_FILE \"\${CMAKE_CURRENT_BINARY_DIR}/does-not-exist\")") -unset(CMAKELISTS_EXTRA_CODE) -gen_mc_test(DummyValgrindInvalidSupFile "\${PSEUDO_VALGRIND}") - -# CTest will add the logfile option before any custom options. Set the logfile -# again, this time to an empty string. This will cause the logfile to be -# missing, which will be the prove for us that the custom option is indeed used. -set(CTEST_EXTRA_CONFIG "set(CTEST_MEMORYCHECK_COMMAND_OPTIONS \"--log-file=\")") -gen_mc_test(DummyValgrindCustomOptions "\${PSEUDO_VALGRIND}") - -unset(CTEST_EXTRA_CONFIG) -gen_mc_test(NotExist "\${CTEST_BINARY_DIRECTORY}/no-memcheck-exe") - -gen_mc_test(Unknown "${CMAKE_COMMAND}") - -string(REPLACE "\\" "\\\\" CMAKE_COMMAND_ESCAPED "${CMAKE_COMMAND}") -string(REPLACE "(" "\\(" CMAKE_COMMAND_ESCAPED "${CMAKE_COMMAND_ESCAPED}") -string(REPLACE ")" "\\)" CMAKE_COMMAND_ESCAPED "${CMAKE_COMMAND_ESCAPED}") -string(REPLACE "+" "\\+" CMAKE_COMMAND_ESCAPED "${CMAKE_COMMAND_ESCAPED}") - -set_tests_properties(CTestTestMemcheckUnknown PROPERTIES - PASS_REGULAR_EXPRESSION "Do not understand memory checker: ${CMAKE_COMMAND_ESCAPED}\n(.*\n)?Error in read script: ${CTEST_ESCAPED_CMAKE_CURRENT_BINARY_DIR}/Unknown/test.cmake\n") - -set_tests_properties(CTestTestMemcheckNotExist PROPERTIES - PASS_REGULAR_EXPRESSION "Memory checker \\(MemoryCheckCommand\\) not set, or cannot find the specified program.") - -# It is a valid result if valgrind does not output any files (can e.g. happen -# if you have not compiled in debug mode), so these tests will not fail. -set_tests_properties(CTestTestMemcheckDummyValgrind - CTestTestMemcheckDummyValgrindPrePost - CTestTestMemcheckDummyPurify - PROPERTIES - PASS_REGULAR_EXPRESSION "${ctest_and_tool_outputs}$") - -foreach (_pp Pre Post) - string(TOLOWER ${_pp} _pp_lower) - set_tests_properties(CTestTestMemcheckDummyValgrindFail${_pp} - PROPERTIES - PASS_REGULAR_EXPRESSION "\nProblem running command: ${CTEST_ESCAPED_CMAKE_CURRENT_BINARY_DIR}[^\n]*fail[^\n]*\n(.*\n)?Problem executing ${_pp_lower}-memcheck command\\(s\\\).\n(.*\n)?Error in read script: ${CTEST_ESCAPED_CMAKE_CURRENT_BINARY_DIR}/DummyValgrindFail${_pp}/test.cmake\n") -endforeach () - -set_tests_properties(CTestTestMemcheckDummyValgrindIgnoreMemcheck - PROPERTIES - PASS_REGULAR_EXPRESSION "\n2/2 Test #2: RunCMakeAgain .*${ctest_and_tool_outputs}$") - -set_tests_properties(CTestTestMemcheckDummyBC PROPERTIES - PASS_REGULAR_EXPRESSION "\n1/1 MemCheck #1: RunCMake \\.+ Passed +[0-9]+.[0-9]+ sec\n${guard_malloc_lines}\n100% tests passed, 0 tests failed out of 1\n(.*\n)?Error parsing XML in stream at line 1: no element found\n") - -set_tests_properties(CTestTestMemcheckDummyValgrindInvalidSupFile PROPERTIES - PASS_REGULAR_EXPRESSION "\nCannot find memory checker suppression file: ${CTEST_ESCAPED_REALPATH_CMAKE_CURRENT_BINARY_DIR}/does-not-exist\n") - -set_tests_properties(CTestTestMemcheckDummyValgrindCustomOptions PROPERTIES - PASS_REGULAR_EXPRESSION "\nCannot find memory tester output file: ${CTEST_ESCAPED_CMAKE_CURRENT_BINARY_DIR}/DummyValgrindCustomOptions/Testing/Temporary/MemoryChecker.1.log\n(.*\n)?Error in read script: ${CMAKE_CURRENT_BINARY_DIR}/DummyValgrindCustomOptions/test.cmake\n") - -set_tests_properties(CTestTestMemcheckDummyValgrindTwoTargets PROPERTIES - PASS_REGULAR_EXPRESSION - "\nMemory check project ${CTEST_ESCAPED_CMAKE_CURRENT_BINARY_DIR}/DummyValgrindTwoTargets\n.*\n *Start 1: RunCMake\n(.*\n)?Memory check command: .* \"--log-file=${CTEST_ESCAPED_CMAKE_CURRENT_BINARY_DIR}/DummyValgrindTwoTargets/Testing/Temporary/MemoryChecker.1.log\" \"-q\".*\n *Start 2: RunCMakeAgain\n(.*\n)?Memory check command: .* \"--log-file=${CTEST_ESCAPED_CMAKE_CURRENT_BINARY_DIR}/DummyValgrindTwoTargets/Testing/Temporary/MemoryChecker.2.log\" \"-q\".*\n") - - # Xcode 2.x forgets to create the output directory before linking # the individual architectures. if(CMAKE_OSX_ARCHITECTURES AND XCODE AND NOT "${XCODE_VERSION}" MATCHES "^[^12]") diff --git a/Tests/CTestTestMemcheck/CMakeLists.txt.in b/Tests/CTestTestMemcheck/CMakeLists.txt.in deleted file mode 100644 index d15d148..0000000 --- a/Tests/CTestTestMemcheck/CMakeLists.txt.in +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 2.8.9) -project(CTestTestMemcheck@SUBTEST_NAME@ NONE) -include(CTest) - -add_test(NAME RunCMake COMMAND "${CMAKE_COMMAND}" --version) - -@CMAKELISTS_EXTRA_CODE@ diff --git a/Tests/CTestTestMemcheck/CTestConfig.cmake.in b/Tests/CTestTestMemcheck/CTestConfig.cmake.in deleted file mode 100644 index 19c76c2..0000000 --- a/Tests/CTestTestMemcheck/CTestConfig.cmake.in +++ /dev/null @@ -1,9 +0,0 @@ -set (CTEST_PROJECT_NAME "CTestTestMemcheck@SUBTEST_NAME@") -set (CTEST_NIGHTLY_START_TIME "21:00:00 EDT") -set (CTEST_DART_SERVER_VERSION "2") -set(CTEST_DROP_METHOD "http") -set(CTEST_DROP_SITE "open.cdash.org") -set(CTEST_DROP_LOCATION "/submit.php?project=PublicDashboard") -set(CTEST_DROP_SITE_CDASH TRUE) - -@CTEST_EXTRA_CONFIG@ diff --git a/Tests/CTestTestMemcheck/test.cmake.in b/Tests/CTestTestMemcheck/test.cmake.in deleted file mode 100644 index f2ffd06..0000000 --- a/Tests/CTestTestMemcheck/test.cmake.in +++ /dev/null @@ -1,26 +0,0 @@ -cmake_minimum_required(VERSION 2.8.9) - -# Settings: -set(CTEST_DASHBOARD_ROOT "@CMAKE_CURRENT_BINARY_DIR@") -set(CTEST_SITE "@SITE@") -set(CTEST_BUILD_NAME "CTestTest-@BUILDNAME@-Memcheck@SUBTEST_NAME@") - -set(CTEST_SOURCE_DIRECTORY "@CMAKE_CURRENT_BINARY_DIR@/@SUBTEST_NAME@") -set(CTEST_BINARY_DIRECTORY "@CMAKE_CURRENT_BINARY_DIR@/@SUBTEST_NAME@") -set(CTEST_CVS_COMMAND "@CVSCOMMAND@") -set(CTEST_CMAKE_GENERATOR "@CMAKE_GENERATOR@") -set(CTEST_CMAKE_GENERATOR_PLATFORM "@CMAKE_GENERATOR_PLATFORM@") -set(CTEST_CMAKE_GENERATOR_TOOLSET "@CMAKE_GENERATOR_TOOLSET@") -set(CTEST_BUILD_CONFIGURATION "$ENV{CMAKE_CONFIG_TYPE}") -set(CTEST_COVERAGE_COMMAND "@COVERAGE_COMMAND@") -set(CTEST_NOTES_FILES "${CTEST_SCRIPT_DIRECTORY}/${CTEST_SCRIPT_NAME}") - -set(CTEST_MEMORYCHECK_COMMAND "@CHECKER_COMMAND@") -set(CTEST_MEMORYCHECK_TYPE "${MEMCHECK_TYPE}") - -@CTEST_EXTRA_CODE@ - -CTEST_START(Experimental) -CTEST_CONFIGURE(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res) -CTEST_TEST(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res) -CTEST_MEMCHECK(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res) diff --git a/Tests/CTestTestMemcheck/testAddressSanitizer.cmake b/Tests/CTestTestMemcheck/testAddressSanitizer.cmake deleted file mode 100644 index 3082e4b..0000000 --- a/Tests/CTestTestMemcheck/testAddressSanitizer.cmake +++ /dev/null @@ -1,58 +0,0 @@ -# this file simulates a program that has been built with address sanitizer -# options - -message("ASAN_OPTIONS = [$ENV{ASAN_OPTIONS}]") -string(REGEX REPLACE ".*log_path=\"([^\"]*)\".*" "\\1" LOG_FILE "$ENV{ASAN_OPTIONS}") -message("LOG_FILE=[${LOG_FILE}]") - -# if we are not asked to simulate address sanitizer don't do it -if(NOT "$ENV{ASAN_OPTIONS}]" MATCHES "simulate_sanitizer.1") - return() -endif() -# clear the log file -file(REMOVE "${LOG_FILE}.2343") - -# create an example error from address santizer - -file(APPEND "${LOG_FILE}.2343" -"================================================================= -==19278== ERROR: AddressSanitizer: heap-buffer-overflow on address 0x60080000bffc at pc 0x4009f1 bp 0x7fff82de6520 sp 0x7fff82de6518 -WRITE of size 4 at 0x60080000bffc thread T0 - #0 0x4009f0 (/home/kitware/msan/a.out+0x4009f0) - #1 0x7f18b02c876c (/lib/x86_64-linux-gnu/libc-2.15.so+0x2176c) - #2 0x400858 (/home/kitware/msan/a.out+0x400858) -0x60080000bffc is located 4 bytes to the right of 40-byte region [0x60080000bfd0,0x60080000bff8) -allocated by thread T0 here: - #0 0x7f18b088f9ca (/usr/lib/x86_64-linux-gnu/libasan.so.0.0.0+0x119ca) - #1 0x4009a2 (/home/kitware/msan/a.out+0x4009a2) - #2 0x7f18b02c876c (/lib/x86_64-linux-gnu/libc-2.15.so+0x2176c) -Shadow bytes around the buggy address: - 0x0c017fff97a0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa - 0x0c017fff97b0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa - 0x0c017fff97c0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa - 0x0c017fff97d0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa - 0x0c017fff97e0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa -=>0x0c017fff97f0: fa fa fa fa fa fa fa fa fa fa 00 00 00 00 00[fa] - 0x0c017fff9800:fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa - 0x0c017fff9810: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa - 0x0c017fff9820: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa - 0x0c017fff9830: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa - 0x0c017fff9840: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa -Shadow byte legend (one shadow byte represents 8 application bytes): - Addressable: 00 - Partially addressable: 01 02 03 04 05 06 07 - Heap left redzone: fa - Heap righ redzone: fb - Freed Heap region: fd - Stack left redzone: f1 - Stack mid redzone: f2 - Stack right redzone: f3 - Stack partial redzone: f4 - Stack after return: f5 - Stack use after scope: f8 - Global redzone: f9 - Global init order: f6 - Poisoned by user: f7 - ASan internal: fe -==19278== ABORTING -") diff --git a/Tests/CTestTestMemcheck/testLeakSanitizer.cmake b/Tests/CTestTestMemcheck/testLeakSanitizer.cmake deleted file mode 100644 index 02030be..0000000 --- a/Tests/CTestTestMemcheck/testLeakSanitizer.cmake +++ /dev/null @@ -1,47 +0,0 @@ -# this file simulates a program that has been built with thread sanitizer -# options - -message("ASAN_OPTIONS = [$ENV{ASAN_OPTIONS}]") -string(REGEX REPLACE ".*log_path=\"([^\"]*)\".*" "\\1" LOG_FILE "$ENV{ASAN_OPTIONS}") -message("LOG_FILE=[${LOG_FILE}]") -# if we are not asked to simulate leak sanitizer don't do it -if(NOT "$ENV{ASAN_OPTIONS}]" MATCHES "simulate_sanitizer.1") - return() -endif() - -# clear the log file -file(REMOVE "${LOG_FILE}.2343") -file(REMOVE "${LOG_FILE}.2344") - -# create an error of each type of thread santizer -# these names come from tsan_report.cc in llvm - -file(APPEND "${LOG_FILE}.2343" -"================================================================= -==25308==ERROR: LeakSanitizer: detected memory leaks - -Direct leak of 4360 byte(s) in 1 object(s) allocated from: - #0 0x46c669 in operator new[](unsigned long) (/home/kitware/msan/a.out+0x46c669) - #1 0x4823b4 in main /home/kitware/msan/memcheck.cxx:12 - #2 0x7fa72bee476c in __libc_start_main /build/buildd/eglibc-2.15/csu/libc-start.c:226 - -SUMMARY: AddressSanitizer: 4436 byte(s) leaked in 2 allocation(s). -") -file(APPEND "${LOG_FILE}.2342" -"================================================================= -==25308==ERROR: LeakSanitizer: detected memory leaks - -Direct leak of 76 byte(s) in 1 object(s) allocated from: - #0 0x46c669 in operator new[](unsigned long) (/home/kitware/msan/a.out+0x46c669) - #1 0x4821b8 in foo() /home/kitware/msan/memcheck.cxx:4 - #2 0x4823f2 in main /home/kitware/msan/memcheck.cxx:14 - #3 0x7fa72bee476c in __libc_start_main /build/buildd/eglibc-2.15/csu/libc-start.c:226 - -Indirect leak of 76 byte(s) in 1 object(s) allocated from: - #0 0x46c669 in operator new[](unsigned long) (/home/kitware/msan/a.out+0x46c669) - #1 0x4821b8 in foo() /home/kitware/msan/memcheck.cxx:4 - #2 0x4823f2 in main /home/kitware/msan/memcheck.cxx:14 - #3 0x7fa72bee476c in __libc_start_main /build/buildd/eglibc-2.15/csu/libc-start.c:226 - -SUMMARY: AddressSanitizer: 4436 byte(s) leaked in 2 allocation(s). -") diff --git a/Tests/CTestTestMemcheck/testMemorySanitizer.cmake b/Tests/CTestTestMemcheck/testMemorySanitizer.cmake deleted file mode 100644 index c87af9a..0000000 --- a/Tests/CTestTestMemcheck/testMemorySanitizer.cmake +++ /dev/null @@ -1,27 +0,0 @@ -# this file simulates a program that has been built with thread sanitizer -# options - -message("MSAN_OPTIONS = [$ENV{MSAN_OPTIONS}]") -string(REGEX REPLACE ".*log_path=\"([^\"]*)\".*" "\\1" LOG_FILE "$ENV{MSAN_OPTIONS}") -message("LOG_FILE=[${LOG_FILE}]") - -# if we are not asked to simulate address sanitizer don't do it -if(NOT "$ENV{MSAN_OPTIONS}]" MATCHES "simulate_sanitizer.1") - return() -endif() -# clear the log file -file(REMOVE "${LOG_FILE}.2343") - -# create an error of each type of thread santizer -# these names come from tsan_report.cc in llvm - -file(APPEND "${LOG_FILE}.2343" -"================================================================= -==28423== WARNING: MemorySanitizer: use-of-uninitialized-value - #0 0x7f4364210dd9 in main (/home/kitware/msan/msan-bin/umr+0x7bdd9) - #1 0x7f4362d9376c in __libc_start_main /build/buildd/eglibc-2.15/csu/libc-start.c:226 - #2 0x7f4364210b0c in _start (/home/kitware/msan/msan-bin/umr+0x7bb0c) - -SUMMARY: MemorySanitizer: use-of-uninitialized-value ??:0 main -Exiting -") diff --git a/Tests/CTestTestMemcheck/testThreadSanitizer.cmake b/Tests/CTestTestMemcheck/testThreadSanitizer.cmake deleted file mode 100644 index d591931..0000000 --- a/Tests/CTestTestMemcheck/testThreadSanitizer.cmake +++ /dev/null @@ -1,47 +0,0 @@ -# this file simulates a program that has been built with thread sanitizer -# options - -message("TSAN_OPTIONS = [$ENV{TSAN_OPTIONS}]") -string(REGEX REPLACE ".*log_path=\"([^\"]*)\".*" "\\1" LOG_FILE "$ENV{TSAN_OPTIONS}") -message("LOG_FILE=[${LOG_FILE}]") - -set(error_types - "data race" - "data race on vptr (ctor/dtor vs virtual call)" - "heap-use-after-free" - "thread leak" - "destroy of a locked mutex" - "double lock of a mutex" - "unlock of an unlocked mutex (or by a wrong thread)" - "read lock of a write locked mutex" - "read unlock of a write locked mutex" - "signal-unsafe call inside of a signal" - "signal handler spoils errno" - "lock-order-inversion (potential deadlock)" - ) - -# clear the log file -file(REMOVE "${LOG_FILE}.2343") - -# create an error of each type of thread santizer -# these names come from tsan_report.cc in llvm -foreach(error_type ${error_types} ) - - file(APPEND "${LOG_FILE}.2343" -"================== -WARNING: ThreadSanitizer: ${error_type} (pid=27978) - Write of size 4 at 0x7fe017ce906c by thread T1: - #0 Thread1 ??:0 (exe+0x000000000bb0) - #1 :0 (libtsan.so.0+0x00000001b279) - - Previous write of size 4 at 0x7fe017ce906c by main thread: - #0 main ??:0 (exe+0x000000000c3c) - - Thread T1 (tid=27979, running) created by main thread at: - #0 :0 (libtsan.so.0+0x00000001ed7b) - #1 main ??:0 (exe+0x000000000c2c) - -SUMMARY: ThreadSanitizer: ${error_type} ??:0 Thread1 -================== -") -endforeach() diff --git a/Tests/CTestTestMemcheck/testUndefinedBehaviorSanitizer.cmake b/Tests/CTestTestMemcheck/testUndefinedBehaviorSanitizer.cmake deleted file mode 100644 index 8ef3c0a..0000000 --- a/Tests/CTestTestMemcheck/testUndefinedBehaviorSanitizer.cmake +++ /dev/null @@ -1,21 +0,0 @@ -# this file simulates a program that has been built with undefined behavior -# sanitizer options - -message("UBSAN_OPTIONS = [$ENV{UBSAN_OPTIONS}]") -string(REGEX REPLACE ".*log_path=\"([^\"]*)\".*" "\\1" LOG_FILE "$ENV{UBSAN_OPTIONS}") -message("LOG_FILE=[${LOG_FILE}]") - -# if we are not asked to simulate address sanitizer don't do it -if(NOT "$ENV{UBSAN_OPTIONS}]" MATCHES "simulate_sanitizer.1") - return() -endif() -# clear the log file -file(REMOVE "${LOG_FILE}.2343") - -# create an error like undefined behavior santizer creates; -# these names come from ubsan_diag.cc and ubsan_handlers.cc -# in llvm - -file(APPEND "${LOG_FILE}.2343" -": runtime error: left shift of negative value -256 -") diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index e74eadd..b5e41d9 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -52,6 +52,19 @@ add_RunCMake_test(CMP0053) add_RunCMake_test(CMP0054) add_RunCMake_test(CMP0055) add_RunCMake_test(CTest) + +if(NOT CMake_TEST_EXTERNAL_CMAKE) + add_RunCMake_test(CTestMemcheck + -DPSEUDO_BC=$ + -DPSEUDO_PURIFY=$ + -DPSEUDO_VALGRIND=$ + -DPSEUDO_BC_NOLOG=$ + -DPSEUDO_PURIFY_NOLOG=$ + -DPSEUDO_VALGRIND_NOLOG=$ + -DMEMCHECK_FAIL=$ + ) +endif() + if(UNIX AND "${CMAKE_GENERATOR}" MATCHES "Unix Makefiles|Ninja") add_RunCMake_test(CompilerChange) endif() diff --git a/Tests/RunCMake/CTestMemcheck/CMakeLists.txt.in b/Tests/RunCMake/CTestMemcheck/CMakeLists.txt.in new file mode 100644 index 0000000..d15d148 --- /dev/null +++ b/Tests/RunCMake/CTestMemcheck/CMakeLists.txt.in @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 2.8.9) +project(CTestTestMemcheck@SUBTEST_NAME@ NONE) +include(CTest) + +add_test(NAME RunCMake COMMAND "${CMAKE_COMMAND}" --version) + +@CMAKELISTS_EXTRA_CODE@ diff --git a/Tests/RunCMake/CTestMemcheck/CTestConfig.cmake.in b/Tests/RunCMake/CTestMemcheck/CTestConfig.cmake.in new file mode 100644 index 0000000..19c76c2 --- /dev/null +++ b/Tests/RunCMake/CTestMemcheck/CTestConfig.cmake.in @@ -0,0 +1,9 @@ +set (CTEST_PROJECT_NAME "CTestTestMemcheck@SUBTEST_NAME@") +set (CTEST_NIGHTLY_START_TIME "21:00:00 EDT") +set (CTEST_DART_SERVER_VERSION "2") +set(CTEST_DROP_METHOD "http") +set(CTEST_DROP_SITE "open.cdash.org") +set(CTEST_DROP_LOCATION "/submit.php?project=PublicDashboard") +set(CTEST_DROP_SITE_CDASH TRUE) + +@CTEST_EXTRA_CONFIG@ diff --git a/Tests/RunCMake/CTestMemcheck/DummyAddressSanitizer-result.txt b/Tests/RunCMake/CTestMemcheck/DummyAddressSanitizer-result.txt new file mode 100644 index 0000000..b57e2de --- /dev/null +++ b/Tests/RunCMake/CTestMemcheck/DummyAddressSanitizer-result.txt @@ -0,0 +1 @@ +(-1|255) diff --git a/Tests/RunCMake/CTestMemcheck/DummyAddressSanitizer-stderr.txt b/Tests/RunCMake/CTestMemcheck/DummyAddressSanitizer-stderr.txt new file mode 100644 index 0000000..725270c --- /dev/null +++ b/Tests/RunCMake/CTestMemcheck/DummyAddressSanitizer-stderr.txt @@ -0,0 +1,2 @@ +Cannot find memory tester output file: .*/Tests/RunCMake/CTestMemcheck/DummyAddressSanitizer-build/Testing/Temporary/MemoryChecker.1.log\.\* +Error in read script: .*/Tests/RunCMake/CTestMemcheck/DummyAddressSanitizer/test.cmake diff --git a/Tests/RunCMake/CTestMemcheck/DummyAddressSanitizer-stdout.txt b/Tests/RunCMake/CTestMemcheck/DummyAddressSanitizer-stdout.txt new file mode 100644 index 0000000..1d255d0 --- /dev/null +++ b/Tests/RunCMake/CTestMemcheck/DummyAddressSanitizer-stdout.txt @@ -0,0 +1,2 @@ +Memory checking results: +heap-buffer-overflow - 1 diff --git a/Tests/RunCMake/CTestMemcheck/DummyBC-result.txt b/Tests/RunCMake/CTestMemcheck/DummyBC-result.txt new file mode 100644 index 0000000..b57e2de --- /dev/null +++ b/Tests/RunCMake/CTestMemcheck/DummyBC-result.txt @@ -0,0 +1 @@ +(-1|255) diff --git a/Tests/RunCMake/CTestMemcheck/DummyBC-stderr.txt b/Tests/RunCMake/CTestMemcheck/DummyBC-stderr.txt new file mode 100644 index 0000000..24f536a --- /dev/null +++ b/Tests/RunCMake/CTestMemcheck/DummyBC-stderr.txt @@ -0,0 +1 @@ +Error parsing XML in stream at line 1: no element found diff --git a/Tests/RunCMake/CTestMemcheck/DummyBC-stdout.txt b/Tests/RunCMake/CTestMemcheck/DummyBC-stdout.txt new file mode 100644 index 0000000..5829613 --- /dev/null +++ b/Tests/RunCMake/CTestMemcheck/DummyBC-stdout.txt @@ -0,0 +1,3 @@ +1/1 MemCheck #1: RunCMake \.+ Passed +[0-9]+.[0-9]+ sec + +100% tests passed, 0 tests failed out of 1 diff --git a/Tests/RunCMake/CTestMemcheck/DummyBCNoLogFile-result.txt b/Tests/RunCMake/CTestMemcheck/DummyBCNoLogFile-result.txt new file mode 100644 index 0000000..b57e2de --- /dev/null +++ b/Tests/RunCMake/CTestMemcheck/DummyBCNoLogFile-result.txt @@ -0,0 +1 @@ +(-1|255) diff --git a/Tests/RunCMake/CTestMemcheck/DummyBCNoLogFile-stderr.txt b/Tests/RunCMake/CTestMemcheck/DummyBCNoLogFile-stderr.txt new file mode 100644 index 0000000..634e331 --- /dev/null +++ b/Tests/RunCMake/CTestMemcheck/DummyBCNoLogFile-stderr.txt @@ -0,0 +1,3 @@ +Cannot find memory tester output file: .*/Tests/RunCMake/CTestMemcheck/DummyBCNoLogFile-build/Testing/Temporary/MemoryChecker.1.log +.*Error parsing XML in stream at line 1: no element found +Error in read script: .*/Tests/RunCMake/CTestMemcheck/DummyBCNoLogFile/test.cmake diff --git a/Tests/RunCMake/CTestMemcheck/DummyBCNoLogFile-stdout.txt b/Tests/RunCMake/CTestMemcheck/DummyBCNoLogFile-stdout.txt new file mode 100644 index 0000000..5829613 --- /dev/null +++ b/Tests/RunCMake/CTestMemcheck/DummyBCNoLogFile-stdout.txt @@ -0,0 +1,3 @@ +1/1 MemCheck #1: RunCMake \.+ Passed +[0-9]+.[0-9]+ sec + +100% tests passed, 0 tests failed out of 1 diff --git a/Tests/RunCMake/CTestMemcheck/DummyLeakSanitizer-result.txt b/Tests/RunCMake/CTestMemcheck/DummyLeakSanitizer-result.txt new file mode 100644 index 0000000..b57e2de --- /dev/null +++ b/Tests/RunCMake/CTestMemcheck/DummyLeakSanitizer-result.txt @@ -0,0 +1 @@ +(-1|255) diff --git a/Tests/RunCMake/CTestMemcheck/DummyLeakSanitizer-stderr.txt b/Tests/RunCMake/CTestMemcheck/DummyLeakSanitizer-stderr.txt new file mode 100644 index 0000000..520222f --- /dev/null +++ b/Tests/RunCMake/CTestMemcheck/DummyLeakSanitizer-stderr.txt @@ -0,0 +1,2 @@ +Cannot find memory tester output file: .*/Tests/RunCMake/CTestMemcheck/DummyLeakSanitizer-build/Testing/Temporary/MemoryChecker.1.log\.\* +Error in read script: .*/Tests/RunCMake/CTestMemcheck/DummyLeakSanitizer/test.cmake diff --git a/Tests/RunCMake/CTestMemcheck/DummyLeakSanitizer-stdout.txt b/Tests/RunCMake/CTestMemcheck/DummyLeakSanitizer-stdout.txt new file mode 100644 index 0000000..97a8a9b --- /dev/null +++ b/Tests/RunCMake/CTestMemcheck/DummyLeakSanitizer-stdout.txt @@ -0,0 +1,3 @@ +Memory checking results: +Direct leak - 2 +Indirect leak - 1 diff --git a/Tests/RunCMake/CTestMemcheck/DummyMemorySanitizer-result.txt b/Tests/RunCMake/CTestMemcheck/DummyMemorySanitizer-result.txt new file mode 100644 index 0000000..b57e2de --- /dev/null +++ b/Tests/RunCMake/CTestMemcheck/DummyMemorySanitizer-result.txt @@ -0,0 +1 @@ +(-1|255) diff --git a/Tests/RunCMake/CTestMemcheck/DummyMemorySanitizer-stderr.txt b/Tests/RunCMake/CTestMemcheck/DummyMemorySanitizer-stderr.txt new file mode 100644 index 0000000..29c6ec7 --- /dev/null +++ b/Tests/RunCMake/CTestMemcheck/DummyMemorySanitizer-stderr.txt @@ -0,0 +1,2 @@ +Cannot find memory tester output file: .*/Tests/RunCMake/CTestMemcheck/DummyMemorySanitizer-build/Testing/Temporary/MemoryChecker.1.log\.\* +Error in read script: .*/Tests/RunCMake/CTestMemcheck/DummyMemorySanitizer/test.cmake diff --git a/Tests/RunCMake/CTestMemcheck/DummyMemorySanitizer-stdout.txt b/Tests/RunCMake/CTestMemcheck/DummyMemorySanitizer-stdout.txt new file mode 100644 index 0000000..64390c7 --- /dev/null +++ b/Tests/RunCMake/CTestMemcheck/DummyMemorySanitizer-stdout.txt @@ -0,0 +1,2 @@ +Memory checking results: +use-of-uninitialized-value - 1 diff --git a/Tests/RunCMake/CTestMemcheck/DummyPurify-result.txt b/Tests/RunCMake/CTestMemcheck/DummyPurify-result.txt new file mode 100644 index 0000000..573541a --- /dev/null +++ b/Tests/RunCMake/CTestMemcheck/DummyPurify-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/CTestMemcheck/DummyPurify-stderr.txt b/Tests/RunCMake/CTestMemcheck/DummyPurify-stderr.txt new file mode 100644 index 0000000..14bc228 --- /dev/null +++ b/Tests/RunCMake/CTestMemcheck/DummyPurify-stderr.txt @@ -0,0 +1,3 @@ +^((^| +)(BullseyeCoverage|==|ctest\([0-9]+\) malloc:)[^ +]*)*$ diff --git a/Tests/RunCMake/CTestMemcheck/DummyPurify-stdout.txt b/Tests/RunCMake/CTestMemcheck/DummyPurify-stdout.txt new file mode 100644 index 0000000..dabb004 --- /dev/null +++ b/Tests/RunCMake/CTestMemcheck/DummyPurify-stdout.txt @@ -0,0 +1,6 @@ +1/1 MemCheck #1: RunCMake \.+ Passed +[0-9]+.[0-9]+ sec + +100% tests passed, 0 tests failed out of 1 +.* +-- Processing memory checking output:( ) +Memory checking results: diff --git a/Tests/RunCMake/CTestMemcheck/DummyPurifyNoLogFile-result.txt b/Tests/RunCMake/CTestMemcheck/DummyPurifyNoLogFile-result.txt new file mode 100644 index 0000000..b57e2de --- /dev/null +++ b/Tests/RunCMake/CTestMemcheck/DummyPurifyNoLogFile-result.txt @@ -0,0 +1 @@ +(-1|255) diff --git a/Tests/RunCMake/CTestMemcheck/DummyPurifyNoLogFile-stderr.txt b/Tests/RunCMake/CTestMemcheck/DummyPurifyNoLogFile-stderr.txt new file mode 100644 index 0000000..2506f35 --- /dev/null +++ b/Tests/RunCMake/CTestMemcheck/DummyPurifyNoLogFile-stderr.txt @@ -0,0 +1,2 @@ +Cannot find memory tester output file: .*/Tests/RunCMake/CTestMemcheck/DummyPurifyNoLogFile-build/Testing/Temporary/MemoryChecker.1.log +Error in read script: .*/Tests/RunCMake/CTestMemcheck/DummyPurifyNoLogFile/test.cmake diff --git a/Tests/RunCMake/CTestMemcheck/DummyPurifyNoLogFile-stdout.txt b/Tests/RunCMake/CTestMemcheck/DummyPurifyNoLogFile-stdout.txt new file mode 100644 index 0000000..5829613 --- /dev/null +++ b/Tests/RunCMake/CTestMemcheck/DummyPurifyNoLogFile-stdout.txt @@ -0,0 +1,3 @@ +1/1 MemCheck #1: RunCMake \.+ Passed +[0-9]+.[0-9]+ sec + +100% tests passed, 0 tests failed out of 1 diff --git a/Tests/RunCMake/CTestMemcheck/DummyThreadSanitizer-result.txt b/Tests/RunCMake/CTestMemcheck/DummyThreadSanitizer-result.txt new file mode 100644 index 0000000..b57e2de --- /dev/null +++ b/Tests/RunCMake/CTestMemcheck/DummyThreadSanitizer-result.txt @@ -0,0 +1 @@ +(-1|255) diff --git a/Tests/RunCMake/CTestMemcheck/DummyThreadSanitizer-stderr.txt b/Tests/RunCMake/CTestMemcheck/DummyThreadSanitizer-stderr.txt new file mode 100644 index 0000000..ca23692 --- /dev/null +++ b/Tests/RunCMake/CTestMemcheck/DummyThreadSanitizer-stderr.txt @@ -0,0 +1,2 @@ +Cannot find memory tester output file: .*/Tests/RunCMake/CTestMemcheck/DummyThreadSanitizer-build/Testing/Temporary/MemoryChecker.1.log\.\* +Error in read script: .*/Tests/RunCMake/CTestMemcheck/DummyThreadSanitizer/test.cmake diff --git a/Tests/RunCMake/CTestMemcheck/DummyThreadSanitizer-stdout.txt b/Tests/RunCMake/CTestMemcheck/DummyThreadSanitizer-stdout.txt new file mode 100644 index 0000000..c3af1f9 --- /dev/null +++ b/Tests/RunCMake/CTestMemcheck/DummyThreadSanitizer-stdout.txt @@ -0,0 +1,13 @@ +Memory checking results: +data race - 1 +data race on vptr \(ctor/dtor vs virtual call\) - 1 +heap-use-after-free - 1 +thread leak - 1 +destroy of a locked mutex - 1 +double lock of a mutex - 1 +unlock of an unlocked mutex \(or by a wrong thread\) - 1 +read lock of a write locked mutex - 1 +read unlock of a write locked mutex - 1 +signal-unsafe call inside of a signal - 1 +signal handler spoils errno - 1 +lock-order-inversion \(potential deadlock\) - 1 diff --git a/Tests/RunCMake/CTestMemcheck/DummyUndefinedBehaviorSanitizer-result.txt b/Tests/RunCMake/CTestMemcheck/DummyUndefinedBehaviorSanitizer-result.txt new file mode 100644 index 0000000..b57e2de --- /dev/null +++ b/Tests/RunCMake/CTestMemcheck/DummyUndefinedBehaviorSanitizer-result.txt @@ -0,0 +1 @@ +(-1|255) diff --git a/Tests/RunCMake/CTestMemcheck/DummyUndefinedBehaviorSanitizer-stderr.txt b/Tests/RunCMake/CTestMemcheck/DummyUndefinedBehaviorSanitizer-stderr.txt new file mode 100644 index 0000000..fd684da --- /dev/null +++ b/Tests/RunCMake/CTestMemcheck/DummyUndefinedBehaviorSanitizer-stderr.txt @@ -0,0 +1,2 @@ +Cannot find memory tester output file: .*/Tests/RunCMake/CTestMemcheck/DummyUndefinedBehaviorSanitizer-build/Testing/Temporary/MemoryChecker.1.log\.\* +Error in read script: .*/Tests/RunCMake/CTestMemcheck/DummyUndefinedBehaviorSanitizer/test.cmake diff --git a/Tests/RunCMake/CTestMemcheck/DummyUndefinedBehaviorSanitizer-stdout.txt b/Tests/RunCMake/CTestMemcheck/DummyUndefinedBehaviorSanitizer-stdout.txt new file mode 100644 index 0000000..b3473bf --- /dev/null +++ b/Tests/RunCMake/CTestMemcheck/DummyUndefinedBehaviorSanitizer-stdout.txt @@ -0,0 +1,2 @@ +Memory checking results: +left shift of negative value -256 - 1 diff --git a/Tests/RunCMake/CTestMemcheck/DummyValgrind-result.txt b/Tests/RunCMake/CTestMemcheck/DummyValgrind-result.txt new file mode 100644 index 0000000..573541a --- /dev/null +++ b/Tests/RunCMake/CTestMemcheck/DummyValgrind-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/CTestMemcheck/DummyValgrind-stderr.txt b/Tests/RunCMake/CTestMemcheck/DummyValgrind-stderr.txt new file mode 100644 index 0000000..14bc228 --- /dev/null +++ b/Tests/RunCMake/CTestMemcheck/DummyValgrind-stderr.txt @@ -0,0 +1,3 @@ +^((^| +)(BullseyeCoverage|==|ctest\([0-9]+\) malloc:)[^ +]*)*$ diff --git a/Tests/RunCMake/CTestMemcheck/DummyValgrind-stdout.txt b/Tests/RunCMake/CTestMemcheck/DummyValgrind-stdout.txt new file mode 100644 index 0000000..dabb004 --- /dev/null +++ b/Tests/RunCMake/CTestMemcheck/DummyValgrind-stdout.txt @@ -0,0 +1,6 @@ +1/1 MemCheck #1: RunCMake \.+ Passed +[0-9]+.[0-9]+ sec + +100% tests passed, 0 tests failed out of 1 +.* +-- Processing memory checking output:( ) +Memory checking results: diff --git a/Tests/RunCMake/CTestMemcheck/DummyValgrindCustomOptions-result.txt b/Tests/RunCMake/CTestMemcheck/DummyValgrindCustomOptions-result.txt new file mode 100644 index 0000000..b57e2de --- /dev/null +++ b/Tests/RunCMake/CTestMemcheck/DummyValgrindCustomOptions-result.txt @@ -0,0 +1 @@ +(-1|255) diff --git a/Tests/RunCMake/CTestMemcheck/DummyValgrindCustomOptions-stderr.txt b/Tests/RunCMake/CTestMemcheck/DummyValgrindCustomOptions-stderr.txt new file mode 100644 index 0000000..1a2ee5c --- /dev/null +++ b/Tests/RunCMake/CTestMemcheck/DummyValgrindCustomOptions-stderr.txt @@ -0,0 +1,2 @@ +Cannot find memory tester output file: .*/Tests/RunCMake/CTestMemcheck/DummyValgrindCustomOptions-build/Testing/Temporary/MemoryChecker.1.log +Error in read script: .*/Tests/RunCMake/CTestMemcheck/DummyValgrindCustomOptions/test.cmake diff --git a/Tests/RunCMake/CTestMemcheck/DummyValgrindCustomOptions-stdout.txt b/Tests/RunCMake/CTestMemcheck/DummyValgrindCustomOptions-stdout.txt new file mode 100644 index 0000000..dabb004 --- /dev/null +++ b/Tests/RunCMake/CTestMemcheck/DummyValgrindCustomOptions-stdout.txt @@ -0,0 +1,6 @@ +1/1 MemCheck #1: RunCMake \.+ Passed +[0-9]+.[0-9]+ sec + +100% tests passed, 0 tests failed out of 1 +.* +-- Processing memory checking output:( ) +Memory checking results: diff --git a/Tests/RunCMake/CTestMemcheck/DummyValgrindFailPost-result.txt b/Tests/RunCMake/CTestMemcheck/DummyValgrindFailPost-result.txt new file mode 100644 index 0000000..b57e2de --- /dev/null +++ b/Tests/RunCMake/CTestMemcheck/DummyValgrindFailPost-result.txt @@ -0,0 +1 @@ +(-1|255) diff --git a/Tests/RunCMake/CTestMemcheck/DummyValgrindFailPost-stderr.txt b/Tests/RunCMake/CTestMemcheck/DummyValgrindFailPost-stderr.txt new file mode 100644 index 0000000..2d078ef --- /dev/null +++ b/Tests/RunCMake/CTestMemcheck/DummyValgrindFailPost-stderr.txt @@ -0,0 +1,3 @@ +Problem running command: .*memcheck_fail.* +Problem executing post-memcheck command\(s\). +Error in read script: .*/Tests/RunCMake/CTestMemcheck/DummyValgrindFailPost/test.cmake diff --git a/Tests/RunCMake/CTestMemcheck/DummyValgrindFailPost-stdout.txt b/Tests/RunCMake/CTestMemcheck/DummyValgrindFailPost-stdout.txt new file mode 100644 index 0000000..dabb004 --- /dev/null +++ b/Tests/RunCMake/CTestMemcheck/DummyValgrindFailPost-stdout.txt @@ -0,0 +1,6 @@ +1/1 MemCheck #1: RunCMake \.+ Passed +[0-9]+.[0-9]+ sec + +100% tests passed, 0 tests failed out of 1 +.* +-- Processing memory checking output:( ) +Memory checking results: diff --git a/Tests/RunCMake/CTestMemcheck/DummyValgrindFailPre-result.txt b/Tests/RunCMake/CTestMemcheck/DummyValgrindFailPre-result.txt new file mode 100644 index 0000000..b57e2de --- /dev/null +++ b/Tests/RunCMake/CTestMemcheck/DummyValgrindFailPre-result.txt @@ -0,0 +1 @@ +(-1|255) diff --git a/Tests/RunCMake/CTestMemcheck/DummyValgrindFailPre-stderr.txt b/Tests/RunCMake/CTestMemcheck/DummyValgrindFailPre-stderr.txt new file mode 100644 index 0000000..43ccb2e --- /dev/null +++ b/Tests/RunCMake/CTestMemcheck/DummyValgrindFailPre-stderr.txt @@ -0,0 +1,3 @@ +Problem running command: .*memcheck_fail.* +Problem executing pre-memcheck command\(s\). +Error in read script: .*/Tests/RunCMake/CTestMemcheck/DummyValgrindFailPre/test.cmake diff --git a/Tests/RunCMake/CTestMemcheck/DummyValgrindFailPre-stdout.txt b/Tests/RunCMake/CTestMemcheck/DummyValgrindFailPre-stdout.txt new file mode 100644 index 0000000..9a6a1d6 --- /dev/null +++ b/Tests/RunCMake/CTestMemcheck/DummyValgrindFailPre-stdout.txt @@ -0,0 +1 @@ +Memory check project .*/Tests/RunCMake/CTestMemcheck/DummyValgrindFailPre-build diff --git a/Tests/RunCMake/CTestMemcheck/DummyValgrindIgnoreMemcheck-result.txt b/Tests/RunCMake/CTestMemcheck/DummyValgrindIgnoreMemcheck-result.txt new file mode 100644 index 0000000..573541a --- /dev/null +++ b/Tests/RunCMake/CTestMemcheck/DummyValgrindIgnoreMemcheck-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/CTestMemcheck/DummyValgrindIgnoreMemcheck-stderr.txt b/Tests/RunCMake/CTestMemcheck/DummyValgrindIgnoreMemcheck-stderr.txt new file mode 100644 index 0000000..14bc228 --- /dev/null +++ b/Tests/RunCMake/CTestMemcheck/DummyValgrindIgnoreMemcheck-stderr.txt @@ -0,0 +1,3 @@ +^((^| +)(BullseyeCoverage|==|ctest\([0-9]+\) malloc:)[^ +]*)*$ diff --git a/Tests/RunCMake/CTestMemcheck/DummyValgrindIgnoreMemcheck-stdout.txt b/Tests/RunCMake/CTestMemcheck/DummyValgrindIgnoreMemcheck-stdout.txt new file mode 100644 index 0000000..5a5675c --- /dev/null +++ b/Tests/RunCMake/CTestMemcheck/DummyValgrindIgnoreMemcheck-stdout.txt @@ -0,0 +1,7 @@ +2/2 Test #2: RunCMakeAgain .* +1/1 MemCheck #1: RunCMake \.+ Passed +[0-9]+.[0-9]+ sec + +100% tests passed, 0 tests failed out of 1 +.* +-- Processing memory checking output:( ) +Memory checking results: diff --git a/Tests/RunCMake/CTestMemcheck/DummyValgrindInvalidSupFile-result.txt b/Tests/RunCMake/CTestMemcheck/DummyValgrindInvalidSupFile-result.txt new file mode 100644 index 0000000..b57e2de --- /dev/null +++ b/Tests/RunCMake/CTestMemcheck/DummyValgrindInvalidSupFile-result.txt @@ -0,0 +1 @@ +(-1|255) diff --git a/Tests/RunCMake/CTestMemcheck/DummyValgrindInvalidSupFile-stderr.txt b/Tests/RunCMake/CTestMemcheck/DummyValgrindInvalidSupFile-stderr.txt new file mode 100644 index 0000000..d8d1ff0 --- /dev/null +++ b/Tests/RunCMake/CTestMemcheck/DummyValgrindInvalidSupFile-stderr.txt @@ -0,0 +1,2 @@ +Cannot find memory checker suppression file: .*/Tests/RunCMake/CTestMemcheck/DummyValgrindInvalidSupFile-build/does-not-exist +Error in read script: .*/Tests/RunCMake/CTestMemcheck/DummyValgrindInvalidSupFile/test.cmake diff --git a/Tests/RunCMake/CTestMemcheck/DummyValgrindInvalidSupFile-stdout.txt b/Tests/RunCMake/CTestMemcheck/DummyValgrindInvalidSupFile-stdout.txt new file mode 100644 index 0000000..d46912e --- /dev/null +++ b/Tests/RunCMake/CTestMemcheck/DummyValgrindInvalidSupFile-stdout.txt @@ -0,0 +1 @@ +Memory check project .*/Tests/RunCMake/CTestMemcheck/DummyValgrindInvalidSupFile-build$ diff --git a/Tests/RunCMake/CTestMemcheck/DummyValgrindNoLogFile-result.txt b/Tests/RunCMake/CTestMemcheck/DummyValgrindNoLogFile-result.txt new file mode 100644 index 0000000..b57e2de --- /dev/null +++ b/Tests/RunCMake/CTestMemcheck/DummyValgrindNoLogFile-result.txt @@ -0,0 +1 @@ +(-1|255) diff --git a/Tests/RunCMake/CTestMemcheck/DummyValgrindNoLogFile-stderr.txt b/Tests/RunCMake/CTestMemcheck/DummyValgrindNoLogFile-stderr.txt new file mode 100644 index 0000000..321a2a5 --- /dev/null +++ b/Tests/RunCMake/CTestMemcheck/DummyValgrindNoLogFile-stderr.txt @@ -0,0 +1,2 @@ +Cannot find memory tester output file: .*/Tests/RunCMake/CTestMemcheck/DummyValgrindNoLogFile-build/Testing/Temporary/MemoryChecker.1.log +Error in read script: .*/Tests/RunCMake/CTestMemcheck/DummyValgrindNoLogFile/test.cmake diff --git a/Tests/RunCMake/CTestMemcheck/DummyValgrindNoLogFile-stdout.txt b/Tests/RunCMake/CTestMemcheck/DummyValgrindNoLogFile-stdout.txt new file mode 100644 index 0000000..5829613 --- /dev/null +++ b/Tests/RunCMake/CTestMemcheck/DummyValgrindNoLogFile-stdout.txt @@ -0,0 +1,3 @@ +1/1 MemCheck #1: RunCMake \.+ Passed +[0-9]+.[0-9]+ sec + +100% tests passed, 0 tests failed out of 1 diff --git a/Tests/RunCMake/CTestMemcheck/DummyValgrindPrePost-result.txt b/Tests/RunCMake/CTestMemcheck/DummyValgrindPrePost-result.txt new file mode 100644 index 0000000..573541a --- /dev/null +++ b/Tests/RunCMake/CTestMemcheck/DummyValgrindPrePost-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/CTestMemcheck/DummyValgrindPrePost-stderr.txt b/Tests/RunCMake/CTestMemcheck/DummyValgrindPrePost-stderr.txt new file mode 100644 index 0000000..14bc228 --- /dev/null +++ b/Tests/RunCMake/CTestMemcheck/DummyValgrindPrePost-stderr.txt @@ -0,0 +1,3 @@ +^((^| +)(BullseyeCoverage|==|ctest\([0-9]+\) malloc:)[^ +]*)*$ diff --git a/Tests/RunCMake/CTestMemcheck/DummyValgrindPrePost-stdout.txt b/Tests/RunCMake/CTestMemcheck/DummyValgrindPrePost-stdout.txt new file mode 100644 index 0000000..dabb004 --- /dev/null +++ b/Tests/RunCMake/CTestMemcheck/DummyValgrindPrePost-stdout.txt @@ -0,0 +1,6 @@ +1/1 MemCheck #1: RunCMake \.+ Passed +[0-9]+.[0-9]+ sec + +100% tests passed, 0 tests failed out of 1 +.* +-- Processing memory checking output:( ) +Memory checking results: diff --git a/Tests/RunCMake/CTestMemcheck/DummyValgrindTwoTargets-result.txt b/Tests/RunCMake/CTestMemcheck/DummyValgrindTwoTargets-result.txt new file mode 100644 index 0000000..573541a --- /dev/null +++ b/Tests/RunCMake/CTestMemcheck/DummyValgrindTwoTargets-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/CTestMemcheck/DummyValgrindTwoTargets-stderr.txt b/Tests/RunCMake/CTestMemcheck/DummyValgrindTwoTargets-stderr.txt new file mode 100644 index 0000000..14bc228 --- /dev/null +++ b/Tests/RunCMake/CTestMemcheck/DummyValgrindTwoTargets-stderr.txt @@ -0,0 +1,3 @@ +^((^| +)(BullseyeCoverage|==|ctest\([0-9]+\) malloc:)[^ +]*)*$ diff --git a/Tests/RunCMake/CTestMemcheck/DummyValgrindTwoTargets-stdout.txt b/Tests/RunCMake/CTestMemcheck/DummyValgrindTwoTargets-stdout.txt new file mode 100644 index 0000000..3e0fdb2 --- /dev/null +++ b/Tests/RunCMake/CTestMemcheck/DummyValgrindTwoTargets-stdout.txt @@ -0,0 +1,8 @@ +Memory check project .*/DummyValgrindTwoTargets-build +.* + *Start 1: RunCMake +(.* +)?Memory check command: .* \"--log-file=.*/DummyValgrindTwoTargets-build/Testing/Temporary/MemoryChecker.1.log\" \"-q\".* + *Start 2: RunCMakeAgain +(.* +)?Memory check command: .* \"--log-file=.*/DummyValgrindTwoTargets-build/Testing/Temporary/MemoryChecker.2.log\" \"-q\".* diff --git a/Tests/RunCMake/CTestMemcheck/NotExist-result.txt b/Tests/RunCMake/CTestMemcheck/NotExist-result.txt new file mode 100644 index 0000000..573541a --- /dev/null +++ b/Tests/RunCMake/CTestMemcheck/NotExist-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/CTestMemcheck/NotExist-stderr.txt b/Tests/RunCMake/CTestMemcheck/NotExist-stderr.txt new file mode 100644 index 0000000..0af5b7a --- /dev/null +++ b/Tests/RunCMake/CTestMemcheck/NotExist-stderr.txt @@ -0,0 +1 @@ +Memory checker \(MemoryCheckCommand\) not set, or cannot find the specified program\. diff --git a/Tests/RunCMake/CTestMemcheck/NotExist-stdout.txt b/Tests/RunCMake/CTestMemcheck/NotExist-stdout.txt new file mode 100644 index 0000000..9e92266 --- /dev/null +++ b/Tests/RunCMake/CTestMemcheck/NotExist-stdout.txt @@ -0,0 +1 @@ +Memory check project .*/Tests/RunCMake/CTestMemcheck/NotExist-build$ diff --git a/Tests/RunCMake/CTestMemcheck/RunCMakeTest.cmake b/Tests/RunCMake/CTestMemcheck/RunCMakeTest.cmake new file mode 100644 index 0000000..6485de8 --- /dev/null +++ b/Tests/RunCMake/CTestMemcheck/RunCMakeTest.cmake @@ -0,0 +1,144 @@ +include(RunCMake) + +set(SITE test-site) +set(BUILDNAME test-build) +set(COVERAGE_COMMAND "") + +function(run_mc_test SUBTEST_NAME CHECKER_COMMAND) + configure_file(${RunCMake_SOURCE_DIR}/test.cmake.in + ${RunCMake_BINARY_DIR}/${SUBTEST_NAME}/test.cmake @ONLY) + configure_file(${RunCMake_SOURCE_DIR}/CTestConfig.cmake.in + ${RunCMake_BINARY_DIR}/${SUBTEST_NAME}/CTestConfig.cmake @ONLY) + configure_file(${RunCMake_SOURCE_DIR}/CMakeLists.txt.in + ${RunCMake_BINARY_DIR}/${SUBTEST_NAME}/CMakeLists.txt @ONLY) + run_cmake_command(${SUBTEST_NAME} ${CMAKE_CTEST_COMMAND} + -C Debug + -S ${RunCMake_BINARY_DIR}/${SUBTEST_NAME}/test.cmake + -V + --output-log ${RunCMake_BINARY_DIR}/${SUBTEST_NAME}-build/testOutput.log + ${ARGN} + ) +endfunction() + +unset(CTEST_EXTRA_CONFIG) +unset(CTEST_EXTRA_CODE) +unset(CMAKELISTS_EXTRA_CODE) + +#----------------------------------------------------------------------------- +# add ThreadSanitizer test +set(CTEST_EXTRA_CODE +"set(CTEST_MEMORYCHECK_COMMAND_OPTIONS \"report_bugs=1 history_size=5 exitcode=55\") +") +set(CMAKELISTS_EXTRA_CODE +"add_test(NAME TestSan COMMAND \"\${CMAKE_COMMAND}\" +-P \"${RunCMake_SOURCE_DIR}/testThreadSanitizer.cmake\") +") +run_mc_test(DummyThreadSanitizer "" -DMEMCHECK_TYPE=ThreadSanitizer) +unset(CMAKELISTS_EXTRA_CODE) +unset(CTEST_EXTRA_CODE) + +#----------------------------------------------------------------------------- +# add LeakSanitizer test +set(CTEST_EXTRA_CODE +"set(CTEST_MEMORYCHECK_SANITIZER_OPTIONS \"simulate_sanitizer=1 report_bugs=1 history_size=5 exitcode=55\") +") +set(CMAKELISTS_EXTRA_CODE +"add_test(NAME TestSan COMMAND \"${CMAKE_COMMAND}\" +-P \"${RunCMake_SOURCE_DIR}/testLeakSanitizer.cmake\") +") +run_mc_test(DummyLeakSanitizer "" -DMEMCHECK_TYPE=AddressSanitizer) +unset(CMAKELISTS_EXTRA_CODE) +unset(CTEST_EXTRA_CODE) + +#----------------------------------------------------------------------------- +# add AddressSanitizer test +set(CTEST_EXTRA_CODE +"set(CTEST_MEMORYCHECK_SANITIZER_OPTIONS \"simulate_sanitizer=1 report_bugs=1 history_size=5 exitcode=55\") +") +set(CMAKELISTS_EXTRA_CODE +"add_test(NAME TestSan COMMAND \"\${CMAKE_COMMAND}\" +-P \"${RunCMake_SOURCE_DIR}/testAddressSanitizer.cmake\") +") +run_mc_test(DummyAddressSanitizer "" -DMEMCHECK_TYPE=AddressSanitizer) +unset(CMAKELISTS_EXTRA_CODE) +unset(CTEST_EXTRA_CODE) + +#----------------------------------------------------------------------------- +# add MemorySanitizer test +set(CTEST_EXTRA_CODE +"set(CTEST_MEMORYCHECK_COMMAND_OPTIONS \"simulate_sanitizer=1 report_bugs=1 history_size=5 exitcode=55\") +") +set(CMAKELISTS_EXTRA_CODE +"add_test(NAME TestSan COMMAND \"\${CMAKE_COMMAND}\" +-P \"${RunCMake_SOURCE_DIR}/testMemorySanitizer.cmake\") +") +run_mc_test(DummyMemorySanitizer "" -DMEMCHECK_TYPE=MemorySanitizer) +unset(CMAKELISTS_EXTRA_CODE) +unset(CTEST_EXTRA_CODE) + +#----------------------------------------------------------------------------- +# add UndefinedBehaviorSanitizer test +set(CTEST_EXTRA_CODE +"set(CTEST_MEMORYCHECK_SANITIZER_OPTIONS \"simulate_sanitizer=1\") +") +set(CMAKELISTS_EXTRA_CODE +"add_test(NAME TestSan COMMAND \"\${CMAKE_COMMAND}\" +-P \"${RunCMake_SOURCE_DIR}/testUndefinedBehaviorSanitizer.cmake\") +") +run_mc_test(DummyUndefinedBehaviorSanitizer "" -DMEMCHECK_TYPE=UndefinedBehaviorSanitizer) +unset(CMAKELISTS_EXTRA_CODE) +unset(CTEST_EXTRA_CODE) + +#----------------------------------------------------------------------------- +set(CTEST_EXTRA_CODE "string(REPLACE \" \" \"\\\\ \" PRE_POST_COMMAND \"\${CTEST_MEMORYCHECK_COMMAND}\") + +set(CTEST_CUSTOM_PRE_MEMCHECK \"\${PRE_POST_COMMAND} pre command\") +set(CTEST_CUSTOM_POST_MEMCHECK \"\${PRE_POST_COMMAND} post command \") +") +run_mc_test(DummyValgrindPrePost "${PSEUDO_VALGRIND}") +unset(CTEST_EXTRA_CODE) + +#----------------------------------------------------------------------------- +set(CTEST_EXTRA_CODE "set(CTEST_CUSTOM_POST_MEMCHECK \"${MEMCHECK_FAIL}\")") +run_mc_test(DummyValgrindFailPost "${PSEUDO_VALGRIND}") +unset(CTEST_EXTRA_CODE) + +#----------------------------------------------------------------------------- +set(CTEST_EXTRA_CODE "set(CTEST_CUSTOM_PRE_MEMCHECK \"${MEMCHECK_FAIL}\")") +run_mc_test(DummyValgrindFailPre "${PSEUDO_VALGRIND}") +unset(CTEST_EXTRA_CODE) + +#----------------------------------------------------------------------------- +set(CTEST_EXTRA_CONFIG "set(CTEST_CUSTOM_MEMCHECK_IGNORE RunCMakeAgain)\n") +set(CMAKELISTS_EXTRA_CODE "add_test(NAME RunCMakeAgain COMMAND \"\${CMAKE_COMMAND}\" --version)") +run_mc_test(DummyValgrindIgnoreMemcheck "${PSEUDO_VALGRIND}") +unset(CTEST_EXTRA_CONFIG) +unset(CMAKELISTS_EXTRA_CODE) + +#----------------------------------------------------------------------------- +set(CMAKELISTS_EXTRA_CODE "add_test(NAME RunCMakeAgain COMMAND \"\${CMAKE_COMMAND}\" --version)") +run_mc_test(DummyValgrindTwoTargets "${PSEUDO_VALGRIND}" "-VV") +unset(CMAKELISTS_EXTRA_CODE) + +#----------------------------------------------------------------------------- +set(CTEST_EXTRA_CONFIG "set(CTEST_MEMORYCHECK_SUPPRESSIONS_FILE \"\${CMAKE_CURRENT_BINARY_DIR}/does-not-exist\")") +run_mc_test(DummyValgrindInvalidSupFile "${PSEUDO_VALGRIND}") +unset(CTEST_EXTRA_CONFIG) + +#----------------------------------------------------------------------------- +# CTest will add the logfile option before any custom options. Set the logfile +# again, this time to an empty string. This will cause the logfile to be +# missing, which will be the prove for us that the custom option is indeed used. +set(CTEST_EXTRA_CONFIG "set(CTEST_MEMORYCHECK_COMMAND_OPTIONS \"--log-file=\")") +run_mc_test(DummyValgrindCustomOptions "${PSEUDO_VALGRIND}") +unset(CTEST_EXTRA_CONFIG) + +#----------------------------------------------------------------------------- +run_mc_test(DummyPurify "${PSEUDO_PURIFY}") +run_mc_test(DummyValgrind "${PSEUDO_VALGRIND}") +run_mc_test(DummyBC "${PSEUDO_BC}") +run_mc_test(DummyPurifyNoLogFile "${PSEUDO_PURIFY_NOLOG}") +run_mc_test(DummyValgrindNoLogFile "${PSEUDO_VALGRIND_NOLOG}") +run_mc_test(DummyBCNoLogFile "${PSEUDO_BC_NOLOG}") +run_mc_test(NotExist "\${CTEST_BINARY_DIRECTORY}/no-memcheck-exe") +run_mc_test(Unknown "\${CMAKE_COMMAND}") diff --git a/Tests/RunCMake/CTestMemcheck/Unknown-result.txt b/Tests/RunCMake/CTestMemcheck/Unknown-result.txt new file mode 100644 index 0000000..b57e2de --- /dev/null +++ b/Tests/RunCMake/CTestMemcheck/Unknown-result.txt @@ -0,0 +1 @@ +(-1|255) diff --git a/Tests/RunCMake/CTestMemcheck/Unknown-stderr.txt b/Tests/RunCMake/CTestMemcheck/Unknown-stderr.txt new file mode 100644 index 0000000..2beea2d --- /dev/null +++ b/Tests/RunCMake/CTestMemcheck/Unknown-stderr.txt @@ -0,0 +1,2 @@ +Do not understand memory checker: .*/cmake.* +Error in read script: .*/Tests/RunCMake/CTestMemcheck/Unknown/test.cmake diff --git a/Tests/RunCMake/CTestMemcheck/Unknown-stdout.txt b/Tests/RunCMake/CTestMemcheck/Unknown-stdout.txt new file mode 100644 index 0000000..7ea1af0 --- /dev/null +++ b/Tests/RunCMake/CTestMemcheck/Unknown-stdout.txt @@ -0,0 +1 @@ +Memory check project .*/Tests/RunCMake/CTestMemcheck/Unknown-build$ diff --git a/Tests/RunCMake/CTestMemcheck/test.cmake.in b/Tests/RunCMake/CTestMemcheck/test.cmake.in new file mode 100644 index 0000000..622d709 --- /dev/null +++ b/Tests/RunCMake/CTestMemcheck/test.cmake.in @@ -0,0 +1,24 @@ +cmake_minimum_required(VERSION 2.8.9) + +# Settings: +set(CTEST_SITE "@SITE@") +set(CTEST_BUILD_NAME "CTestTest-@BUILDNAME@-Memcheck@SUBTEST_NAME@") + +set(CTEST_SOURCE_DIRECTORY "@RunCMake_BINARY_DIR@/@SUBTEST_NAME@") +set(CTEST_BINARY_DIRECTORY "@RunCMake_BINARY_DIR@/@SUBTEST_NAME@-build") +set(CTEST_CMAKE_GENERATOR "@RunCMake_GENERATOR@") +set(CTEST_CMAKE_GENERATOR_PLATFORM "@RunCMake_GENERATOR_PLATFORM@") +set(CTEST_CMAKE_GENERATOR_TOOLSET "@RunCMake_GENERATOR_TOOLSET@") +set(CTEST_BUILD_CONFIGURATION "$ENV{CMAKE_CONFIG_TYPE}") +set(CTEST_COVERAGE_COMMAND "@COVERAGE_COMMAND@") +set(CTEST_NOTES_FILES "${CTEST_SCRIPT_DIRECTORY}/${CTEST_SCRIPT_NAME}") + +set(CTEST_MEMORYCHECK_COMMAND "@CHECKER_COMMAND@") +set(CTEST_MEMORYCHECK_TYPE "${MEMCHECK_TYPE}") + +@CTEST_EXTRA_CODE@ + +CTEST_START(Experimental) +CTEST_CONFIGURE(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res) +CTEST_TEST(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res) +CTEST_MEMCHECK(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res) diff --git a/Tests/RunCMake/CTestMemcheck/testAddressSanitizer.cmake b/Tests/RunCMake/CTestMemcheck/testAddressSanitizer.cmake new file mode 100644 index 0000000..3082e4b --- /dev/null +++ b/Tests/RunCMake/CTestMemcheck/testAddressSanitizer.cmake @@ -0,0 +1,58 @@ +# this file simulates a program that has been built with address sanitizer +# options + +message("ASAN_OPTIONS = [$ENV{ASAN_OPTIONS}]") +string(REGEX REPLACE ".*log_path=\"([^\"]*)\".*" "\\1" LOG_FILE "$ENV{ASAN_OPTIONS}") +message("LOG_FILE=[${LOG_FILE}]") + +# if we are not asked to simulate address sanitizer don't do it +if(NOT "$ENV{ASAN_OPTIONS}]" MATCHES "simulate_sanitizer.1") + return() +endif() +# clear the log file +file(REMOVE "${LOG_FILE}.2343") + +# create an example error from address santizer + +file(APPEND "${LOG_FILE}.2343" +"================================================================= +==19278== ERROR: AddressSanitizer: heap-buffer-overflow on address 0x60080000bffc at pc 0x4009f1 bp 0x7fff82de6520 sp 0x7fff82de6518 +WRITE of size 4 at 0x60080000bffc thread T0 + #0 0x4009f0 (/home/kitware/msan/a.out+0x4009f0) + #1 0x7f18b02c876c (/lib/x86_64-linux-gnu/libc-2.15.so+0x2176c) + #2 0x400858 (/home/kitware/msan/a.out+0x400858) +0x60080000bffc is located 4 bytes to the right of 40-byte region [0x60080000bfd0,0x60080000bff8) +allocated by thread T0 here: + #0 0x7f18b088f9ca (/usr/lib/x86_64-linux-gnu/libasan.so.0.0.0+0x119ca) + #1 0x4009a2 (/home/kitware/msan/a.out+0x4009a2) + #2 0x7f18b02c876c (/lib/x86_64-linux-gnu/libc-2.15.so+0x2176c) +Shadow bytes around the buggy address: + 0x0c017fff97a0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa + 0x0c017fff97b0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa + 0x0c017fff97c0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa + 0x0c017fff97d0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa + 0x0c017fff97e0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa +=>0x0c017fff97f0: fa fa fa fa fa fa fa fa fa fa 00 00 00 00 00[fa] + 0x0c017fff9800:fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa + 0x0c017fff9810: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa + 0x0c017fff9820: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa + 0x0c017fff9830: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa + 0x0c017fff9840: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa +Shadow byte legend (one shadow byte represents 8 application bytes): + Addressable: 00 + Partially addressable: 01 02 03 04 05 06 07 + Heap left redzone: fa + Heap righ redzone: fb + Freed Heap region: fd + Stack left redzone: f1 + Stack mid redzone: f2 + Stack right redzone: f3 + Stack partial redzone: f4 + Stack after return: f5 + Stack use after scope: f8 + Global redzone: f9 + Global init order: f6 + Poisoned by user: f7 + ASan internal: fe +==19278== ABORTING +") diff --git a/Tests/RunCMake/CTestMemcheck/testLeakSanitizer.cmake b/Tests/RunCMake/CTestMemcheck/testLeakSanitizer.cmake new file mode 100644 index 0000000..02030be --- /dev/null +++ b/Tests/RunCMake/CTestMemcheck/testLeakSanitizer.cmake @@ -0,0 +1,47 @@ +# this file simulates a program that has been built with thread sanitizer +# options + +message("ASAN_OPTIONS = [$ENV{ASAN_OPTIONS}]") +string(REGEX REPLACE ".*log_path=\"([^\"]*)\".*" "\\1" LOG_FILE "$ENV{ASAN_OPTIONS}") +message("LOG_FILE=[${LOG_FILE}]") +# if we are not asked to simulate leak sanitizer don't do it +if(NOT "$ENV{ASAN_OPTIONS}]" MATCHES "simulate_sanitizer.1") + return() +endif() + +# clear the log file +file(REMOVE "${LOG_FILE}.2343") +file(REMOVE "${LOG_FILE}.2344") + +# create an error of each type of thread santizer +# these names come from tsan_report.cc in llvm + +file(APPEND "${LOG_FILE}.2343" +"================================================================= +==25308==ERROR: LeakSanitizer: detected memory leaks + +Direct leak of 4360 byte(s) in 1 object(s) allocated from: + #0 0x46c669 in operator new[](unsigned long) (/home/kitware/msan/a.out+0x46c669) + #1 0x4823b4 in main /home/kitware/msan/memcheck.cxx:12 + #2 0x7fa72bee476c in __libc_start_main /build/buildd/eglibc-2.15/csu/libc-start.c:226 + +SUMMARY: AddressSanitizer: 4436 byte(s) leaked in 2 allocation(s). +") +file(APPEND "${LOG_FILE}.2342" +"================================================================= +==25308==ERROR: LeakSanitizer: detected memory leaks + +Direct leak of 76 byte(s) in 1 object(s) allocated from: + #0 0x46c669 in operator new[](unsigned long) (/home/kitware/msan/a.out+0x46c669) + #1 0x4821b8 in foo() /home/kitware/msan/memcheck.cxx:4 + #2 0x4823f2 in main /home/kitware/msan/memcheck.cxx:14 + #3 0x7fa72bee476c in __libc_start_main /build/buildd/eglibc-2.15/csu/libc-start.c:226 + +Indirect leak of 76 byte(s) in 1 object(s) allocated from: + #0 0x46c669 in operator new[](unsigned long) (/home/kitware/msan/a.out+0x46c669) + #1 0x4821b8 in foo() /home/kitware/msan/memcheck.cxx:4 + #2 0x4823f2 in main /home/kitware/msan/memcheck.cxx:14 + #3 0x7fa72bee476c in __libc_start_main /build/buildd/eglibc-2.15/csu/libc-start.c:226 + +SUMMARY: AddressSanitizer: 4436 byte(s) leaked in 2 allocation(s). +") diff --git a/Tests/RunCMake/CTestMemcheck/testMemorySanitizer.cmake b/Tests/RunCMake/CTestMemcheck/testMemorySanitizer.cmake new file mode 100644 index 0000000..c87af9a --- /dev/null +++ b/Tests/RunCMake/CTestMemcheck/testMemorySanitizer.cmake @@ -0,0 +1,27 @@ +# this file simulates a program that has been built with thread sanitizer +# options + +message("MSAN_OPTIONS = [$ENV{MSAN_OPTIONS}]") +string(REGEX REPLACE ".*log_path=\"([^\"]*)\".*" "\\1" LOG_FILE "$ENV{MSAN_OPTIONS}") +message("LOG_FILE=[${LOG_FILE}]") + +# if we are not asked to simulate address sanitizer don't do it +if(NOT "$ENV{MSAN_OPTIONS}]" MATCHES "simulate_sanitizer.1") + return() +endif() +# clear the log file +file(REMOVE "${LOG_FILE}.2343") + +# create an error of each type of thread santizer +# these names come from tsan_report.cc in llvm + +file(APPEND "${LOG_FILE}.2343" +"================================================================= +==28423== WARNING: MemorySanitizer: use-of-uninitialized-value + #0 0x7f4364210dd9 in main (/home/kitware/msan/msan-bin/umr+0x7bdd9) + #1 0x7f4362d9376c in __libc_start_main /build/buildd/eglibc-2.15/csu/libc-start.c:226 + #2 0x7f4364210b0c in _start (/home/kitware/msan/msan-bin/umr+0x7bb0c) + +SUMMARY: MemorySanitizer: use-of-uninitialized-value ??:0 main +Exiting +") diff --git a/Tests/RunCMake/CTestMemcheck/testThreadSanitizer.cmake b/Tests/RunCMake/CTestMemcheck/testThreadSanitizer.cmake new file mode 100644 index 0000000..d591931 --- /dev/null +++ b/Tests/RunCMake/CTestMemcheck/testThreadSanitizer.cmake @@ -0,0 +1,47 @@ +# this file simulates a program that has been built with thread sanitizer +# options + +message("TSAN_OPTIONS = [$ENV{TSAN_OPTIONS}]") +string(REGEX REPLACE ".*log_path=\"([^\"]*)\".*" "\\1" LOG_FILE "$ENV{TSAN_OPTIONS}") +message("LOG_FILE=[${LOG_FILE}]") + +set(error_types + "data race" + "data race on vptr (ctor/dtor vs virtual call)" + "heap-use-after-free" + "thread leak" + "destroy of a locked mutex" + "double lock of a mutex" + "unlock of an unlocked mutex (or by a wrong thread)" + "read lock of a write locked mutex" + "read unlock of a write locked mutex" + "signal-unsafe call inside of a signal" + "signal handler spoils errno" + "lock-order-inversion (potential deadlock)" + ) + +# clear the log file +file(REMOVE "${LOG_FILE}.2343") + +# create an error of each type of thread santizer +# these names come from tsan_report.cc in llvm +foreach(error_type ${error_types} ) + + file(APPEND "${LOG_FILE}.2343" +"================== +WARNING: ThreadSanitizer: ${error_type} (pid=27978) + Write of size 4 at 0x7fe017ce906c by thread T1: + #0 Thread1 ??:0 (exe+0x000000000bb0) + #1 :0 (libtsan.so.0+0x00000001b279) + + Previous write of size 4 at 0x7fe017ce906c by main thread: + #0 main ??:0 (exe+0x000000000c3c) + + Thread T1 (tid=27979, running) created by main thread at: + #0 :0 (libtsan.so.0+0x00000001ed7b) + #1 main ??:0 (exe+0x000000000c2c) + +SUMMARY: ThreadSanitizer: ${error_type} ??:0 Thread1 +================== +") +endforeach() diff --git a/Tests/RunCMake/CTestMemcheck/testUndefinedBehaviorSanitizer.cmake b/Tests/RunCMake/CTestMemcheck/testUndefinedBehaviorSanitizer.cmake new file mode 100644 index 0000000..8ef3c0a --- /dev/null +++ b/Tests/RunCMake/CTestMemcheck/testUndefinedBehaviorSanitizer.cmake @@ -0,0 +1,21 @@ +# this file simulates a program that has been built with undefined behavior +# sanitizer options + +message("UBSAN_OPTIONS = [$ENV{UBSAN_OPTIONS}]") +string(REGEX REPLACE ".*log_path=\"([^\"]*)\".*" "\\1" LOG_FILE "$ENV{UBSAN_OPTIONS}") +message("LOG_FILE=[${LOG_FILE}]") + +# if we are not asked to simulate address sanitizer don't do it +if(NOT "$ENV{UBSAN_OPTIONS}]" MATCHES "simulate_sanitizer.1") + return() +endif() +# clear the log file +file(REMOVE "${LOG_FILE}.2343") + +# create an error like undefined behavior santizer creates; +# these names come from ubsan_diag.cc and ubsan_handlers.cc +# in llvm + +file(APPEND "${LOG_FILE}.2343" +": runtime error: left shift of negative value -256 +") -- cgit v0.12