[compiler-rt] r367803 - compiler-rt: Rename .cc file in test/lsan to .cpp
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 5 00:04:43 PDT 2019
Author: maskray
Date: Mon Aug 5 00:04:42 2019
New Revision: 367803
URL: http://llvm.org/viewvc/llvm-project?rev=367803&view=rev
Log:
compiler-rt: Rename .cc file in test/lsan to .cpp
Like r367463, but for test/lsan.
Added:
compiler-rt/trunk/test/lsan/TestCases/Linux/fork.cpp
- copied, changed from r367705, compiler-rt/trunk/test/lsan/TestCases/Linux/fork.cc
compiler-rt/trunk/test/lsan/TestCases/Linux/fork_and_leak.cpp
- copied, changed from r367705, compiler-rt/trunk/test/lsan/TestCases/Linux/fork_and_leak.cc
compiler-rt/trunk/test/lsan/TestCases/Linux/fork_threaded.cpp
- copied, changed from r367705, compiler-rt/trunk/test/lsan/TestCases/Linux/fork_threaded.cc
compiler-rt/trunk/test/lsan/TestCases/Linux/log-path_test.cpp
- copied, changed from r367705, compiler-rt/trunk/test/lsan/TestCases/Linux/log-path_test.cc
compiler-rt/trunk/test/lsan/TestCases/Linux/use_tls_dynamic.cpp
- copied, changed from r367705, compiler-rt/trunk/test/lsan/TestCases/Linux/use_tls_dynamic.cc
compiler-rt/trunk/test/lsan/TestCases/Linux/use_tls_pthread_specific_dynamic.cpp
- copied, changed from r367705, compiler-rt/trunk/test/lsan/TestCases/Linux/use_tls_pthread_specific_dynamic.cc
compiler-rt/trunk/test/lsan/TestCases/Linux/use_tls_pthread_specific_static.cpp
- copied, changed from r367705, compiler-rt/trunk/test/lsan/TestCases/Linux/use_tls_pthread_specific_static.cc
compiler-rt/trunk/test/lsan/TestCases/Linux/use_tls_static.cpp
- copied, changed from r367705, compiler-rt/trunk/test/lsan/TestCases/Linux/use_tls_static.cc
compiler-rt/trunk/test/lsan/TestCases/default_options.cpp
- copied, changed from r367705, compiler-rt/trunk/test/lsan/TestCases/default_options.cc
compiler-rt/trunk/test/lsan/TestCases/disabler.cpp
- copied, changed from r367705, compiler-rt/trunk/test/lsan/TestCases/disabler.cc
compiler-rt/trunk/test/lsan/TestCases/do_leak_check_override.cpp
- copied, changed from r367705, compiler-rt/trunk/test/lsan/TestCases/do_leak_check_override.cc
compiler-rt/trunk/test/lsan/TestCases/high_allocator_contention.cpp
- copied, changed from r367705, compiler-rt/trunk/test/lsan/TestCases/high_allocator_contention.cc
compiler-rt/trunk/test/lsan/TestCases/ignore_object_errors.cpp
- copied, changed from r367705, compiler-rt/trunk/test/lsan/TestCases/ignore_object_errors.cc
compiler-rt/trunk/test/lsan/TestCases/large_allocation_leak.cpp
- copied, changed from r367705, compiler-rt/trunk/test/lsan/TestCases/large_allocation_leak.cc
compiler-rt/trunk/test/lsan/TestCases/leak_check_at_exit.cpp
- copied, changed from r367705, compiler-rt/trunk/test/lsan/TestCases/leak_check_at_exit.cc
compiler-rt/trunk/test/lsan/TestCases/leak_check_before_thread_started.cpp
- copied, changed from r367705, compiler-rt/trunk/test/lsan/TestCases/leak_check_before_thread_started.cc
compiler-rt/trunk/test/lsan/TestCases/link_turned_off.cpp
- copied, changed from r367705, compiler-rt/trunk/test/lsan/TestCases/link_turned_off.cc
compiler-rt/trunk/test/lsan/TestCases/many_tls_keys.cpp
- copied, changed from r367705, compiler-rt/trunk/test/lsan/TestCases/many_tls_keys.cc
compiler-rt/trunk/test/lsan/TestCases/new_array_with_dtor_0.cpp
- copied, changed from r367705, compiler-rt/trunk/test/lsan/TestCases/new_array_with_dtor_0.cc
compiler-rt/trunk/test/lsan/TestCases/pointer_to_self.cpp
- copied, changed from r367705, compiler-rt/trunk/test/lsan/TestCases/pointer_to_self.cc
compiler-rt/trunk/test/lsan/TestCases/print_suppressions.cpp
- copied, changed from r367705, compiler-rt/trunk/test/lsan/TestCases/print_suppressions.cc
compiler-rt/trunk/test/lsan/TestCases/recoverable_leak_check.cpp
- copied, changed from r367705, compiler-rt/trunk/test/lsan/TestCases/recoverable_leak_check.cc
compiler-rt/trunk/test/lsan/TestCases/register_root_region.cpp
- copied, changed from r367705, compiler-rt/trunk/test/lsan/TestCases/register_root_region.cc
compiler-rt/trunk/test/lsan/TestCases/stale_stack_leak.cpp
- copied, changed from r367705, compiler-rt/trunk/test/lsan/TestCases/stale_stack_leak.cc
compiler-rt/trunk/test/lsan/TestCases/strace_test.cpp
- copied, changed from r367705, compiler-rt/trunk/test/lsan/TestCases/strace_test.cc
compiler-rt/trunk/test/lsan/TestCases/suppressions_default.cpp
- copied, changed from r367705, compiler-rt/trunk/test/lsan/TestCases/suppressions_default.cc
compiler-rt/trunk/test/lsan/TestCases/suppressions_file.cpp
- copied, changed from r367705, compiler-rt/trunk/test/lsan/TestCases/suppressions_file.cc
compiler-rt/trunk/test/lsan/TestCases/swapcontext.cpp
- copied, changed from r367705, compiler-rt/trunk/test/lsan/TestCases/swapcontext.cc
compiler-rt/trunk/test/lsan/TestCases/use_after_return.cpp
- copied, changed from r367705, compiler-rt/trunk/test/lsan/TestCases/use_after_return.cc
compiler-rt/trunk/test/lsan/TestCases/use_globals_initialized.cpp
- copied, changed from r367705, compiler-rt/trunk/test/lsan/TestCases/use_globals_initialized.cc
compiler-rt/trunk/test/lsan/TestCases/use_globals_uninitialized.cpp
- copied, changed from r367705, compiler-rt/trunk/test/lsan/TestCases/use_globals_uninitialized.cc
compiler-rt/trunk/test/lsan/TestCases/use_poisoned_asan.cpp
- copied, changed from r367705, compiler-rt/trunk/test/lsan/TestCases/use_poisoned_asan.cc
compiler-rt/trunk/test/lsan/TestCases/use_registers.cpp
- copied, changed from r367705, compiler-rt/trunk/test/lsan/TestCases/use_registers.cc
compiler-rt/trunk/test/lsan/TestCases/use_stacks.cpp
- copied, changed from r367705, compiler-rt/trunk/test/lsan/TestCases/use_stacks.cc
compiler-rt/trunk/test/lsan/TestCases/use_stacks_threaded.cpp
- copied, changed from r367705, compiler-rt/trunk/test/lsan/TestCases/use_stacks_threaded.cc
compiler-rt/trunk/test/lsan/TestCases/use_unaligned.cpp
- copied, changed from r367705, compiler-rt/trunk/test/lsan/TestCases/use_unaligned.cc
Removed:
compiler-rt/trunk/test/lsan/TestCases/Linux/fork.cc
compiler-rt/trunk/test/lsan/TestCases/Linux/fork_and_leak.cc
compiler-rt/trunk/test/lsan/TestCases/Linux/fork_threaded.cc
compiler-rt/trunk/test/lsan/TestCases/Linux/log-path_test.cc
compiler-rt/trunk/test/lsan/TestCases/Linux/use_tls_dynamic.cc
compiler-rt/trunk/test/lsan/TestCases/Linux/use_tls_pthread_specific_dynamic.cc
compiler-rt/trunk/test/lsan/TestCases/Linux/use_tls_pthread_specific_static.cc
compiler-rt/trunk/test/lsan/TestCases/Linux/use_tls_static.cc
compiler-rt/trunk/test/lsan/TestCases/default_options.cc
compiler-rt/trunk/test/lsan/TestCases/disabler.cc
compiler-rt/trunk/test/lsan/TestCases/do_leak_check_override.cc
compiler-rt/trunk/test/lsan/TestCases/high_allocator_contention.cc
compiler-rt/trunk/test/lsan/TestCases/ignore_object_errors.cc
compiler-rt/trunk/test/lsan/TestCases/large_allocation_leak.cc
compiler-rt/trunk/test/lsan/TestCases/leak_check_at_exit.cc
compiler-rt/trunk/test/lsan/TestCases/leak_check_before_thread_started.cc
compiler-rt/trunk/test/lsan/TestCases/link_turned_off.cc
compiler-rt/trunk/test/lsan/TestCases/many_tls_keys.cc
compiler-rt/trunk/test/lsan/TestCases/new_array_with_dtor_0.cc
compiler-rt/trunk/test/lsan/TestCases/pointer_to_self.cc
compiler-rt/trunk/test/lsan/TestCases/print_suppressions.cc
compiler-rt/trunk/test/lsan/TestCases/recoverable_leak_check.cc
compiler-rt/trunk/test/lsan/TestCases/register_root_region.cc
compiler-rt/trunk/test/lsan/TestCases/stale_stack_leak.cc
compiler-rt/trunk/test/lsan/TestCases/strace_test.cc
compiler-rt/trunk/test/lsan/TestCases/suppressions_default.cc
compiler-rt/trunk/test/lsan/TestCases/suppressions_file.cc
compiler-rt/trunk/test/lsan/TestCases/swapcontext.cc
compiler-rt/trunk/test/lsan/TestCases/use_after_return.cc
compiler-rt/trunk/test/lsan/TestCases/use_globals_initialized.cc
compiler-rt/trunk/test/lsan/TestCases/use_globals_uninitialized.cc
compiler-rt/trunk/test/lsan/TestCases/use_poisoned_asan.cc
compiler-rt/trunk/test/lsan/TestCases/use_registers.cc
compiler-rt/trunk/test/lsan/TestCases/use_stacks.cc
compiler-rt/trunk/test/lsan/TestCases/use_stacks_threaded.cc
compiler-rt/trunk/test/lsan/TestCases/use_unaligned.cc
Modified:
compiler-rt/trunk/lib/sanitizer_common/scripts/check_lint.sh
Modified: compiler-rt/trunk/lib/sanitizer_common/scripts/check_lint.sh
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/scripts/check_lint.sh?rev=367803&r1=367802&r2=367803&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/scripts/check_lint.sh (original)
+++ compiler-rt/trunk/lib/sanitizer_common/scripts/check_lint.sh Mon Aug 5 00:04:42 2019
@@ -105,7 +105,7 @@ run_lint ${MSAN_RTL_LINT_FILTER} ${MSAN_
LSAN_RTL=${COMPILER_RT}/lib/lsan
run_lint ${LSAN_RTL_LINT_FILTER} ${LSAN_RTL}/*.cpp \
${LSAN_RTL}/*.h &
-run_lint ${LSAN_LIT_TEST_LINT_FILTER} ${LIT_TESTS}/lsan/*/*.cc &
+run_lint ${LSAN_LIT_TEST_LINT_FILTER} ${LIT_TESTS}/lsan/*/*.cpp &
# DFSan
DFSAN_RTL=${COMPILER_RT}/lib/dfsan
Removed: compiler-rt/trunk/test/lsan/TestCases/Linux/fork.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/lsan/TestCases/Linux/fork.cc?rev=367802&view=auto
==============================================================================
--- compiler-rt/trunk/test/lsan/TestCases/Linux/fork.cc (original)
+++ compiler-rt/trunk/test/lsan/TestCases/Linux/fork.cc (removed)
@@ -1,24 +0,0 @@
-// Test that thread local data is handled correctly after forking without exec().
-// RUN: %clangxx_lsan %s -o %t
-// RUN: %run %t 2>&1
-
-#include <assert.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <sys/wait.h>
-#include <unistd.h>
-
-__thread void *thread_local_var;
-
-int main() {
- int status = 0;
- thread_local_var = malloc(1337);
- pid_t pid = fork();
- assert(pid >= 0);
- if (pid > 0) {
- waitpid(pid, &status, 0);
- assert(WIFEXITED(status));
- return WEXITSTATUS(status);
- }
- return 0;
-}
Copied: compiler-rt/trunk/test/lsan/TestCases/Linux/fork.cpp (from r367705, compiler-rt/trunk/test/lsan/TestCases/Linux/fork.cc)
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/lsan/TestCases/Linux/fork.cpp?p2=compiler-rt/trunk/test/lsan/TestCases/Linux/fork.cpp&p1=compiler-rt/trunk/test/lsan/TestCases/Linux/fork.cc&r1=367705&r2=367803&rev=367803&view=diff
==============================================================================
(empty)
Removed: compiler-rt/trunk/test/lsan/TestCases/Linux/fork_and_leak.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/lsan/TestCases/Linux/fork_and_leak.cc?rev=367802&view=auto
==============================================================================
--- compiler-rt/trunk/test/lsan/TestCases/Linux/fork_and_leak.cc (original)
+++ compiler-rt/trunk/test/lsan/TestCases/Linux/fork_and_leak.cc (removed)
@@ -1,23 +0,0 @@
-// Test that leaks detected after forking without exec().
-// RUN: %clangxx_lsan %s -o %t && not %run %t 2>&1 | FileCheck %s
-
-#include <assert.h>
-#include <stdlib.h>
-#include <sys/wait.h>
-#include <unistd.h>
-
-int main() {
- pid_t pid = fork();
- assert(pid >= 0);
- if (pid > 0) {
- int status = 0;
- waitpid(pid, &status, 0);
- assert(WIFEXITED(status));
- return WEXITSTATUS(status);
- } else {
- malloc(1337);
- // CHECK: LeakSanitizer: detected memory leaks
- }
- return 0;
-}
-
Copied: compiler-rt/trunk/test/lsan/TestCases/Linux/fork_and_leak.cpp (from r367705, compiler-rt/trunk/test/lsan/TestCases/Linux/fork_and_leak.cc)
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/lsan/TestCases/Linux/fork_and_leak.cpp?p2=compiler-rt/trunk/test/lsan/TestCases/Linux/fork_and_leak.cpp&p1=compiler-rt/trunk/test/lsan/TestCases/Linux/fork_and_leak.cc&r1=367705&r2=367803&rev=367803&view=diff
==============================================================================
(empty)
Removed: compiler-rt/trunk/test/lsan/TestCases/Linux/fork_threaded.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/lsan/TestCases/Linux/fork_threaded.cc?rev=367802&view=auto
==============================================================================
--- compiler-rt/trunk/test/lsan/TestCases/Linux/fork_threaded.cc (original)
+++ compiler-rt/trunk/test/lsan/TestCases/Linux/fork_threaded.cc (removed)
@@ -1,43 +0,0 @@
-// Test that thread local data is handled correctly after forking without
-// exec(). In this test leak checking is initiated from a non-main thread.
-// RUN: %clangxx_lsan %s -o %t
-// RUN: %run %t 2>&1
-
-#include <assert.h>
-#include <pthread.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <sys/wait.h>
-#include <unistd.h>
-
-__thread void *thread_local_var;
-
-void *exit_thread_func(void *arg) {
- exit(0);
-}
-
-void ExitFromThread() {
- pthread_t tid;
- int res;
- res = pthread_create(&tid, 0, exit_thread_func, 0);
- assert(res == 0);
- pthread_join(tid, 0);
-}
-
-int main() {
- int status = 0;
- thread_local_var = malloc(1337);
- pid_t pid = fork();
- assert(pid >= 0);
- if (pid > 0) {
- waitpid(pid, &status, 0);
- assert(WIFEXITED(status));
- return WEXITSTATUS(status);
- } else {
- // Spawn a thread and call exit() from there, to check that we track main
- // thread's pid correctly even if leak checking is initiated from another
- // thread.
- ExitFromThread();
- }
- return 0;
-}
Copied: compiler-rt/trunk/test/lsan/TestCases/Linux/fork_threaded.cpp (from r367705, compiler-rt/trunk/test/lsan/TestCases/Linux/fork_threaded.cc)
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/lsan/TestCases/Linux/fork_threaded.cpp?p2=compiler-rt/trunk/test/lsan/TestCases/Linux/fork_threaded.cpp&p1=compiler-rt/trunk/test/lsan/TestCases/Linux/fork_threaded.cc&r1=367705&r2=367803&rev=367803&view=diff
==============================================================================
(empty)
Removed: compiler-rt/trunk/test/lsan/TestCases/Linux/log-path_test.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/lsan/TestCases/Linux/log-path_test.cc?rev=367802&view=auto
==============================================================================
--- compiler-rt/trunk/test/lsan/TestCases/Linux/log-path_test.cc (original)
+++ compiler-rt/trunk/test/lsan/TestCases/Linux/log-path_test.cc (removed)
@@ -1,26 +0,0 @@
-// RUN: %clangxx_lsan %s -o %t
-// The globs below do not work in the lit shell.
-
-// Regular run.
-// RUN: %env_lsan_opts="use_stacks=0" not %run %t > %t.out 2>&1
-// RUN: FileCheck %s --check-prefix=CHECK-ERROR < %t.out
-
-// Good log_path.
-// RUN: rm -f %t.log.*
-// RUN: %env_lsan_opts="use_stacks=0:log_path='"%t.log"'" not %run %t > %t.out 2>&1
-// RUN: FileCheck %s --check-prefix=CHECK-ERROR < %t.log.*
-
-#include <stdio.h>
-#include <stdlib.h>
-#include "sanitizer_common/print_address.h"
-
-int main() {
- void *stack_var = malloc(1337);
- print_address("Test alloc: ", 1, stack_var);
- // Do not return from main to prevent the pointer from going out of scope.
- exit(0);
-}
-
-// CHECK-ERROR: LeakSanitizer: detected memory leaks
-// CHECK-ERROR: Direct leak of 1337 byte(s) in 1 object(s) allocated from
-// CHECK-ERROR: SUMMARY: {{(Leak|Address)}}Sanitizer:
Copied: compiler-rt/trunk/test/lsan/TestCases/Linux/log-path_test.cpp (from r367705, compiler-rt/trunk/test/lsan/TestCases/Linux/log-path_test.cc)
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/lsan/TestCases/Linux/log-path_test.cpp?p2=compiler-rt/trunk/test/lsan/TestCases/Linux/log-path_test.cpp&p1=compiler-rt/trunk/test/lsan/TestCases/Linux/log-path_test.cc&r1=367705&r2=367803&rev=367803&view=diff
==============================================================================
(empty)
Removed: compiler-rt/trunk/test/lsan/TestCases/Linux/use_tls_dynamic.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/lsan/TestCases/Linux/use_tls_dynamic.cc?rev=367802&view=auto
==============================================================================
--- compiler-rt/trunk/test/lsan/TestCases/Linux/use_tls_dynamic.cc (original)
+++ compiler-rt/trunk/test/lsan/TestCases/Linux/use_tls_dynamic.cc (removed)
@@ -1,57 +0,0 @@
-// Test that dynamically allocated TLS space is included in the root set.
-
-// This is known to be broken with glibc-2.27+
-// https://bugs.llvm.org/show_bug.cgi?id=37804
-// XFAIL: glibc-2.27
-
-// RUN: LSAN_BASE="report_objects=1:use_stacks=0:use_registers=0:use_ld_allocations=0"
-// RUN: %clangxx %s -DBUILD_DSO -fPIC -shared -o %t-so.so
-// RUN: %clangxx_lsan %s -o %t
-// RUN: %env_lsan_opts=$LSAN_BASE:"use_tls=0" not %run %t 2>&1 | FileCheck %s
-// RUN: %env_lsan_opts=$LSAN_BASE:"use_tls=1" %run %t 2>&1
-// RUN: %env_lsan_opts="" %run %t 2>&1
-// UNSUPPORTED: i386-linux,arm,powerpc
-
-#ifndef BUILD_DSO
-#include <assert.h>
-#include <dlfcn.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string>
-#include "sanitizer_common/print_address.h"
-
-int main(int argc, char *argv[]) {
- std::string path = std::string(argv[0]) + "-so.so";
-
- void *handle = dlopen(path.c_str(), RTLD_LAZY);
- assert(handle != 0);
- typedef void **(* store_t)(void *p);
- store_t StoreToTLS = (store_t)dlsym(handle, "StoreToTLS");
- assert(dlerror() == 0);
-
- void *p = malloc(1337);
- // If we don't know about dynamic TLS, we will return a false leak above.
- void **p_in_tls = StoreToTLS(p);
- assert(*p_in_tls == p);
- print_address("Test alloc: ", 1, p);
- return 0;
-}
-// CHECK: Test alloc: [[ADDR:0x[0-9,a-f]+]]
-// CHECK: LeakSanitizer: detected memory leaks
-// CHECK: [[ADDR]] (1337 bytes)
-// CHECK: SUMMARY: {{(Leak|Address)}}Sanitizer:
-
-#else // BUILD_DSO
-// A loadable module with a large thread local section, which would require
-// allocation of a new TLS storage chunk when loaded with dlopen(). We use it
-// to test the reachability of such chunks in LSan tests.
-
-// This must be large enough that it doesn't fit into preallocated static TLS
-// space (see STATIC_TLS_SURPLUS in glibc).
-__thread void *huge_thread_local_array[(1 << 20) / sizeof(void *)]; // NOLINT
-
-extern "C" void **StoreToTLS(void *p) {
- huge_thread_local_array[0] = p;
- return &huge_thread_local_array[0];
-}
-#endif // BUILD_DSO
Copied: compiler-rt/trunk/test/lsan/TestCases/Linux/use_tls_dynamic.cpp (from r367705, compiler-rt/trunk/test/lsan/TestCases/Linux/use_tls_dynamic.cc)
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/lsan/TestCases/Linux/use_tls_dynamic.cpp?p2=compiler-rt/trunk/test/lsan/TestCases/Linux/use_tls_dynamic.cpp&p1=compiler-rt/trunk/test/lsan/TestCases/Linux/use_tls_dynamic.cc&r1=367705&r2=367803&rev=367803&view=diff
==============================================================================
(empty)
Removed: compiler-rt/trunk/test/lsan/TestCases/Linux/use_tls_pthread_specific_dynamic.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/lsan/TestCases/Linux/use_tls_pthread_specific_dynamic.cc?rev=367802&view=auto
==============================================================================
--- compiler-rt/trunk/test/lsan/TestCases/Linux/use_tls_pthread_specific_dynamic.cc (original)
+++ compiler-rt/trunk/test/lsan/TestCases/Linux/use_tls_pthread_specific_dynamic.cc (removed)
@@ -1,38 +0,0 @@
-// Test that dynamically allocated thread-specific storage is included in the root set.
-// RUN: LSAN_BASE="report_objects=1:use_stacks=0:use_registers=0"
-// RUN: %clangxx_lsan %s -o %t
-// RUN: %env_lsan_opts=$LSAN_BASE:"use_tls=0" not %run %t 2>&1 | FileCheck %s
-// RUN: %env_lsan_opts=$LSAN_BASE:"use_tls=1" %run %t 2>&1
-// RUN: %env_lsan_opts="" %run %t 2>&1
-
-#include <assert.h>
-#include <pthread.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include "sanitizer_common/print_address.h"
-
-// From glibc: this many keys are stored in the thread descriptor directly.
-const unsigned PTHREAD_KEY_2NDLEVEL_SIZE = 32;
-
-int main() {
- static const unsigned kDummyKeysCount = PTHREAD_KEY_2NDLEVEL_SIZE;
- int res;
- pthread_key_t dummy_keys[kDummyKeysCount];
- for (unsigned i = 0; i < kDummyKeysCount; i++) {
- res = pthread_key_create(&dummy_keys[i], NULL);
- assert(res == 0);
- }
- pthread_key_t key;
- res = pthread_key_create(&key, NULL);
- assert(key >= PTHREAD_KEY_2NDLEVEL_SIZE);
- assert(res == 0);
- void *p = malloc(1337);
- res = pthread_setspecific(key, p);
- assert(res == 0);
- print_address("Test alloc: ", 1, p);
- return 0;
-}
-// CHECK: Test alloc: [[ADDR:0x[0-9,a-f]+]]
-// CHECK: LeakSanitizer: detected memory leaks
-// CHECK: [[ADDR]] (1337 bytes)
-// CHECK: SUMMARY: {{(Leak|Address)}}Sanitizer:
Copied: compiler-rt/trunk/test/lsan/TestCases/Linux/use_tls_pthread_specific_dynamic.cpp (from r367705, compiler-rt/trunk/test/lsan/TestCases/Linux/use_tls_pthread_specific_dynamic.cc)
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/lsan/TestCases/Linux/use_tls_pthread_specific_dynamic.cpp?p2=compiler-rt/trunk/test/lsan/TestCases/Linux/use_tls_pthread_specific_dynamic.cpp&p1=compiler-rt/trunk/test/lsan/TestCases/Linux/use_tls_pthread_specific_dynamic.cc&r1=367705&r2=367803&rev=367803&view=diff
==============================================================================
(empty)
Removed: compiler-rt/trunk/test/lsan/TestCases/Linux/use_tls_pthread_specific_static.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/lsan/TestCases/Linux/use_tls_pthread_specific_static.cc?rev=367802&view=auto
==============================================================================
--- compiler-rt/trunk/test/lsan/TestCases/Linux/use_tls_pthread_specific_static.cc (original)
+++ compiler-rt/trunk/test/lsan/TestCases/Linux/use_tls_pthread_specific_static.cc (removed)
@@ -1,32 +0,0 @@
-// Test that statically allocated thread-specific storage is included in the root set.
-// RUN: LSAN_BASE="report_objects=1:use_stacks=0:use_registers=0"
-// RUN: %clangxx_lsan %s -o %t
-// RUN: %env_lsan_opts=$LSAN_BASE:"use_tls=0" not %run %t 2>&1 | FileCheck %s
-// RUN: %env_lsan_opts=$LSAN_BASE:"use_tls=1" %run %t 2>&1
-// RUN: %env_lsan_opts="" %run %t 2>&1
-
-#include <assert.h>
-#include <pthread.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include "sanitizer_common/print_address.h"
-
-// From glibc: this many keys are stored in the thread descriptor directly.
-const unsigned PTHREAD_KEY_2NDLEVEL_SIZE = 32;
-
-int main() {
- pthread_key_t key;
- int res;
- res = pthread_key_create(&key, NULL);
- assert(res == 0);
- assert(key < PTHREAD_KEY_2NDLEVEL_SIZE);
- void *p = malloc(1337);
- res = pthread_setspecific(key, p);
- assert(res == 0);
- print_address("Test alloc: ", 1, p);
- return 0;
-}
-// CHECK: Test alloc: [[ADDR:0x[0-9,a-f]+]]
-// CHECK: LeakSanitizer: detected memory leaks
-// CHECK: [[ADDR]] (1337 bytes)
-// CHECK: SUMMARY: {{(Leak|Address)}}Sanitizer:
Copied: compiler-rt/trunk/test/lsan/TestCases/Linux/use_tls_pthread_specific_static.cpp (from r367705, compiler-rt/trunk/test/lsan/TestCases/Linux/use_tls_pthread_specific_static.cc)
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/lsan/TestCases/Linux/use_tls_pthread_specific_static.cpp?p2=compiler-rt/trunk/test/lsan/TestCases/Linux/use_tls_pthread_specific_static.cpp&p1=compiler-rt/trunk/test/lsan/TestCases/Linux/use_tls_pthread_specific_static.cc&r1=367705&r2=367803&rev=367803&view=diff
==============================================================================
(empty)
Removed: compiler-rt/trunk/test/lsan/TestCases/Linux/use_tls_static.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/lsan/TestCases/Linux/use_tls_static.cc?rev=367802&view=auto
==============================================================================
--- compiler-rt/trunk/test/lsan/TestCases/Linux/use_tls_static.cc (original)
+++ compiler-rt/trunk/test/lsan/TestCases/Linux/use_tls_static.cc (removed)
@@ -1,22 +0,0 @@
-// Test that statically allocated TLS space is included in the root set.
-// RUN: LSAN_BASE="report_objects=1:use_stacks=0:use_registers=0"
-// RUN: %clangxx_lsan %s -o %t
-// RUN: %env_lsan_opts=$LSAN_BASE:"use_tls=0" not %run %t 2>&1 | FileCheck %s
-// RUN: %env_lsan_opts=$LSAN_BASE:"use_tls=1" %run %t 2>&1
-// RUN: %env_lsan_opts="" %run %t 2>&1
-
-#include <stdio.h>
-#include <stdlib.h>
-#include "sanitizer_common/print_address.h"
-
-__thread void *tls_var;
-
-int main() {
- tls_var = malloc(1337);
- print_address("Test alloc: ", 1, tls_var);
- return 0;
-}
-// CHECK: Test alloc: [[ADDR:0x[0-9,a-f]+]]
-// CHECK: LeakSanitizer: detected memory leaks
-// CHECK: [[ADDR]] (1337 bytes)
-// CHECK: SUMMARY: {{(Leak|Address)}}Sanitizer:
Copied: compiler-rt/trunk/test/lsan/TestCases/Linux/use_tls_static.cpp (from r367705, compiler-rt/trunk/test/lsan/TestCases/Linux/use_tls_static.cc)
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/lsan/TestCases/Linux/use_tls_static.cpp?p2=compiler-rt/trunk/test/lsan/TestCases/Linux/use_tls_static.cpp&p1=compiler-rt/trunk/test/lsan/TestCases/Linux/use_tls_static.cc&r1=367705&r2=367803&rev=367803&view=diff
==============================================================================
(empty)
Removed: compiler-rt/trunk/test/lsan/TestCases/default_options.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/lsan/TestCases/default_options.cc?rev=367802&view=auto
==============================================================================
--- compiler-rt/trunk/test/lsan/TestCases/default_options.cc (original)
+++ compiler-rt/trunk/test/lsan/TestCases/default_options.cc (removed)
@@ -1,11 +0,0 @@
-// RUN: %clangxx_lsan -O2 %s -o %t && %run %t 2>&1 | FileCheck %s
-
-extern "C"
-const char *__lsan_default_options() {
- // CHECK: Available flags for {{Leak|Address}}Sanitizer:
- return "verbosity=1 help=1";
-}
-
-int main() {
- return 0;
-}
Copied: compiler-rt/trunk/test/lsan/TestCases/default_options.cpp (from r367705, compiler-rt/trunk/test/lsan/TestCases/default_options.cc)
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/lsan/TestCases/default_options.cpp?p2=compiler-rt/trunk/test/lsan/TestCases/default_options.cpp&p1=compiler-rt/trunk/test/lsan/TestCases/default_options.cc&r1=367705&r2=367803&rev=367803&view=diff
==============================================================================
(empty)
Removed: compiler-rt/trunk/test/lsan/TestCases/disabler.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/lsan/TestCases/disabler.cc?rev=367802&view=auto
==============================================================================
--- compiler-rt/trunk/test/lsan/TestCases/disabler.cc (original)
+++ compiler-rt/trunk/test/lsan/TestCases/disabler.cc (removed)
@@ -1,25 +0,0 @@
-// Test for ScopedDisabler.
-// RUN: LSAN_BASE="report_objects=1:use_registers=0:use_stacks=0:use_globals=0:use_tls=0"
-// RUN: %clangxx_lsan %s -o %t
-// RUN: %env_lsan_opts=$LSAN_BASE not %run %t 2>&1 | FileCheck %s
-
-#include <stdio.h>
-#include <stdlib.h>
-
-#include "sanitizer/lsan_interface.h"
-
-int main() {
- void **p;
- {
- __lsan::ScopedDisabler d;
- p = new void *;
- fprintf(stderr, "Test alloc p: %p.\n", p);
- }
- *p = malloc(666);
- void *q = malloc(1337);
- fprintf(stderr, "Test alloc q: %p.\n", q);
- return 0;
-}
-
-// CHECK: Test alloc p: [[ADDR:.*]].
-// CHECK-NOT: [[ADDR]]
Copied: compiler-rt/trunk/test/lsan/TestCases/disabler.cpp (from r367705, compiler-rt/trunk/test/lsan/TestCases/disabler.cc)
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/lsan/TestCases/disabler.cpp?p2=compiler-rt/trunk/test/lsan/TestCases/disabler.cpp&p1=compiler-rt/trunk/test/lsan/TestCases/disabler.cc&r1=367705&r2=367803&rev=367803&view=diff
==============================================================================
(empty)
Removed: compiler-rt/trunk/test/lsan/TestCases/do_leak_check_override.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/lsan/TestCases/do_leak_check_override.cc?rev=367802&view=auto
==============================================================================
--- compiler-rt/trunk/test/lsan/TestCases/do_leak_check_override.cc (original)
+++ compiler-rt/trunk/test/lsan/TestCases/do_leak_check_override.cc (removed)
@@ -1,36 +0,0 @@
-// Test for __lsan_do_leak_check(). We test it by making the leak check run
-// before global destructors, which also tests compatibility with HeapChecker's
-// "normal" mode (LSan runs in "strict" mode by default).
-// RUN: LSAN_BASE="use_stacks=0:use_registers=0"
-// RUN: %clangxx_lsan %s -o %t
-// RUN: %env_lsan_opts=$LSAN_BASE not %run %t 2>&1 | FileCheck --check-prefix=CHECK-strict %s
-// RUN: %env_lsan_opts=$LSAN_BASE not %run %t foo 2>&1 | FileCheck --check-prefix=CHECK-normal %s
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <sanitizer/lsan_interface.h>
-
-struct LeakyGlobal {
- LeakyGlobal() {
- p = malloc(1337);
- }
- ~LeakyGlobal() {
- p = 0;
- }
- void *p;
-};
-
-LeakyGlobal leaky_global;
-
-int main(int argc, char *argv[]) {
- // Register leak check to run before global destructors.
- if (argc > 1)
- atexit(&__lsan_do_leak_check);
- void *p = malloc(666);
- printf("Test alloc: %p\n", p);
- printf("Test alloc in leaky global: %p\n", leaky_global.p);
- return 0;
-}
-
-// CHECK-strict: SUMMARY: {{(Leak|Address)}}Sanitizer: 2003 byte(s) leaked in 2 allocation(s)
-// CHECK-normal: SUMMARY: {{(Leak|Address)}}Sanitizer: 666 byte(s) leaked in 1 allocation(s)
Copied: compiler-rt/trunk/test/lsan/TestCases/do_leak_check_override.cpp (from r367705, compiler-rt/trunk/test/lsan/TestCases/do_leak_check_override.cc)
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/lsan/TestCases/do_leak_check_override.cpp?p2=compiler-rt/trunk/test/lsan/TestCases/do_leak_check_override.cpp&p1=compiler-rt/trunk/test/lsan/TestCases/do_leak_check_override.cc&r1=367705&r2=367803&rev=367803&view=diff
==============================================================================
(empty)
Removed: compiler-rt/trunk/test/lsan/TestCases/high_allocator_contention.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/lsan/TestCases/high_allocator_contention.cc?rev=367802&view=auto
==============================================================================
--- compiler-rt/trunk/test/lsan/TestCases/high_allocator_contention.cc (original)
+++ compiler-rt/trunk/test/lsan/TestCases/high_allocator_contention.cc (removed)
@@ -1,49 +0,0 @@
-// A benchmark that executes malloc/free pairs in parallel.
-// Usage: ./a.out number_of_threads total_number_of_allocations
-// RUN: LSAN_BASE="use_ld_allocations=0"
-// RUN: %clangxx_lsan %s -o %t
-// RUN: %env_lsan_opts=$LSAN_BASE %run %t 5 1000000 2>&1
-#include <assert.h>
-#include <pthread.h>
-#include <stdlib.h>
-#include <stdio.h>
-
-int num_threads;
-int total_num_alloc;
-const int kMaxNumThreads = 5000;
-pthread_t tid[kMaxNumThreads];
-
-pthread_cond_t cond = PTHREAD_COND_INITIALIZER;
-pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
-bool go = false;
-
-void *thread_fun(void *arg) {
- pthread_mutex_lock(&mutex);
- while (!go) pthread_cond_wait(&cond, &mutex);
- pthread_mutex_unlock(&mutex);
- for (int i = 0; i < total_num_alloc / num_threads; i++) {
- void *p = malloc(10);
- __asm__ __volatile__("" : : "r"(p) : "memory");
- free((void *)p);
- }
- return 0;
-}
-
-int main(int argc, char** argv) {
- assert(argc == 3);
- num_threads = atoi(argv[1]);
- assert(num_threads > 0);
- assert(num_threads <= kMaxNumThreads);
- total_num_alloc = atoi(argv[2]);
- assert(total_num_alloc > 0);
- printf("%d threads, %d allocations in each\n", num_threads,
- total_num_alloc / num_threads);
- for (int i = 0; i < num_threads; i++)
- pthread_create(&tid[i], 0, thread_fun, 0);
- pthread_mutex_lock(&mutex);
- go = true;
- pthread_cond_broadcast(&cond);
- pthread_mutex_unlock(&mutex);
- for (int i = 0; i < num_threads; i++) pthread_join(tid[i], 0);
- return 0;
-}
Copied: compiler-rt/trunk/test/lsan/TestCases/high_allocator_contention.cpp (from r367705, compiler-rt/trunk/test/lsan/TestCases/high_allocator_contention.cc)
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/lsan/TestCases/high_allocator_contention.cpp?p2=compiler-rt/trunk/test/lsan/TestCases/high_allocator_contention.cpp&p1=compiler-rt/trunk/test/lsan/TestCases/high_allocator_contention.cc&r1=367705&r2=367803&rev=367803&view=diff
==============================================================================
(empty)
Removed: compiler-rt/trunk/test/lsan/TestCases/ignore_object_errors.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/lsan/TestCases/ignore_object_errors.cc?rev=367802&view=auto
==============================================================================
--- compiler-rt/trunk/test/lsan/TestCases/ignore_object_errors.cc (original)
+++ compiler-rt/trunk/test/lsan/TestCases/ignore_object_errors.cc (removed)
@@ -1,20 +0,0 @@
-// Test for incorrect use of __lsan_ignore_object().
-// RUN: %clangxx_lsan %s -o %t
-// RUN: %env_lsan_opts=$LSAN_BASE %run %t 2>&1 | FileCheck %s
-
-#include <stdio.h>
-#include <stdlib.h>
-
-#include "sanitizer/lsan_interface.h"
-
-int main() {
- void *p = malloc(1337);
- fprintf(stderr, "Test alloc: %p.\n", p);
- __lsan_ignore_object(p);
- __lsan_ignore_object(p);
- free(p);
- __lsan_ignore_object(p);
- return 0;
-}
-// CHECK: Test alloc: [[ADDR:.*]].
-// CHECK-NOT: SUMMARY: {{.*}} leaked
Copied: compiler-rt/trunk/test/lsan/TestCases/ignore_object_errors.cpp (from r367705, compiler-rt/trunk/test/lsan/TestCases/ignore_object_errors.cc)
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/lsan/TestCases/ignore_object_errors.cpp?p2=compiler-rt/trunk/test/lsan/TestCases/ignore_object_errors.cpp&p1=compiler-rt/trunk/test/lsan/TestCases/ignore_object_errors.cc&r1=367705&r2=367803&rev=367803&view=diff
==============================================================================
(empty)
Removed: compiler-rt/trunk/test/lsan/TestCases/large_allocation_leak.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/lsan/TestCases/large_allocation_leak.cc?rev=367802&view=auto
==============================================================================
--- compiler-rt/trunk/test/lsan/TestCases/large_allocation_leak.cc (original)
+++ compiler-rt/trunk/test/lsan/TestCases/large_allocation_leak.cc (removed)
@@ -1,23 +0,0 @@
-// Test that LargeMmapAllocator's chunks aren't reachable via some internal data structure.
-// RUN: LSAN_BASE="report_objects=1:use_stacks=0:use_registers=0"
-// RUN: %clangxx_lsan %s -o %t
-// RUN: %env_lsan_opts=$LSAN_BASE not %run %t 2>&1 | FileCheck %s
-
-// For 32 bit LSan it's pretty likely that large chunks are "reachable" from some
-// internal data structures (e.g. Glibc global data).
-// UNSUPPORTED: x86, arm
-
-#include <stdio.h>
-#include <stdlib.h>
-#include "sanitizer_common/print_address.h"
-
-int main() {
- // maxsize in primary allocator is always less than this (1 << 25).
- void *large_alloc = malloc(33554432);
- print_address("Test alloc: ", 1, large_alloc);
- return 0;
-}
-// CHECK: Test alloc: [[ADDR:0x[0-9,a-f]+]]
-// CHECK: LeakSanitizer: detected memory leaks
-// CHECK: [[ADDR]] (33554432 bytes)
-// CHECK: SUMMARY: {{(Leak|Address)}}Sanitizer:
Copied: compiler-rt/trunk/test/lsan/TestCases/large_allocation_leak.cpp (from r367705, compiler-rt/trunk/test/lsan/TestCases/large_allocation_leak.cc)
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/lsan/TestCases/large_allocation_leak.cpp?p2=compiler-rt/trunk/test/lsan/TestCases/large_allocation_leak.cpp&p1=compiler-rt/trunk/test/lsan/TestCases/large_allocation_leak.cc&r1=367705&r2=367803&rev=367803&view=diff
==============================================================================
(empty)
Removed: compiler-rt/trunk/test/lsan/TestCases/leak_check_at_exit.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/lsan/TestCases/leak_check_at_exit.cc?rev=367802&view=auto
==============================================================================
--- compiler-rt/trunk/test/lsan/TestCases/leak_check_at_exit.cc (original)
+++ compiler-rt/trunk/test/lsan/TestCases/leak_check_at_exit.cc (removed)
@@ -1,21 +0,0 @@
-// Test for the leak_check_at_exit flag.
-// RUN: LSAN_BASE="use_stacks=0:use_registers=0"
-// RUN: %clangxx_lsan %s -o %t
-// RUN: %env_lsan_opts=$LSAN_BASE not %run %t foo 2>&1 | FileCheck %s --check-prefix=CHECK-do
-// RUN: %env_lsan_opts=$LSAN_BASE not %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-do
-// RUN: %env_lsan_opts=$LSAN_BASE:"leak_check_at_exit=0" not %run %t foo 2>&1 | FileCheck %s --check-prefix=CHECK-do
-// RUN: %env_lsan_opts=$LSAN_BASE:"leak_check_at_exit=0" %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-dont
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <sanitizer/lsan_interface.h>
-
-int main(int argc, char *argv[]) {
- fprintf(stderr, "Test alloc: %p.\n", malloc(1337));
- if (argc > 1)
- __lsan_do_leak_check();
- return 0;
-}
-
-// CHECK-do: SUMMARY: {{(Leak|Address)}}Sanitizer:
-// CHECK-dont-NOT: SUMMARY: {{(Leak|Address)}}Sanitizer:
Copied: compiler-rt/trunk/test/lsan/TestCases/leak_check_at_exit.cpp (from r367705, compiler-rt/trunk/test/lsan/TestCases/leak_check_at_exit.cc)
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/lsan/TestCases/leak_check_at_exit.cpp?p2=compiler-rt/trunk/test/lsan/TestCases/leak_check_at_exit.cpp&p1=compiler-rt/trunk/test/lsan/TestCases/leak_check_at_exit.cc&r1=367705&r2=367803&rev=367803&view=diff
==============================================================================
(empty)
Removed: compiler-rt/trunk/test/lsan/TestCases/leak_check_before_thread_started.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/lsan/TestCases/leak_check_before_thread_started.cc?rev=367802&view=auto
==============================================================================
--- compiler-rt/trunk/test/lsan/TestCases/leak_check_before_thread_started.cc (original)
+++ compiler-rt/trunk/test/lsan/TestCases/leak_check_before_thread_started.cc (removed)
@@ -1,40 +0,0 @@
-// Regression test for http://llvm.org/bugs/show_bug.cgi?id=21621
-// This test relies on timing between threads, so any failures will be flaky.
-// RUN: %clangxx_lsan %s -o %t
-// RUN: %env_lsan_opts="log_pointers=1:log_threads=1" %run %t
-#include <assert.h>
-#include <pthread.h>
-#include <stdio.h>
-#include <stdlib.h>
-
-pthread_cond_t cond = PTHREAD_COND_INITIALIZER;
-pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
-bool flag = false;
-
-void *func(void *arg) {
- // This mutex will never be grabbed.
- fprintf(stderr, "entered func()\n");
- pthread_mutex_lock(&mutex);
- free(arg);
- pthread_mutex_unlock(&mutex);
- return 0;
-}
-
-void create_detached_thread() {
- pthread_t thread_id;
- pthread_attr_t attr;
-
- pthread_attr_init(&attr);
- pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
-
- void *arg = malloc(1337);
- assert(arg);
- // This mutex is never unlocked by the main thread.
- pthread_mutex_lock(&mutex);
- int res = pthread_create(&thread_id, &attr, func, arg);
- assert(res == 0);
-}
-
-int main() {
- create_detached_thread();
-}
Copied: compiler-rt/trunk/test/lsan/TestCases/leak_check_before_thread_started.cpp (from r367705, compiler-rt/trunk/test/lsan/TestCases/leak_check_before_thread_started.cc)
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/lsan/TestCases/leak_check_before_thread_started.cpp?p2=compiler-rt/trunk/test/lsan/TestCases/leak_check_before_thread_started.cpp&p1=compiler-rt/trunk/test/lsan/TestCases/leak_check_before_thread_started.cc&r1=367705&r2=367803&rev=367803&view=diff
==============================================================================
(empty)
Removed: compiler-rt/trunk/test/lsan/TestCases/link_turned_off.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/lsan/TestCases/link_turned_off.cc?rev=367802&view=auto
==============================================================================
--- compiler-rt/trunk/test/lsan/TestCases/link_turned_off.cc (original)
+++ compiler-rt/trunk/test/lsan/TestCases/link_turned_off.cc (removed)
@@ -1,26 +0,0 @@
-// Test for disabling LSan at link-time.
-// RUN: LSAN_BASE="use_stacks=0:use_registers=0"
-// RUN: %clangxx_lsan %s -o %t
-// RUN: %env_lsan_opts=$LSAN_BASE %run %t
-// RUN: %env_lsan_opts=$LSAN_BASE not %run %t foo 2>&1 | FileCheck %s
-//
-// UNSUPPORTED: darwin
-
-#include <sanitizer/lsan_interface.h>
-
-int argc_copy;
-
-extern "C" {
-int __attribute__((used)) __lsan_is_turned_off() {
- return (argc_copy == 1);
-}
-}
-
-int main(int argc, char *argv[]) {
- volatile int *x = new int;
- *x = 42;
- argc_copy = argc;
- return 0;
-}
-
-// CHECK: SUMMARY: {{(Leak|Address)}}Sanitizer: 4 byte(s) leaked in 1 allocation(s)
Copied: compiler-rt/trunk/test/lsan/TestCases/link_turned_off.cpp (from r367705, compiler-rt/trunk/test/lsan/TestCases/link_turned_off.cc)
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/lsan/TestCases/link_turned_off.cpp?p2=compiler-rt/trunk/test/lsan/TestCases/link_turned_off.cpp&p1=compiler-rt/trunk/test/lsan/TestCases/link_turned_off.cc&r1=367705&r2=367803&rev=367803&view=diff
==============================================================================
(empty)
Removed: compiler-rt/trunk/test/lsan/TestCases/many_tls_keys.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/lsan/TestCases/many_tls_keys.cc?rev=367802&view=auto
==============================================================================
--- compiler-rt/trunk/test/lsan/TestCases/many_tls_keys.cc (original)
+++ compiler-rt/trunk/test/lsan/TestCases/many_tls_keys.cc (removed)
@@ -1,97 +0,0 @@
-// Test that lsan handles tls correctly for many threads
-// RUN: LSAN_BASE="report_objects=1:use_stacks=0:use_registers=0"
-// RUN: %clangxx_lsan %s -DUSE_THREAD -o %t-thread
-// RUN: %clangxx_lsan %s -DUSE_PTHREAD -o %t-pthread
-// RUN: %env_lsan_opts=$LSAN_BASE:"use_tls=0" not %run %t-thread 2>&1 | FileCheck %s
-// RUN: %env_lsan_opts=$LSAN_BASE:"use_tls=1" %run %t-thread 2>&1
-// RUN: %env_lsan_opts="" %run %t-thread 2>&1
-// RUN: %env_lsan_opts=$LSAN_BASE:"use_tls=0" not %run %t-pthread 2>&1 | FileCheck %s
-// RUN: %env_lsan_opts=$LSAN_BASE:"use_tls=1" %run %t-pthread 2>&1
-// RUN: %env_lsan_opts="" %run %t-pthread 2>&1
-
-// Patch r303906 did not fix all the problems.
-// UNSUPPORTED: arm-linux,armhf-linux
-
-#include <assert.h>
-#include <limits.h>
-#include <pthread.h>
-#include <stdlib.h>
-#include <unistd.h>
-
-static const int NUM_THREADS = 10;
-
-pthread_cond_t cond = PTHREAD_COND_INITIALIZER;
-pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
-int finished = 0;
-
-#if USE_THREAD
-__thread void *ptr1;
-__thread void *ptr2;
-__thread void *ptr3;
-__thread void *ptr4;
-__thread void *ptr5;
-
-void alloc() {
- ptr1 = malloc(1111);
- ptr2 = malloc(2222);
- ptr3 = malloc(3333);
- ptr4 = malloc(4444);
- ptr5 = malloc(5555);
-}
-
-#elif USE_PTHREAD
-// We won't be able to create the maximum number of keys, due to other users
-// of the tls, but we'll use as many keys as we can before failing to create
-// a new key.
-pthread_key_t keys[PTHREAD_KEYS_MAX];
-static const int PTHREAD_KEY_INVALID = 0xffffffff;
-
-void alloc() {
- for (int i = 0; i < PTHREAD_KEYS_MAX; ++i) {
- void *ptr = malloc(123);
- if ((keys[i] == PTHREAD_KEY_INVALID) || pthread_setspecific(keys[i], ptr)) {
- free(ptr);
- break;
- }
- }
-}
-
-void pthread_destructor(void *arg) {
- assert(0 && "pthread destructors shouldn't be called");
-}
-#endif
-
-void *thread_start(void *arg) {
- alloc();
-
- pthread_mutex_lock(&mutex);
- finished++;
- pthread_mutex_unlock(&mutex);
-
- // don't exit, to intentionally leak tls data
- while (1)
- sleep(100);
-}
-
-int main() {
-#if USE_PTHREAD
- for (int i = 0; i < PTHREAD_KEYS_MAX; ++i) {
- if (pthread_key_create(&keys[i], pthread_destructor)) {
- keys[i] = PTHREAD_KEY_INVALID;
- break;
- }
- }
-#endif
-
- pthread_t thread[NUM_THREADS];
- for (int i = 0; i < NUM_THREADS; ++i) {
- assert(0 == pthread_create(&thread[i], 0, thread_start, 0));
- }
- // spin until all threads have finished
- while (finished < NUM_THREADS)
- sleep(1);
- exit(0);
-}
-
-// CHECK: LeakSanitizer: detected memory leaks
-// CHECK: SUMMARY: {{(Leak|Address)}}Sanitizer:
Copied: compiler-rt/trunk/test/lsan/TestCases/many_tls_keys.cpp (from r367705, compiler-rt/trunk/test/lsan/TestCases/many_tls_keys.cc)
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/lsan/TestCases/many_tls_keys.cpp?p2=compiler-rt/trunk/test/lsan/TestCases/many_tls_keys.cpp&p1=compiler-rt/trunk/test/lsan/TestCases/many_tls_keys.cc&r1=367705&r2=367803&rev=367803&view=diff
==============================================================================
(empty)
Removed: compiler-rt/trunk/test/lsan/TestCases/new_array_with_dtor_0.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/lsan/TestCases/new_array_with_dtor_0.cc?rev=367802&view=auto
==============================================================================
--- compiler-rt/trunk/test/lsan/TestCases/new_array_with_dtor_0.cc (original)
+++ compiler-rt/trunk/test/lsan/TestCases/new_array_with_dtor_0.cc (removed)
@@ -1,19 +0,0 @@
-// Regression test:
-// https://code.google.com/p/address-sanitizer/issues/detail?id=257
-// RUN: %clangxx_lsan %s -o %t && %run %t 2>&1 | FileCheck %s
-
-#include <stdio.h>
-
-struct T {
- ~T() { printf("~T\n"); }
-};
-
-T *t;
-
-int main(int argc, char **argv) {
- t = new T[argc - 1];
- printf("OK\n");
-}
-
-// CHECK: OK
-
Copied: compiler-rt/trunk/test/lsan/TestCases/new_array_with_dtor_0.cpp (from r367705, compiler-rt/trunk/test/lsan/TestCases/new_array_with_dtor_0.cc)
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/lsan/TestCases/new_array_with_dtor_0.cpp?p2=compiler-rt/trunk/test/lsan/TestCases/new_array_with_dtor_0.cpp&p1=compiler-rt/trunk/test/lsan/TestCases/new_array_with_dtor_0.cc&r1=367705&r2=367803&rev=367803&view=diff
==============================================================================
(empty)
Removed: compiler-rt/trunk/test/lsan/TestCases/pointer_to_self.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/lsan/TestCases/pointer_to_self.cc?rev=367802&view=auto
==============================================================================
--- compiler-rt/trunk/test/lsan/TestCases/pointer_to_self.cc (original)
+++ compiler-rt/trunk/test/lsan/TestCases/pointer_to_self.cc (removed)
@@ -1,19 +0,0 @@
-// Regression test: pointers to self should not confuse LSan into thinking the
-// object is indirectly leaked. Only external pointers count.
-// RUN: LSAN_BASE="report_objects=1:use_registers=0"
-// RUN: %clangxx_lsan %s -o %t
-// RUN: %env_lsan_opts=$LSAN_BASE:"use_stacks=0" not %run %t 2>&1 | FileCheck %s
-
-#include <stdio.h>
-#include <stdlib.h>
-#include "sanitizer_common/print_address.h"
-
-int main() {
- void *p = malloc(1337);
- *reinterpret_cast<void **>(p) = p;
- print_address("Test alloc: ", 1, p);
-}
-// CHECK: Test alloc: [[ADDR:0x[0-9,a-f]+]]
-// CHECK: LeakSanitizer: detected memory leaks
-// CHECK: [[ADDR]] (1337 bytes)
-// CHECK: SUMMARY: {{(Leak|Address)}}Sanitizer:
Copied: compiler-rt/trunk/test/lsan/TestCases/pointer_to_self.cpp (from r367705, compiler-rt/trunk/test/lsan/TestCases/pointer_to_self.cc)
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/lsan/TestCases/pointer_to_self.cpp?p2=compiler-rt/trunk/test/lsan/TestCases/pointer_to_self.cpp&p1=compiler-rt/trunk/test/lsan/TestCases/pointer_to_self.cc&r1=367705&r2=367803&rev=367803&view=diff
==============================================================================
(empty)
Removed: compiler-rt/trunk/test/lsan/TestCases/print_suppressions.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/lsan/TestCases/print_suppressions.cc?rev=367802&view=auto
==============================================================================
--- compiler-rt/trunk/test/lsan/TestCases/print_suppressions.cc (original)
+++ compiler-rt/trunk/test/lsan/TestCases/print_suppressions.cc (removed)
@@ -1,33 +0,0 @@
-// Print matched suppressions only if print_suppressions=1 AND at least one is
-// matched. Default is print_suppressions=true.
-// RUN: LSAN_BASE="use_registers=0:use_stacks=0"
-// RUN: %clangxx_lsan %s -o %t
-// RUN: %env_lsan_opts=$LSAN_BASE:print_suppressions=0 %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-dont-print
-// RUN: %env_lsan_opts=$LSAN_BASE %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-dont-print
-// RUN: %env_lsan_opts=$LSAN_BASE:print_suppressions=0 %run %t foo 2>&1 | FileCheck %s --check-prefix=CHECK-dont-print
-// RUN: %env_lsan_opts=$LSAN_BASE %run %t foo 2>&1 | FileCheck %s --check-prefix=CHECK-print
-
-#include <stdio.h>
-#include <stdlib.h>
-
-#include "sanitizer/lsan_interface.h"
-
-extern "C"
-const char *__lsan_default_suppressions() {
- return "leak:*LSanTestLeakingFunc*";
-}
-
-void LSanTestLeakingFunc() {
- void *p = malloc(666);
- fprintf(stderr, "Test alloc: %p.\n", p);
-}
-
-int main(int argc, char **argv) {
- printf("print for nonempty output\n");
- if (argc > 1)
- LSanTestLeakingFunc();
- return 0;
-}
-// CHECK-print: Suppressions used:
-// CHECK-print: 1 666 *LSanTestLeakingFunc*
-// CHECK-dont-print-NOT: Suppressions used:
Copied: compiler-rt/trunk/test/lsan/TestCases/print_suppressions.cpp (from r367705, compiler-rt/trunk/test/lsan/TestCases/print_suppressions.cc)
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/lsan/TestCases/print_suppressions.cpp?p2=compiler-rt/trunk/test/lsan/TestCases/print_suppressions.cpp&p1=compiler-rt/trunk/test/lsan/TestCases/print_suppressions.cc&r1=367705&r2=367803&rev=367803&view=diff
==============================================================================
(empty)
Removed: compiler-rt/trunk/test/lsan/TestCases/recoverable_leak_check.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/lsan/TestCases/recoverable_leak_check.cc?rev=367802&view=auto
==============================================================================
--- compiler-rt/trunk/test/lsan/TestCases/recoverable_leak_check.cc (original)
+++ compiler-rt/trunk/test/lsan/TestCases/recoverable_leak_check.cc (removed)
@@ -1,34 +0,0 @@
-// Test for on-demand leak checking.
-// RUN: LSAN_BASE="use_stacks=0:use_registers=0"
-// RUN: %clangxx_lsan %s -o %t
-// RUN: %env_lsan_opts=$LSAN_BASE %run %t foo 2>&1 | FileCheck %s
-// RUN: %env_lsan_opts=$LSAN_BASE %run %t 2>&1 | FileCheck %s
-//
-// UNSUPPORTED: darwin
-
-#include <assert.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <sanitizer/lsan_interface.h>
-
-void *p;
-
-int main(int argc, char *argv[]) {
- p = malloc(23);
-
- assert(__lsan_do_recoverable_leak_check() == 0);
-
- fprintf(stderr, "Test alloc: %p.\n", malloc(1337));
-// CHECK: Test alloc:
-
- assert(__lsan_do_recoverable_leak_check() == 1);
-// CHECK: SUMMARY: {{(Leak|Address)}}Sanitizer: 1337 byte
-
- // Test that we correctly reset chunk tags.
- p = 0;
- assert(__lsan_do_recoverable_leak_check() == 1);
-// CHECK: SUMMARY: {{(Leak|Address)}}Sanitizer: 1360 byte
-
- _exit(0);
-}
Copied: compiler-rt/trunk/test/lsan/TestCases/recoverable_leak_check.cpp (from r367705, compiler-rt/trunk/test/lsan/TestCases/recoverable_leak_check.cc)
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/lsan/TestCases/recoverable_leak_check.cpp?p2=compiler-rt/trunk/test/lsan/TestCases/recoverable_leak_check.cpp&p1=compiler-rt/trunk/test/lsan/TestCases/recoverable_leak_check.cc&r1=367705&r2=367803&rev=367803&view=diff
==============================================================================
(empty)
Removed: compiler-rt/trunk/test/lsan/TestCases/register_root_region.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/lsan/TestCases/register_root_region.cc?rev=367802&view=auto
==============================================================================
--- compiler-rt/trunk/test/lsan/TestCases/register_root_region.cc (original)
+++ compiler-rt/trunk/test/lsan/TestCases/register_root_region.cc (removed)
@@ -1,32 +0,0 @@
-// Test for __lsan_(un)register_root_region().
-// RUN: LSAN_BASE="use_stacks=0:use_registers=0"
-// RUN: %clangxx_lsan %s -o %t
-// RUN: %env_lsan_opts=$LSAN_BASE %run %t
-// RUN: %env_lsan_opts=$LSAN_BASE not %run %t foo 2>&1 | FileCheck %s
-// RUN: %env_lsan_opts=$LSAN_BASE:use_root_regions=0 not %run %t 2>&1 | FileCheck %s
-
-#include <assert.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <sys/mman.h>
-#include <unistd.h>
-
-#include <sanitizer/lsan_interface.h>
-
-int main(int argc, char *argv[]) {
- size_t size = getpagesize() * 2;
- void *p =
- mmap(0, size, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANON, -1, 0);
- assert(p);
- // Make half of the memory inaccessible. LSan must not crash trying to read it.
- assert(0 == mprotect((char *)p + size / 2, size / 2, PROT_NONE));
-
- __lsan_register_root_region(p, size);
- *((void **)p) = malloc(1337);
- fprintf(stderr, "Test alloc: %p.\n", p);
- if (argc > 1)
- __lsan_unregister_root_region(p, size);
- return 0;
-}
-// CHECK: Test alloc: [[ADDR:.*]].
-// CHECK: SUMMARY: {{(Leak|Address)}}Sanitizer: 1337 byte(s) leaked in 1 allocation(s)
Copied: compiler-rt/trunk/test/lsan/TestCases/register_root_region.cpp (from r367705, compiler-rt/trunk/test/lsan/TestCases/register_root_region.cc)
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/lsan/TestCases/register_root_region.cpp?p2=compiler-rt/trunk/test/lsan/TestCases/register_root_region.cpp&p1=compiler-rt/trunk/test/lsan/TestCases/register_root_region.cc&r1=367705&r2=367803&rev=367803&view=diff
==============================================================================
(empty)
Removed: compiler-rt/trunk/test/lsan/TestCases/stale_stack_leak.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/lsan/TestCases/stale_stack_leak.cc?rev=367802&view=auto
==============================================================================
--- compiler-rt/trunk/test/lsan/TestCases/stale_stack_leak.cc (original)
+++ compiler-rt/trunk/test/lsan/TestCases/stale_stack_leak.cc (removed)
@@ -1,47 +0,0 @@
-// Test that out-of-scope local variables are ignored by LSan.
-// RUN: LSAN_BASE="report_objects=1:use_registers=0:use_stacks=1"
-// RUN: %clangxx_lsan %s -o %t
-// RUN: %env_lsan_opts=$LSAN_BASE not %run %t 2>&1 | FileCheck %s
-// RUN: %env_lsan_opts=$LSAN_BASE":exitcode=0" %run %t 2>&1 | FileCheck --check-prefix=CHECK-sanity %s
-//
-// x86 passes parameters through stack that may lead to false negatives
-// UNSUPPORTED: x86,powerpc64
-
-#include <stdio.h>
-#include <stdlib.h>
-#include "sanitizer_common/print_address.h"
-
-void **pp;
-
-// Put pointer far enough on the stack that LSan has space to run in without
-// overwriting it.
-// Hopefully the argument p will be passed on a register, saving us from false
-// negatives.
-__attribute__((noinline))
-void *PutPointerOnStaleStack(void *p) {
- void *locals[2048];
- locals[0] = p;
- pp = &locals[0];
- print_address("Test alloc: ", 1, locals[0]);
- return 0;
-}
-
-int main() {
- PutPointerOnStaleStack(malloc(1337));
- return 0;
-}
-
-// This must run after LSan, to ensure LSan didn't overwrite the pointer before
-// it had a chance to see it. If LSan is invoked with atexit(), this works.
-// Otherwise, we need a different method.
-__attribute__((destructor))
-__attribute__((no_sanitize_address))
-void ConfirmPointerHasSurvived() {
- print_address("Value after LSan: ", 1, *pp);
-}
-// CHECK: Test alloc: [[ADDR:0x[0-9,a-f]+]]
-// CHECK-sanity: Test alloc: [[ADDR:0x[0-9,a-f]+]]
-// CHECK: LeakSanitizer: detected memory leaks
-// CHECK: [[ADDR]] (1337 bytes)
-// CHECK: SUMMARY: {{(Leak|Address)}}Sanitizer:
-// CHECK-sanity: Value after LSan: [[ADDR]]
Copied: compiler-rt/trunk/test/lsan/TestCases/stale_stack_leak.cpp (from r367705, compiler-rt/trunk/test/lsan/TestCases/stale_stack_leak.cc)
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/lsan/TestCases/stale_stack_leak.cpp?p2=compiler-rt/trunk/test/lsan/TestCases/stale_stack_leak.cpp&p1=compiler-rt/trunk/test/lsan/TestCases/stale_stack_leak.cc&r1=367705&r2=367803&rev=367803&view=diff
==============================================================================
(empty)
Removed: compiler-rt/trunk/test/lsan/TestCases/strace_test.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/lsan/TestCases/strace_test.cc?rev=367802&view=auto
==============================================================================
--- compiler-rt/trunk/test/lsan/TestCases/strace_test.cc (original)
+++ compiler-rt/trunk/test/lsan/TestCases/strace_test.cc (removed)
@@ -1,15 +0,0 @@
-// Test that lsan reports a proper error when running under strace.
-// REQUIRES: strace
-// RUN: %clangxx_lsan %s -o %t
-// RUN: not strace -o /dev/null %run %t 2>&1 | FileCheck %s
-
-#include <stdio.h>
-#include <stdlib.h>
-
-static volatile void *sink;
-
-int main() {
- sink = malloc(42);
-}
-// CHECK: LeakSanitizer has encountered a fatal error
-// CHECK: HINT: LeakSanitizer does not work under ptrace (strace, gdb, etc)
Copied: compiler-rt/trunk/test/lsan/TestCases/strace_test.cpp (from r367705, compiler-rt/trunk/test/lsan/TestCases/strace_test.cc)
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/lsan/TestCases/strace_test.cpp?p2=compiler-rt/trunk/test/lsan/TestCases/strace_test.cpp&p1=compiler-rt/trunk/test/lsan/TestCases/strace_test.cc&r1=367705&r2=367803&rev=367803&view=diff
==============================================================================
(empty)
Removed: compiler-rt/trunk/test/lsan/TestCases/suppressions_default.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/lsan/TestCases/suppressions_default.cc?rev=367802&view=auto
==============================================================================
--- compiler-rt/trunk/test/lsan/TestCases/suppressions_default.cc (original)
+++ compiler-rt/trunk/test/lsan/TestCases/suppressions_default.cc (removed)
@@ -1,28 +0,0 @@
-// RUN: LSAN_BASE="use_registers=0:use_stacks=0"
-// RUN: %clangxx_lsan %s -o %t
-// RUN: %env_lsan_opts=$LSAN_BASE not %run %t 2>&1 | FileCheck %s
-
-#include <stdio.h>
-#include <stdlib.h>
-
-#include "sanitizer/lsan_interface.h"
-
-extern "C"
-const char *__lsan_default_suppressions() {
- return "leak:*LSanTestLeakingFunc*";
-}
-
-void LSanTestLeakingFunc() {
- void *p = malloc(666);
- fprintf(stderr, "Test alloc: %p.\n", p);
-}
-
-int main() {
- LSanTestLeakingFunc();
- void *q = malloc(1337);
- fprintf(stderr, "Test alloc: %p.\n", q);
- return 0;
-}
-// CHECK: Suppressions used:
-// CHECK: 1 666 *LSanTestLeakingFunc*
-// CHECK: SUMMARY: {{(Leak|Address)}}Sanitizer: 1337 byte(s) leaked in 1 allocation(s)
Copied: compiler-rt/trunk/test/lsan/TestCases/suppressions_default.cpp (from r367705, compiler-rt/trunk/test/lsan/TestCases/suppressions_default.cc)
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/lsan/TestCases/suppressions_default.cpp?p2=compiler-rt/trunk/test/lsan/TestCases/suppressions_default.cpp&p1=compiler-rt/trunk/test/lsan/TestCases/suppressions_default.cc&r1=367705&r2=367803&rev=367803&view=diff
==============================================================================
(empty)
Removed: compiler-rt/trunk/test/lsan/TestCases/suppressions_file.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/lsan/TestCases/suppressions_file.cc?rev=367802&view=auto
==============================================================================
--- compiler-rt/trunk/test/lsan/TestCases/suppressions_file.cc (original)
+++ compiler-rt/trunk/test/lsan/TestCases/suppressions_file.cc (removed)
@@ -1,32 +0,0 @@
-// RUN: LSAN_BASE="use_registers=0:use_stacks=0"
-// RUN: %clangxx_lsan %s -o %t
-
-// RUN: rm -f %t.supp
-// RUN: touch %t.supp
-// RUN: %env_lsan_opts="$LSAN_BASE:suppressions='%t.supp'" not %run %t 2>&1 | FileCheck %s --check-prefix=NOSUPP
-
-// RUN: echo "leak:*LSanTestLeakingFunc*" > %t.supp
-// RUN: %env_lsan_opts="$LSAN_BASE:suppressions='%t.supp'" not %run %t 2>&1 | FileCheck %s
-
-// RUN: echo "leak:%t" > %t.supp
-// RUN: %env_lsan_opts="$LSAN_BASE:suppressions='%t.supp':symbolize=false" %run %t
-
-#include <stdio.h>
-#include <stdlib.h>
-
-void LSanTestLeakingFunc() {
- void *p = malloc(666);
- fprintf(stderr, "Test alloc: %p.\n", p);
-}
-
-int main() {
- LSanTestLeakingFunc();
- void *q = malloc(1337);
- fprintf(stderr, "Test alloc: %p.\n", q);
- return 0;
-}
-// CHECK: Suppressions used:
-// CHECK: 1 666 *LSanTestLeakingFunc*
-// CHECK: SUMMARY: {{(Leak|Address)}}Sanitizer: 1337 byte(s) leaked in 1 allocation(s)
-
-// NOSUPP: SUMMARY: {{(Leak|Address)}}Sanitizer: 2003 byte(s) leaked in 2 allocation(s).
Copied: compiler-rt/trunk/test/lsan/TestCases/suppressions_file.cpp (from r367705, compiler-rt/trunk/test/lsan/TestCases/suppressions_file.cc)
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/lsan/TestCases/suppressions_file.cpp?p2=compiler-rt/trunk/test/lsan/TestCases/suppressions_file.cpp&p1=compiler-rt/trunk/test/lsan/TestCases/suppressions_file.cc&r1=367705&r2=367803&rev=367803&view=diff
==============================================================================
(empty)
Removed: compiler-rt/trunk/test/lsan/TestCases/swapcontext.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/lsan/TestCases/swapcontext.cc?rev=367802&view=auto
==============================================================================
--- compiler-rt/trunk/test/lsan/TestCases/swapcontext.cc (original)
+++ compiler-rt/trunk/test/lsan/TestCases/swapcontext.cc (removed)
@@ -1,43 +0,0 @@
-// We can't unwind stack if we're running coroutines on heap-allocated
-// memory. Make sure we don't report these leaks.
-
-// RUN: %clangxx_lsan %s -o %t
-// RUN: %env_lsan_opts= %run %t 2>&1
-// RUN: %env_lsan_opts= not %run %t foo 2>&1 | FileCheck %s
-// UNSUPPORTED: arm,powerpc64
-
-#include "sanitizer_common/sanitizer_ucontext.h"
-#include <stdio.h>
-#include <unistd.h>
-
-const int kStackSize = 1 << 20;
-
-void Child() {
- int child_stack;
- printf("Child: %p\n", &child_stack);
- int *leaked = new int[666];
-}
-
-int main(int argc, char *argv[]) {
- char stack_memory[kStackSize + 1] __attribute__((aligned(16)));
- char *heap_memory = new char[kStackSize + 1];
- char *child_stack = (argc > 1) ? stack_memory : heap_memory;
-
- printf("Child stack: %p\n", child_stack);
- ucontext_t orig_context;
- ucontext_t child_context;
- getcontext(&child_context);
- child_context.uc_stack.ss_sp = child_stack;
- child_context.uc_stack.ss_size = kStackSize / 2;
- child_context.uc_link = &orig_context;
- makecontext(&child_context, Child, 0);
- if (swapcontext(&orig_context, &child_context) < 0) {
- perror("swapcontext");
- return 1;
- }
-
- delete[] heap_memory;
- return 0;
-}
-
-// CHECK: SUMMARY: {{(Leak|Address)}}Sanitizer: 2664 byte(s) leaked in 1 allocation(s)
Copied: compiler-rt/trunk/test/lsan/TestCases/swapcontext.cpp (from r367705, compiler-rt/trunk/test/lsan/TestCases/swapcontext.cc)
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/lsan/TestCases/swapcontext.cpp?p2=compiler-rt/trunk/test/lsan/TestCases/swapcontext.cpp&p1=compiler-rt/trunk/test/lsan/TestCases/swapcontext.cc&r1=367705&r2=367803&rev=367803&view=diff
==============================================================================
(empty)
Removed: compiler-rt/trunk/test/lsan/TestCases/use_after_return.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/lsan/TestCases/use_after_return.cc?rev=367802&view=auto
==============================================================================
--- compiler-rt/trunk/test/lsan/TestCases/use_after_return.cc (original)
+++ compiler-rt/trunk/test/lsan/TestCases/use_after_return.cc (removed)
@@ -1,24 +0,0 @@
-// Test that fake stack (introduced by ASan's use-after-return mode) is included
-// in the root set.
-// RUN: LSAN_BASE="report_objects=1:use_registers=0"
-// RUN: %clangxx_lsan %s -O2 -o %t
-// RUN: ASAN_OPTIONS=$ASAN_OPTIONS:detect_stack_use_after_return=1 %env_lsan_opts=$LSAN_BASE:"use_stacks=0" not %run %t 2>&1 | FileCheck %s
-// RUN: ASAN_OPTIONS=$ASAN_OPTIONS:detect_stack_use_after_return=1 %env_lsan_opts=$LSAN_BASE:"use_stacks=1" %run %t 2>&1
-// RUN: ASAN_OPTIONS=$ASAN_OPTIONS:detect_stack_use_after_return=1 %env_lsan_opts="" %run %t 2>&1
-
-#include <stdio.h>
-#include <stdlib.h>
-#include "sanitizer_common/print_address.h"
-
-int main() {
- void *stack_var = malloc(1337);
- print_address("Test alloc: ", 1, stack_var);
- // Take pointer to variable, to ensure it's not optimized into a register.
- print_address("Stack var at: ", 1, &stack_var);
- // Do not return from main to prevent the pointer from going out of scope.
- exit(0);
-}
-// CHECK: Test alloc: [[ADDR:0x[0-9,a-f]+]]
-// CHECK: LeakSanitizer: detected memory leaks
-// CHECK: [[ADDR]] (1337 bytes)
-// CHECK: SUMMARY: {{(Leak|Address)}}Sanitizer:
Copied: compiler-rt/trunk/test/lsan/TestCases/use_after_return.cpp (from r367705, compiler-rt/trunk/test/lsan/TestCases/use_after_return.cc)
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/lsan/TestCases/use_after_return.cpp?p2=compiler-rt/trunk/test/lsan/TestCases/use_after_return.cpp&p1=compiler-rt/trunk/test/lsan/TestCases/use_after_return.cc&r1=367705&r2=367803&rev=367803&view=diff
==============================================================================
(empty)
Removed: compiler-rt/trunk/test/lsan/TestCases/use_globals_initialized.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/lsan/TestCases/use_globals_initialized.cc?rev=367802&view=auto
==============================================================================
--- compiler-rt/trunk/test/lsan/TestCases/use_globals_initialized.cc (original)
+++ compiler-rt/trunk/test/lsan/TestCases/use_globals_initialized.cc (removed)
@@ -1,22 +0,0 @@
-// Test that initialized globals are included in the root set.
-// RUN: LSAN_BASE="report_objects=1:use_stacks=0:use_registers=0"
-// RUN: %clangxx_lsan %s -o %t
-// RUN: %env_lsan_opts=$LSAN_BASE:"use_globals=0" not %run %t 2>&1 | FileCheck %s
-// RUN: %env_lsan_opts=$LSAN_BASE:"use_globals=1" %run %t 2>&1
-// RUN: %env_lsan_opts="" %run %t 2>&1
-
-#include <stdio.h>
-#include <stdlib.h>
-#include "sanitizer_common/print_address.h"
-
-void *data_var = (void *)1;
-
-int main() {
- data_var = malloc(1337);
- print_address("Test alloc: ", 1, data_var);
- return 0;
-}
-// CHECK: Test alloc: [[ADDR:0x[0-9,a-f]+]]
-// CHECK: LeakSanitizer: detected memory leaks
-// CHECK: [[ADDR]] (1337 bytes)
-// CHECK: SUMMARY: {{(Leak|Address)}}Sanitizer:
Copied: compiler-rt/trunk/test/lsan/TestCases/use_globals_initialized.cpp (from r367705, compiler-rt/trunk/test/lsan/TestCases/use_globals_initialized.cc)
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/lsan/TestCases/use_globals_initialized.cpp?p2=compiler-rt/trunk/test/lsan/TestCases/use_globals_initialized.cpp&p1=compiler-rt/trunk/test/lsan/TestCases/use_globals_initialized.cc&r1=367705&r2=367803&rev=367803&view=diff
==============================================================================
(empty)
Removed: compiler-rt/trunk/test/lsan/TestCases/use_globals_uninitialized.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/lsan/TestCases/use_globals_uninitialized.cc?rev=367802&view=auto
==============================================================================
--- compiler-rt/trunk/test/lsan/TestCases/use_globals_uninitialized.cc (original)
+++ compiler-rt/trunk/test/lsan/TestCases/use_globals_uninitialized.cc (removed)
@@ -1,22 +0,0 @@
-// Test that uninitialized globals are included in the root set.
-// RUN: LSAN_BASE="report_objects=1:use_stacks=0:use_registers=0"
-// RUN: %clangxx_lsan %s -o %t
-// RUN: %env_lsan_opts=$LSAN_BASE:"use_globals=0" not %run %t 2>&1 | FileCheck %s
-// RUN: %env_lsan_opts=$LSAN_BASE:"use_globals=1" %run %t 2>&1
-// RUN: %env_lsan_opts="" %run %t 2>&1
-
-#include <stdio.h>
-#include <stdlib.h>
-#include "sanitizer_common/print_address.h"
-
-void *bss_var;
-
-int main() {
- bss_var = malloc(1337);
- print_address("Test alloc: ", 1, bss_var);
- return 0;
-}
-// CHECK: Test alloc: [[ADDR:0x[0-9,a-f]+]]
-// CHECK: LeakSanitizer: detected memory leaks
-// CHECK: [[ADDR]] (1337 bytes)
-// CHECK: SUMMARY: {{(Leak|Address)}}Sanitizer:
Copied: compiler-rt/trunk/test/lsan/TestCases/use_globals_uninitialized.cpp (from r367705, compiler-rt/trunk/test/lsan/TestCases/use_globals_uninitialized.cc)
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/lsan/TestCases/use_globals_uninitialized.cpp?p2=compiler-rt/trunk/test/lsan/TestCases/use_globals_uninitialized.cpp&p1=compiler-rt/trunk/test/lsan/TestCases/use_globals_uninitialized.cc&r1=367705&r2=367803&rev=367803&view=diff
==============================================================================
(empty)
Removed: compiler-rt/trunk/test/lsan/TestCases/use_poisoned_asan.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/lsan/TestCases/use_poisoned_asan.cc?rev=367802&view=auto
==============================================================================
--- compiler-rt/trunk/test/lsan/TestCases/use_poisoned_asan.cc (original)
+++ compiler-rt/trunk/test/lsan/TestCases/use_poisoned_asan.cc (removed)
@@ -1,26 +0,0 @@
-// ASan-poisoned memory should be ignored if use_poisoned is false.
-// REQUIRES: asan
-// RUN: LSAN_BASE="report_objects=1:use_stacks=0:use_registers=0"
-// RUN: %clangxx_lsan %s -o %t
-// RUN: %env_lsan_opts=$LSAN_BASE:"use_poisoned=0" not %run %t 2>&1 | FileCheck %s
-// RUN: %env_lsan_opts=$LSAN_BASE:"use_poisoned=1" %run %t 2>&1
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <sanitizer/asan_interface.h>
-#include <assert.h>
-#include "sanitizer_common/print_address.h"
-
-void **p;
-
-int main() {
- p = new void *;
- *p = malloc(1337);
- print_address("Test alloc: ", 1, *p);
- __asan_poison_memory_region(p, sizeof(*p));
- return 0;
-}
-// CHECK: Test alloc: [[ADDR:0x[0-9,a-f]+]]
-// CHECK: LeakSanitizer: detected memory leaks
-// CHECK: [[ADDR]] (1337 bytes)
-// CHECK: SUMMARY: AddressSanitizer:
Copied: compiler-rt/trunk/test/lsan/TestCases/use_poisoned_asan.cpp (from r367705, compiler-rt/trunk/test/lsan/TestCases/use_poisoned_asan.cc)
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/lsan/TestCases/use_poisoned_asan.cpp?p2=compiler-rt/trunk/test/lsan/TestCases/use_poisoned_asan.cpp&p1=compiler-rt/trunk/test/lsan/TestCases/use_poisoned_asan.cc&r1=367705&r2=367803&rev=367803&view=diff
==============================================================================
(empty)
Removed: compiler-rt/trunk/test/lsan/TestCases/use_registers.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/lsan/TestCases/use_registers.cc?rev=367802&view=auto
==============================================================================
--- compiler-rt/trunk/test/lsan/TestCases/use_registers.cc (original)
+++ compiler-rt/trunk/test/lsan/TestCases/use_registers.cc (removed)
@@ -1,68 +0,0 @@
-// Test that registers of running threads are included in the root set.
-// RUN: LSAN_BASE="report_objects=1:use_stacks=0"
-// RUN: %clangxx_lsan -pthread %s -o %t
-// RUN: %env_lsan_opts=$LSAN_BASE:"use_registers=0" not %run %t 2>&1 | FileCheck %s
-// RUN: %env_lsan_opts=$LSAN_BASE:"use_registers=1" %run %t 2>&1
-// RUN: %env_lsan_opts="" %run %t 2>&1
-
-#include <assert.h>
-#include <pthread.h>
-#include <sched.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include "sanitizer_common/print_address.h"
-
-extern "C"
-void *registers_thread_func(void *arg) {
- int *sync = reinterpret_cast<int *>(arg);
- void *p = malloc(1337);
- // To store the pointer, choose a register which is unlikely to be reused by
- // a function call.
-#if defined(__i386__)
- asm ( "mov %0, %%esi"
- :
- : "r" (p)
- );
-#elif defined(__x86_64__)
- asm ( "mov %0, %%r15"
- :
- : "r" (p)
- );
-#elif defined(__mips__)
- asm ( "move $16, %0"
- :
- : "r" (p)
- );
-#elif defined(__arm__)
- asm ( "mov r5, %0"
- :
- : "r" (p)
- );
-#elif defined(__powerpc__)
- asm ( "mr 30, %0"
- :
- : "r" (p)
- );
-#else
-#error "Test is not supported on this architecture."
-#endif
- print_address("Test alloc: ", 1, p);
- fflush(stderr);
- __sync_fetch_and_xor(sync, 1);
- while (true)
- sched_yield();
-}
-
-int main() {
- int sync = 0;
- pthread_t thread_id;
- int res = pthread_create(&thread_id, 0, registers_thread_func, &sync);
- assert(res == 0);
- while (!__sync_fetch_and_xor(&sync, 0))
- sched_yield();
- return 0;
-}
-// CHECK: Test alloc: [[ADDR:0x[0-9,a-f]+]]
-// CHECK: LeakSanitizer: detected memory leaks
-// CHECK: [[ADDR]] (1337 bytes)
-// CHECK: SUMMARY: {{(Leak|Address)}}Sanitizer:
Copied: compiler-rt/trunk/test/lsan/TestCases/use_registers.cpp (from r367705, compiler-rt/trunk/test/lsan/TestCases/use_registers.cc)
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/lsan/TestCases/use_registers.cpp?p2=compiler-rt/trunk/test/lsan/TestCases/use_registers.cpp&p1=compiler-rt/trunk/test/lsan/TestCases/use_registers.cc&r1=367705&r2=367803&rev=367803&view=diff
==============================================================================
(empty)
Removed: compiler-rt/trunk/test/lsan/TestCases/use_stacks.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/lsan/TestCases/use_stacks.cc?rev=367802&view=auto
==============================================================================
--- compiler-rt/trunk/test/lsan/TestCases/use_stacks.cc (original)
+++ compiler-rt/trunk/test/lsan/TestCases/use_stacks.cc (removed)
@@ -1,21 +0,0 @@
-// Test that stack of main thread is included in the root set.
-// RUN: LSAN_BASE="report_objects=1:use_registers=0"
-// RUN: %clangxx_lsan %s -o %t
-// RUN: %env_lsan_opts=$LSAN_BASE:"use_stacks=0" not %run %t 2>&1 | FileCheck %s
-// RUN: %env_lsan_opts=$LSAN_BASE:"use_stacks=1" %run %t 2>&1
-// RUN: %env_lsan_opts="" %run %t 2>&1
-
-#include <stdio.h>
-#include <stdlib.h>
-#include "sanitizer_common/print_address.h"
-
-int main() {
- void *stack_var = malloc(1337);
- print_address("Test alloc: ", 1, stack_var);
- // Do not return from main to prevent the pointer from going out of scope.
- exit(0);
-}
-// CHECK: Test alloc: [[ADDR:0x[0-9,a-f]+]]
-// CHECK: LeakSanitizer: detected memory leaks
-// CHECK: [[ADDR]] (1337 bytes)
-// CHECK: SUMMARY: {{(Leak|Address)}}Sanitizer:
Copied: compiler-rt/trunk/test/lsan/TestCases/use_stacks.cpp (from r367705, compiler-rt/trunk/test/lsan/TestCases/use_stacks.cc)
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/lsan/TestCases/use_stacks.cpp?p2=compiler-rt/trunk/test/lsan/TestCases/use_stacks.cpp&p1=compiler-rt/trunk/test/lsan/TestCases/use_stacks.cc&r1=367705&r2=367803&rev=367803&view=diff
==============================================================================
(empty)
Removed: compiler-rt/trunk/test/lsan/TestCases/use_stacks_threaded.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/lsan/TestCases/use_stacks_threaded.cc?rev=367802&view=auto
==============================================================================
--- compiler-rt/trunk/test/lsan/TestCases/use_stacks_threaded.cc (original)
+++ compiler-rt/trunk/test/lsan/TestCases/use_stacks_threaded.cc (removed)
@@ -1,38 +0,0 @@
-// Test that stacks of non-main threads are included in the root set.
-// RUN: LSAN_BASE="report_objects=1:use_registers=0"
-// RUN: %clangxx_lsan -pthread %s -o %t
-// RUN: %env_lsan_opts=$LSAN_BASE:"use_stacks=0" not %run %t 2>&1 | FileCheck %s
-// RUN: %env_lsan_opts=$LSAN_BASE:"use_stacks=1" %run %t 2>&1
-// RUN: %env_lsan_opts="" %run %t 2>&1
-
-#include <assert.h>
-#include <pthread.h>
-#include <sched.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include "sanitizer_common/print_address.h"
-
-extern "C"
-void *stacks_thread_func(void *arg) {
- int *sync = reinterpret_cast<int *>(arg);
- void *p = malloc(1337);
- print_address("Test alloc: ", 1, p);
- fflush(stderr);
- __sync_fetch_and_xor(sync, 1);
- while (true)
- sched_yield();
-}
-
-int main() {
- int sync = 0;
- pthread_t thread_id;
- int res = pthread_create(&thread_id, 0, stacks_thread_func, &sync);
- assert(res == 0);
- while (!__sync_fetch_and_xor(&sync, 0))
- sched_yield();
- return 0;
-}
-// CHECK: Test alloc: [[ADDR:0x[0-9,a-f]+]]
-// CHECK: LeakSanitizer: detected memory leaks
-// CHECK: [[ADDR]] (1337 bytes)
-// CHECK: SUMMARY: {{(Leak|Address)}}Sanitizer:
Copied: compiler-rt/trunk/test/lsan/TestCases/use_stacks_threaded.cpp (from r367705, compiler-rt/trunk/test/lsan/TestCases/use_stacks_threaded.cc)
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/lsan/TestCases/use_stacks_threaded.cpp?p2=compiler-rt/trunk/test/lsan/TestCases/use_stacks_threaded.cpp&p1=compiler-rt/trunk/test/lsan/TestCases/use_stacks_threaded.cc&r1=367705&r2=367803&rev=367803&view=diff
==============================================================================
(empty)
Removed: compiler-rt/trunk/test/lsan/TestCases/use_unaligned.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/lsan/TestCases/use_unaligned.cc?rev=367802&view=auto
==============================================================================
--- compiler-rt/trunk/test/lsan/TestCases/use_unaligned.cc (original)
+++ compiler-rt/trunk/test/lsan/TestCases/use_unaligned.cc (removed)
@@ -1,24 +0,0 @@
-// Test that unaligned pointers are detected correctly.
-// RUN: LSAN_BASE="report_objects=1:use_stacks=0:use_registers=0"
-// RUN: %clangxx_lsan %s -o %t
-// RUN: %env_lsan_opts=$LSAN_BASE:"use_unaligned=0" not %run %t 2>&1 | FileCheck %s
-// RUN: %env_lsan_opts=$LSAN_BASE:"use_unaligned=1" %run %t 2>&1
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include "sanitizer_common/print_address.h"
-
-void *arr[2];
-
-int main() {
- void *p = malloc(1337);
- print_address("Test alloc: ", 1, p);
- char *char_arr = (char *)arr;
- memcpy(char_arr + 1, &p, sizeof(p));
- return 0;
-}
-// CHECK: Test alloc: [[ADDR:0x[0-9,a-f]+]]
-// CHECK: LeakSanitizer: detected memory leaks
-// CHECK: [[ADDR]] (1337 bytes)
-// CHECK: SUMMARY: {{(Leak|Address)}}Sanitizer:
Copied: compiler-rt/trunk/test/lsan/TestCases/use_unaligned.cpp (from r367705, compiler-rt/trunk/test/lsan/TestCases/use_unaligned.cc)
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/lsan/TestCases/use_unaligned.cpp?p2=compiler-rt/trunk/test/lsan/TestCases/use_unaligned.cpp&p1=compiler-rt/trunk/test/lsan/TestCases/use_unaligned.cc&r1=367705&r2=367803&rev=367803&view=diff
==============================================================================
(empty)
More information about the llvm-commits
mailing list