diff options
author | Brad King <brad.king@kitware.com> | 2015-02-19 16:35:51 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2015-02-19 16:35:51 (GMT) |
commit | 1d82105e29fc6f0bb71a474f876a7553b397cc26 (patch) | |
tree | 25918c24cedd897673f5f326497ad2b5f836a49f /Tests/RunCMake/ctest_memcheck | |
parent | d7662141a771f105e64b56543d99ee43e7d00849 (diff) | |
download | CMake-1d82105e29fc6f0bb71a474f876a7553b397cc26.zip CMake-1d82105e29fc6f0bb71a474f876a7553b397cc26.tar.gz CMake-1d82105e29fc6f0bb71a474f876a7553b397cc26.tar.bz2 |
Tests: Rename RunCMake.{CTestMemcheck => ctest_memcheck}
Follow the convention of naming tests after the command they test.
Diffstat (limited to 'Tests/RunCMake/ctest_memcheck')
69 files changed, 521 insertions, 0 deletions
diff --git a/Tests/RunCMake/ctest_memcheck/CMakeLists.txt.in b/Tests/RunCMake/ctest_memcheck/CMakeLists.txt.in new file mode 100644 index 0000000..3b8edf4 --- /dev/null +++ b/Tests/RunCMake/ctest_memcheck/CMakeLists.txt.in @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 2.8.9) +project(CTestTestMemcheck@CASE_NAME@ NONE) +include(CTest) + +add_test(NAME RunCMake COMMAND "${CMAKE_COMMAND}" --version) + +@CMAKELISTS_EXTRA_CODE@ diff --git a/Tests/RunCMake/ctest_memcheck/CTestConfig.cmake.in b/Tests/RunCMake/ctest_memcheck/CTestConfig.cmake.in new file mode 100644 index 0000000..6d4a718 --- /dev/null +++ b/Tests/RunCMake/ctest_memcheck/CTestConfig.cmake.in @@ -0,0 +1,9 @@ +set (CTEST_PROJECT_NAME "CTestTestMemcheck@CASE_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/ctest_memcheck/DummyAddressSanitizer-result.txt b/Tests/RunCMake/ctest_memcheck/DummyAddressSanitizer-result.txt new file mode 100644 index 0000000..b57e2de --- /dev/null +++ b/Tests/RunCMake/ctest_memcheck/DummyAddressSanitizer-result.txt @@ -0,0 +1 @@ +(-1|255) diff --git a/Tests/RunCMake/ctest_memcheck/DummyAddressSanitizer-stderr.txt b/Tests/RunCMake/ctest_memcheck/DummyAddressSanitizer-stderr.txt new file mode 100644 index 0000000..00f4779 --- /dev/null +++ b/Tests/RunCMake/ctest_memcheck/DummyAddressSanitizer-stderr.txt @@ -0,0 +1,2 @@ +Cannot find memory tester output file: .*/Tests/RunCMake/ctest_memcheck/DummyAddressSanitizer-build/Testing/Temporary/MemoryChecker.1.log\.\* +Error in read script: .*/Tests/RunCMake/ctest_memcheck/DummyAddressSanitizer/test.cmake diff --git a/Tests/RunCMake/ctest_memcheck/DummyAddressSanitizer-stdout.txt b/Tests/RunCMake/ctest_memcheck/DummyAddressSanitizer-stdout.txt new file mode 100644 index 0000000..1d255d0 --- /dev/null +++ b/Tests/RunCMake/ctest_memcheck/DummyAddressSanitizer-stdout.txt @@ -0,0 +1,2 @@ +Memory checking results: +heap-buffer-overflow - 1 diff --git a/Tests/RunCMake/ctest_memcheck/DummyBC-result.txt b/Tests/RunCMake/ctest_memcheck/DummyBC-result.txt new file mode 100644 index 0000000..b57e2de --- /dev/null +++ b/Tests/RunCMake/ctest_memcheck/DummyBC-result.txt @@ -0,0 +1 @@ +(-1|255) diff --git a/Tests/RunCMake/ctest_memcheck/DummyBC-stderr.txt b/Tests/RunCMake/ctest_memcheck/DummyBC-stderr.txt new file mode 100644 index 0000000..24f536a --- /dev/null +++ b/Tests/RunCMake/ctest_memcheck/DummyBC-stderr.txt @@ -0,0 +1 @@ +Error parsing XML in stream at line 1: no element found diff --git a/Tests/RunCMake/ctest_memcheck/DummyBC-stdout.txt b/Tests/RunCMake/ctest_memcheck/DummyBC-stdout.txt new file mode 100644 index 0000000..5829613 --- /dev/null +++ b/Tests/RunCMake/ctest_memcheck/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/ctest_memcheck/DummyBCNoLogFile-result.txt b/Tests/RunCMake/ctest_memcheck/DummyBCNoLogFile-result.txt new file mode 100644 index 0000000..b57e2de --- /dev/null +++ b/Tests/RunCMake/ctest_memcheck/DummyBCNoLogFile-result.txt @@ -0,0 +1 @@ +(-1|255) diff --git a/Tests/RunCMake/ctest_memcheck/DummyBCNoLogFile-stderr.txt b/Tests/RunCMake/ctest_memcheck/DummyBCNoLogFile-stderr.txt new file mode 100644 index 0000000..5c582ac --- /dev/null +++ b/Tests/RunCMake/ctest_memcheck/DummyBCNoLogFile-stderr.txt @@ -0,0 +1,3 @@ +Cannot find memory tester output file: .*/Tests/RunCMake/ctest_memcheck/DummyBCNoLogFile-build/Testing/Temporary/MemoryChecker.1.log +.*Error parsing XML in stream at line 1: no element found +Error in read script: .*/Tests/RunCMake/ctest_memcheck/DummyBCNoLogFile/test.cmake diff --git a/Tests/RunCMake/ctest_memcheck/DummyBCNoLogFile-stdout.txt b/Tests/RunCMake/ctest_memcheck/DummyBCNoLogFile-stdout.txt new file mode 100644 index 0000000..5829613 --- /dev/null +++ b/Tests/RunCMake/ctest_memcheck/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/ctest_memcheck/DummyLeakSanitizer-result.txt b/Tests/RunCMake/ctest_memcheck/DummyLeakSanitizer-result.txt new file mode 100644 index 0000000..b57e2de --- /dev/null +++ b/Tests/RunCMake/ctest_memcheck/DummyLeakSanitizer-result.txt @@ -0,0 +1 @@ +(-1|255) diff --git a/Tests/RunCMake/ctest_memcheck/DummyLeakSanitizer-stderr.txt b/Tests/RunCMake/ctest_memcheck/DummyLeakSanitizer-stderr.txt new file mode 100644 index 0000000..c099340 --- /dev/null +++ b/Tests/RunCMake/ctest_memcheck/DummyLeakSanitizer-stderr.txt @@ -0,0 +1,2 @@ +Cannot find memory tester output file: .*/Tests/RunCMake/ctest_memcheck/DummyLeakSanitizer-build/Testing/Temporary/MemoryChecker.1.log\.\* +Error in read script: .*/Tests/RunCMake/ctest_memcheck/DummyLeakSanitizer/test.cmake diff --git a/Tests/RunCMake/ctest_memcheck/DummyLeakSanitizer-stdout.txt b/Tests/RunCMake/ctest_memcheck/DummyLeakSanitizer-stdout.txt new file mode 100644 index 0000000..97a8a9b --- /dev/null +++ b/Tests/RunCMake/ctest_memcheck/DummyLeakSanitizer-stdout.txt @@ -0,0 +1,3 @@ +Memory checking results: +Direct leak - 2 +Indirect leak - 1 diff --git a/Tests/RunCMake/ctest_memcheck/DummyMemorySanitizer-result.txt b/Tests/RunCMake/ctest_memcheck/DummyMemorySanitizer-result.txt new file mode 100644 index 0000000..b57e2de --- /dev/null +++ b/Tests/RunCMake/ctest_memcheck/DummyMemorySanitizer-result.txt @@ -0,0 +1 @@ +(-1|255) diff --git a/Tests/RunCMake/ctest_memcheck/DummyMemorySanitizer-stderr.txt b/Tests/RunCMake/ctest_memcheck/DummyMemorySanitizer-stderr.txt new file mode 100644 index 0000000..6c42ec1 --- /dev/null +++ b/Tests/RunCMake/ctest_memcheck/DummyMemorySanitizer-stderr.txt @@ -0,0 +1,2 @@ +Cannot find memory tester output file: .*/Tests/RunCMake/ctest_memcheck/DummyMemorySanitizer-build/Testing/Temporary/MemoryChecker.1.log\.\* +Error in read script: .*/Tests/RunCMake/ctest_memcheck/DummyMemorySanitizer/test.cmake diff --git a/Tests/RunCMake/ctest_memcheck/DummyMemorySanitizer-stdout.txt b/Tests/RunCMake/ctest_memcheck/DummyMemorySanitizer-stdout.txt new file mode 100644 index 0000000..64390c7 --- /dev/null +++ b/Tests/RunCMake/ctest_memcheck/DummyMemorySanitizer-stdout.txt @@ -0,0 +1,2 @@ +Memory checking results: +use-of-uninitialized-value - 1 diff --git a/Tests/RunCMake/ctest_memcheck/DummyPurify-result.txt b/Tests/RunCMake/ctest_memcheck/DummyPurify-result.txt new file mode 100644 index 0000000..573541a --- /dev/null +++ b/Tests/RunCMake/ctest_memcheck/DummyPurify-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/ctest_memcheck/DummyPurify-stderr.txt b/Tests/RunCMake/ctest_memcheck/DummyPurify-stderr.txt new file mode 100644 index 0000000..14bc228 --- /dev/null +++ b/Tests/RunCMake/ctest_memcheck/DummyPurify-stderr.txt @@ -0,0 +1,3 @@ +^((^| +)(BullseyeCoverage|==|ctest\([0-9]+\) malloc:)[^ +]*)*$ diff --git a/Tests/RunCMake/ctest_memcheck/DummyPurify-stdout.txt b/Tests/RunCMake/ctest_memcheck/DummyPurify-stdout.txt new file mode 100644 index 0000000..dabb004 --- /dev/null +++ b/Tests/RunCMake/ctest_memcheck/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/ctest_memcheck/DummyPurifyNoLogFile-result.txt b/Tests/RunCMake/ctest_memcheck/DummyPurifyNoLogFile-result.txt new file mode 100644 index 0000000..b57e2de --- /dev/null +++ b/Tests/RunCMake/ctest_memcheck/DummyPurifyNoLogFile-result.txt @@ -0,0 +1 @@ +(-1|255) diff --git a/Tests/RunCMake/ctest_memcheck/DummyPurifyNoLogFile-stderr.txt b/Tests/RunCMake/ctest_memcheck/DummyPurifyNoLogFile-stderr.txt new file mode 100644 index 0000000..41120b5 --- /dev/null +++ b/Tests/RunCMake/ctest_memcheck/DummyPurifyNoLogFile-stderr.txt @@ -0,0 +1,2 @@ +Cannot find memory tester output file: .*/Tests/RunCMake/ctest_memcheck/DummyPurifyNoLogFile-build/Testing/Temporary/MemoryChecker.1.log +Error in read script: .*/Tests/RunCMake/ctest_memcheck/DummyPurifyNoLogFile/test.cmake diff --git a/Tests/RunCMake/ctest_memcheck/DummyPurifyNoLogFile-stdout.txt b/Tests/RunCMake/ctest_memcheck/DummyPurifyNoLogFile-stdout.txt new file mode 100644 index 0000000..5829613 --- /dev/null +++ b/Tests/RunCMake/ctest_memcheck/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/ctest_memcheck/DummyThreadSanitizer-result.txt b/Tests/RunCMake/ctest_memcheck/DummyThreadSanitizer-result.txt new file mode 100644 index 0000000..b57e2de --- /dev/null +++ b/Tests/RunCMake/ctest_memcheck/DummyThreadSanitizer-result.txt @@ -0,0 +1 @@ +(-1|255) diff --git a/Tests/RunCMake/ctest_memcheck/DummyThreadSanitizer-stderr.txt b/Tests/RunCMake/ctest_memcheck/DummyThreadSanitizer-stderr.txt new file mode 100644 index 0000000..cb353ad --- /dev/null +++ b/Tests/RunCMake/ctest_memcheck/DummyThreadSanitizer-stderr.txt @@ -0,0 +1,2 @@ +Cannot find memory tester output file: .*/Tests/RunCMake/ctest_memcheck/DummyThreadSanitizer-build/Testing/Temporary/MemoryChecker.1.log\.\* +Error in read script: .*/Tests/RunCMake/ctest_memcheck/DummyThreadSanitizer/test.cmake diff --git a/Tests/RunCMake/ctest_memcheck/DummyThreadSanitizer-stdout.txt b/Tests/RunCMake/ctest_memcheck/DummyThreadSanitizer-stdout.txt new file mode 100644 index 0000000..c3af1f9 --- /dev/null +++ b/Tests/RunCMake/ctest_memcheck/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/ctest_memcheck/DummyUndefinedBehaviorSanitizer-result.txt b/Tests/RunCMake/ctest_memcheck/DummyUndefinedBehaviorSanitizer-result.txt new file mode 100644 index 0000000..b57e2de --- /dev/null +++ b/Tests/RunCMake/ctest_memcheck/DummyUndefinedBehaviorSanitizer-result.txt @@ -0,0 +1 @@ +(-1|255) diff --git a/Tests/RunCMake/ctest_memcheck/DummyUndefinedBehaviorSanitizer-stderr.txt b/Tests/RunCMake/ctest_memcheck/DummyUndefinedBehaviorSanitizer-stderr.txt new file mode 100644 index 0000000..7ce798c --- /dev/null +++ b/Tests/RunCMake/ctest_memcheck/DummyUndefinedBehaviorSanitizer-stderr.txt @@ -0,0 +1,2 @@ +Cannot find memory tester output file: .*/Tests/RunCMake/ctest_memcheck/DummyUndefinedBehaviorSanitizer-build/Testing/Temporary/MemoryChecker.1.log\.\* +Error in read script: .*/Tests/RunCMake/ctest_memcheck/DummyUndefinedBehaviorSanitizer/test.cmake diff --git a/Tests/RunCMake/ctest_memcheck/DummyUndefinedBehaviorSanitizer-stdout.txt b/Tests/RunCMake/ctest_memcheck/DummyUndefinedBehaviorSanitizer-stdout.txt new file mode 100644 index 0000000..b3473bf --- /dev/null +++ b/Tests/RunCMake/ctest_memcheck/DummyUndefinedBehaviorSanitizer-stdout.txt @@ -0,0 +1,2 @@ +Memory checking results: +left shift of negative value -256 - 1 diff --git a/Tests/RunCMake/ctest_memcheck/DummyValgrind-result.txt b/Tests/RunCMake/ctest_memcheck/DummyValgrind-result.txt new file mode 100644 index 0000000..573541a --- /dev/null +++ b/Tests/RunCMake/ctest_memcheck/DummyValgrind-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/ctest_memcheck/DummyValgrind-stderr.txt b/Tests/RunCMake/ctest_memcheck/DummyValgrind-stderr.txt new file mode 100644 index 0000000..14bc228 --- /dev/null +++ b/Tests/RunCMake/ctest_memcheck/DummyValgrind-stderr.txt @@ -0,0 +1,3 @@ +^((^| +)(BullseyeCoverage|==|ctest\([0-9]+\) malloc:)[^ +]*)*$ diff --git a/Tests/RunCMake/ctest_memcheck/DummyValgrind-stdout.txt b/Tests/RunCMake/ctest_memcheck/DummyValgrind-stdout.txt new file mode 100644 index 0000000..dabb004 --- /dev/null +++ b/Tests/RunCMake/ctest_memcheck/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/ctest_memcheck/DummyValgrindCustomOptions-result.txt b/Tests/RunCMake/ctest_memcheck/DummyValgrindCustomOptions-result.txt new file mode 100644 index 0000000..b57e2de --- /dev/null +++ b/Tests/RunCMake/ctest_memcheck/DummyValgrindCustomOptions-result.txt @@ -0,0 +1 @@ +(-1|255) diff --git a/Tests/RunCMake/ctest_memcheck/DummyValgrindCustomOptions-stderr.txt b/Tests/RunCMake/ctest_memcheck/DummyValgrindCustomOptions-stderr.txt new file mode 100644 index 0000000..97bb833 --- /dev/null +++ b/Tests/RunCMake/ctest_memcheck/DummyValgrindCustomOptions-stderr.txt @@ -0,0 +1,2 @@ +Cannot find memory tester output file: .*/Tests/RunCMake/ctest_memcheck/DummyValgrindCustomOptions-build/Testing/Temporary/MemoryChecker.1.log +Error in read script: .*/Tests/RunCMake/ctest_memcheck/DummyValgrindCustomOptions/test.cmake diff --git a/Tests/RunCMake/ctest_memcheck/DummyValgrindCustomOptions-stdout.txt b/Tests/RunCMake/ctest_memcheck/DummyValgrindCustomOptions-stdout.txt new file mode 100644 index 0000000..dabb004 --- /dev/null +++ b/Tests/RunCMake/ctest_memcheck/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/ctest_memcheck/DummyValgrindFailPost-result.txt b/Tests/RunCMake/ctest_memcheck/DummyValgrindFailPost-result.txt new file mode 100644 index 0000000..b57e2de --- /dev/null +++ b/Tests/RunCMake/ctest_memcheck/DummyValgrindFailPost-result.txt @@ -0,0 +1 @@ +(-1|255) diff --git a/Tests/RunCMake/ctest_memcheck/DummyValgrindFailPost-stderr.txt b/Tests/RunCMake/ctest_memcheck/DummyValgrindFailPost-stderr.txt new file mode 100644 index 0000000..0c997ff --- /dev/null +++ b/Tests/RunCMake/ctest_memcheck/DummyValgrindFailPost-stderr.txt @@ -0,0 +1,3 @@ +Problem running command: .*memcheck_fail.* +Problem executing post-memcheck command\(s\). +Error in read script: .*/Tests/RunCMake/ctest_memcheck/DummyValgrindFailPost/test.cmake diff --git a/Tests/RunCMake/ctest_memcheck/DummyValgrindFailPost-stdout.txt b/Tests/RunCMake/ctest_memcheck/DummyValgrindFailPost-stdout.txt new file mode 100644 index 0000000..dabb004 --- /dev/null +++ b/Tests/RunCMake/ctest_memcheck/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/ctest_memcheck/DummyValgrindFailPre-result.txt b/Tests/RunCMake/ctest_memcheck/DummyValgrindFailPre-result.txt new file mode 100644 index 0000000..b57e2de --- /dev/null +++ b/Tests/RunCMake/ctest_memcheck/DummyValgrindFailPre-result.txt @@ -0,0 +1 @@ +(-1|255) diff --git a/Tests/RunCMake/ctest_memcheck/DummyValgrindFailPre-stderr.txt b/Tests/RunCMake/ctest_memcheck/DummyValgrindFailPre-stderr.txt new file mode 100644 index 0000000..1d1b1e7 --- /dev/null +++ b/Tests/RunCMake/ctest_memcheck/DummyValgrindFailPre-stderr.txt @@ -0,0 +1,3 @@ +Problem running command: .*memcheck_fail.* +Problem executing pre-memcheck command\(s\). +Error in read script: .*/Tests/RunCMake/ctest_memcheck/DummyValgrindFailPre/test.cmake diff --git a/Tests/RunCMake/ctest_memcheck/DummyValgrindFailPre-stdout.txt b/Tests/RunCMake/ctest_memcheck/DummyValgrindFailPre-stdout.txt new file mode 100644 index 0000000..8d8b7e9 --- /dev/null +++ b/Tests/RunCMake/ctest_memcheck/DummyValgrindFailPre-stdout.txt @@ -0,0 +1 @@ +Memory check project .*/Tests/RunCMake/ctest_memcheck/DummyValgrindFailPre-build diff --git a/Tests/RunCMake/ctest_memcheck/DummyValgrindIgnoreMemcheck-result.txt b/Tests/RunCMake/ctest_memcheck/DummyValgrindIgnoreMemcheck-result.txt new file mode 100644 index 0000000..573541a --- /dev/null +++ b/Tests/RunCMake/ctest_memcheck/DummyValgrindIgnoreMemcheck-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/ctest_memcheck/DummyValgrindIgnoreMemcheck-stderr.txt b/Tests/RunCMake/ctest_memcheck/DummyValgrindIgnoreMemcheck-stderr.txt new file mode 100644 index 0000000..14bc228 --- /dev/null +++ b/Tests/RunCMake/ctest_memcheck/DummyValgrindIgnoreMemcheck-stderr.txt @@ -0,0 +1,3 @@ +^((^| +)(BullseyeCoverage|==|ctest\([0-9]+\) malloc:)[^ +]*)*$ diff --git a/Tests/RunCMake/ctest_memcheck/DummyValgrindIgnoreMemcheck-stdout.txt b/Tests/RunCMake/ctest_memcheck/DummyValgrindIgnoreMemcheck-stdout.txt new file mode 100644 index 0000000..5a5675c --- /dev/null +++ b/Tests/RunCMake/ctest_memcheck/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/ctest_memcheck/DummyValgrindInvalidSupFile-result.txt b/Tests/RunCMake/ctest_memcheck/DummyValgrindInvalidSupFile-result.txt new file mode 100644 index 0000000..b57e2de --- /dev/null +++ b/Tests/RunCMake/ctest_memcheck/DummyValgrindInvalidSupFile-result.txt @@ -0,0 +1 @@ +(-1|255) diff --git a/Tests/RunCMake/ctest_memcheck/DummyValgrindInvalidSupFile-stderr.txt b/Tests/RunCMake/ctest_memcheck/DummyValgrindInvalidSupFile-stderr.txt new file mode 100644 index 0000000..65beb81 --- /dev/null +++ b/Tests/RunCMake/ctest_memcheck/DummyValgrindInvalidSupFile-stderr.txt @@ -0,0 +1,2 @@ +Cannot find memory checker suppression file: .*/Tests/RunCMake/ctest_memcheck/DummyValgrindInvalidSupFile-build/does-not-exist +Error in read script: .*/Tests/RunCMake/ctest_memcheck/DummyValgrindInvalidSupFile/test.cmake diff --git a/Tests/RunCMake/ctest_memcheck/DummyValgrindInvalidSupFile-stdout.txt b/Tests/RunCMake/ctest_memcheck/DummyValgrindInvalidSupFile-stdout.txt new file mode 100644 index 0000000..4c58df4 --- /dev/null +++ b/Tests/RunCMake/ctest_memcheck/DummyValgrindInvalidSupFile-stdout.txt @@ -0,0 +1 @@ +Memory check project .*/Tests/RunCMake/ctest_memcheck/DummyValgrindInvalidSupFile-build$ diff --git a/Tests/RunCMake/ctest_memcheck/DummyValgrindNoLogFile-result.txt b/Tests/RunCMake/ctest_memcheck/DummyValgrindNoLogFile-result.txt new file mode 100644 index 0000000..b57e2de --- /dev/null +++ b/Tests/RunCMake/ctest_memcheck/DummyValgrindNoLogFile-result.txt @@ -0,0 +1 @@ +(-1|255) diff --git a/Tests/RunCMake/ctest_memcheck/DummyValgrindNoLogFile-stderr.txt b/Tests/RunCMake/ctest_memcheck/DummyValgrindNoLogFile-stderr.txt new file mode 100644 index 0000000..e2a836f --- /dev/null +++ b/Tests/RunCMake/ctest_memcheck/DummyValgrindNoLogFile-stderr.txt @@ -0,0 +1,2 @@ +Cannot find memory tester output file: .*/Tests/RunCMake/ctest_memcheck/DummyValgrindNoLogFile-build/Testing/Temporary/MemoryChecker.1.log +Error in read script: .*/Tests/RunCMake/ctest_memcheck/DummyValgrindNoLogFile/test.cmake diff --git a/Tests/RunCMake/ctest_memcheck/DummyValgrindNoLogFile-stdout.txt b/Tests/RunCMake/ctest_memcheck/DummyValgrindNoLogFile-stdout.txt new file mode 100644 index 0000000..5829613 --- /dev/null +++ b/Tests/RunCMake/ctest_memcheck/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/ctest_memcheck/DummyValgrindPrePost-result.txt b/Tests/RunCMake/ctest_memcheck/DummyValgrindPrePost-result.txt new file mode 100644 index 0000000..573541a --- /dev/null +++ b/Tests/RunCMake/ctest_memcheck/DummyValgrindPrePost-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/ctest_memcheck/DummyValgrindPrePost-stderr.txt b/Tests/RunCMake/ctest_memcheck/DummyValgrindPrePost-stderr.txt new file mode 100644 index 0000000..14bc228 --- /dev/null +++ b/Tests/RunCMake/ctest_memcheck/DummyValgrindPrePost-stderr.txt @@ -0,0 +1,3 @@ +^((^| +)(BullseyeCoverage|==|ctest\([0-9]+\) malloc:)[^ +]*)*$ diff --git a/Tests/RunCMake/ctest_memcheck/DummyValgrindPrePost-stdout.txt b/Tests/RunCMake/ctest_memcheck/DummyValgrindPrePost-stdout.txt new file mode 100644 index 0000000..dabb004 --- /dev/null +++ b/Tests/RunCMake/ctest_memcheck/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/ctest_memcheck/DummyValgrindTwoTargets-result.txt b/Tests/RunCMake/ctest_memcheck/DummyValgrindTwoTargets-result.txt new file mode 100644 index 0000000..573541a --- /dev/null +++ b/Tests/RunCMake/ctest_memcheck/DummyValgrindTwoTargets-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/ctest_memcheck/DummyValgrindTwoTargets-stderr.txt b/Tests/RunCMake/ctest_memcheck/DummyValgrindTwoTargets-stderr.txt new file mode 100644 index 0000000..14bc228 --- /dev/null +++ b/Tests/RunCMake/ctest_memcheck/DummyValgrindTwoTargets-stderr.txt @@ -0,0 +1,3 @@ +^((^| +)(BullseyeCoverage|==|ctest\([0-9]+\) malloc:)[^ +]*)*$ diff --git a/Tests/RunCMake/ctest_memcheck/DummyValgrindTwoTargets-stdout.txt b/Tests/RunCMake/ctest_memcheck/DummyValgrindTwoTargets-stdout.txt new file mode 100644 index 0000000..3e0fdb2 --- /dev/null +++ b/Tests/RunCMake/ctest_memcheck/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/ctest_memcheck/NotExist-result.txt b/Tests/RunCMake/ctest_memcheck/NotExist-result.txt new file mode 100644 index 0000000..573541a --- /dev/null +++ b/Tests/RunCMake/ctest_memcheck/NotExist-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/ctest_memcheck/NotExist-stderr.txt b/Tests/RunCMake/ctest_memcheck/NotExist-stderr.txt new file mode 100644 index 0000000..0af5b7a --- /dev/null +++ b/Tests/RunCMake/ctest_memcheck/NotExist-stderr.txt @@ -0,0 +1 @@ +Memory checker \(MemoryCheckCommand\) not set, or cannot find the specified program\. diff --git a/Tests/RunCMake/ctest_memcheck/NotExist-stdout.txt b/Tests/RunCMake/ctest_memcheck/NotExist-stdout.txt new file mode 100644 index 0000000..0e58936 --- /dev/null +++ b/Tests/RunCMake/ctest_memcheck/NotExist-stdout.txt @@ -0,0 +1 @@ +Memory check project .*/Tests/RunCMake/ctest_memcheck/NotExist-build$ diff --git a/Tests/RunCMake/ctest_memcheck/RunCMakeTest.cmake b/Tests/RunCMake/ctest_memcheck/RunCMakeTest.cmake new file mode 100644 index 0000000..b1793fa --- /dev/null +++ b/Tests/RunCMake/ctest_memcheck/RunCMakeTest.cmake @@ -0,0 +1,132 @@ +include(RunCTest) + +set(SITE test-site) +set(BUILDNAME test-build) +set(COVERAGE_COMMAND "") + +function(run_mc_test CASE_NAME CHECKER_COMMAND) + run_ctest(${CASE_NAME} ${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/ctest_memcheck/Unknown-result.txt b/Tests/RunCMake/ctest_memcheck/Unknown-result.txt new file mode 100644 index 0000000..b57e2de --- /dev/null +++ b/Tests/RunCMake/ctest_memcheck/Unknown-result.txt @@ -0,0 +1 @@ +(-1|255) diff --git a/Tests/RunCMake/ctest_memcheck/Unknown-stderr.txt b/Tests/RunCMake/ctest_memcheck/Unknown-stderr.txt new file mode 100644 index 0000000..99df8b3 --- /dev/null +++ b/Tests/RunCMake/ctest_memcheck/Unknown-stderr.txt @@ -0,0 +1,2 @@ +Do not understand memory checker: .*/cmake.* +Error in read script: .*/Tests/RunCMake/ctest_memcheck/Unknown/test.cmake diff --git a/Tests/RunCMake/ctest_memcheck/Unknown-stdout.txt b/Tests/RunCMake/ctest_memcheck/Unknown-stdout.txt new file mode 100644 index 0000000..0208e80 --- /dev/null +++ b/Tests/RunCMake/ctest_memcheck/Unknown-stdout.txt @@ -0,0 +1 @@ +Memory check project .*/Tests/RunCMake/ctest_memcheck/Unknown-build$ diff --git a/Tests/RunCMake/ctest_memcheck/test.cmake.in b/Tests/RunCMake/ctest_memcheck/test.cmake.in new file mode 100644 index 0000000..f9c1ba9 --- /dev/null +++ b/Tests/RunCMake/ctest_memcheck/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@CASE_NAME@") + +set(CTEST_SOURCE_DIRECTORY "@RunCMake_BINARY_DIR@/@CASE_NAME@") +set(CTEST_BINARY_DIRECTORY "@RunCMake_BINARY_DIR@/@CASE_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/ctest_memcheck/testAddressSanitizer.cmake b/Tests/RunCMake/ctest_memcheck/testAddressSanitizer.cmake new file mode 100644 index 0000000..3082e4b --- /dev/null +++ b/Tests/RunCMake/ctest_memcheck/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/ctest_memcheck/testLeakSanitizer.cmake b/Tests/RunCMake/ctest_memcheck/testLeakSanitizer.cmake new file mode 100644 index 0000000..02030be --- /dev/null +++ b/Tests/RunCMake/ctest_memcheck/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/ctest_memcheck/testMemorySanitizer.cmake b/Tests/RunCMake/ctest_memcheck/testMemorySanitizer.cmake new file mode 100644 index 0000000..c87af9a --- /dev/null +++ b/Tests/RunCMake/ctest_memcheck/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/ctest_memcheck/testThreadSanitizer.cmake b/Tests/RunCMake/ctest_memcheck/testThreadSanitizer.cmake new file mode 100644 index 0000000..d591931 --- /dev/null +++ b/Tests/RunCMake/ctest_memcheck/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 <null> <null>: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 <null> <null>:0 (libtsan.so.0+0x00000001ed7b) + #1 main ??:0 (exe+0x000000000c2c) + +SUMMARY: ThreadSanitizer: ${error_type} ??:0 Thread1 +================== +") +endforeach() diff --git a/Tests/RunCMake/ctest_memcheck/testUndefinedBehaviorSanitizer.cmake b/Tests/RunCMake/ctest_memcheck/testUndefinedBehaviorSanitizer.cmake new file mode 100644 index 0000000..8ef3c0a --- /dev/null +++ b/Tests/RunCMake/ctest_memcheck/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" +"<unknown>: runtime error: left shift of negative value -256 +") |