[compiler-rt] r183000 - [lsan] Run the leak detection tests under both ASan and LSan.
Sergey Matveev
earthdok at google.com
Fri May 31 06:13:56 PDT 2013
Author: smatveev
Date: Fri May 31 08:13:55 2013
New Revision: 183000
URL: http://llvm.org/viewvc/llvm-project?rev=183000&view=rev
Log:
[lsan] Run the leak detection tests under both ASan and LSan.
Change the LSan lit test logic. Now "check-lsan" tests the leak
checking functionality in both standalone LSan and ASan.
Added:
compiler-rt/trunk/lib/lsan/lit_tests/AsanConfig/
compiler-rt/trunk/lib/lsan/lit_tests/AsanConfig/lit.cfg
compiler-rt/trunk/lib/lsan/lit_tests/AsanConfig/lit.site.cfg.in
- copied, changed from r182999, compiler-rt/trunk/lib/lsan/lit_tests/lit.site.cfg.in
compiler-rt/trunk/lib/lsan/lit_tests/LsanConfig/
compiler-rt/trunk/lib/lsan/lit_tests/LsanConfig/lit.cfg
compiler-rt/trunk/lib/lsan/lit_tests/LsanConfig/lit.site.cfg.in
- copied, changed from r182999, compiler-rt/trunk/lib/lsan/lit_tests/lit.site.cfg.in
compiler-rt/trunk/lib/lsan/lit_tests/TestCases/
compiler-rt/trunk/lib/lsan/lit_tests/TestCases/SharedLibs/
compiler-rt/trunk/lib/lsan/lit_tests/TestCases/SharedLibs/huge_tls_lib_so.cc
- copied, changed from r182999, compiler-rt/trunk/lib/lsan/lit_tests/SharedLibs/huge_tls_lib_so.cc
compiler-rt/trunk/lib/lsan/lit_tests/TestCases/SharedLibs/lit.local.cfg
- copied, changed from r182999, compiler-rt/trunk/lib/lsan/lit_tests/SharedLibs/lit.local.cfg
compiler-rt/trunk/lib/lsan/lit_tests/TestCases/large_allocation_leak.cc
- copied, changed from r182999, compiler-rt/trunk/lib/lsan/lit_tests/large_allocation_leak.cc
compiler-rt/trunk/lib/lsan/lit_tests/TestCases/stale_stack_leak.cc
- copied, changed from r182999, compiler-rt/trunk/lib/lsan/lit_tests/stale_stack_leak.cc
compiler-rt/trunk/lib/lsan/lit_tests/TestCases/use_globals_initialized.cc
- copied, changed from r182999, compiler-rt/trunk/lib/lsan/lit_tests/use_globals_initialized.cc
compiler-rt/trunk/lib/lsan/lit_tests/TestCases/use_globals_uninitialized.cc
- copied, changed from r182999, compiler-rt/trunk/lib/lsan/lit_tests/use_globals_uninitialized.cc
compiler-rt/trunk/lib/lsan/lit_tests/TestCases/use_registers.cc
- copied, changed from r182999, compiler-rt/trunk/lib/lsan/lit_tests/use_registers.cc
compiler-rt/trunk/lib/lsan/lit_tests/TestCases/use_stacks.cc
- copied, changed from r182999, compiler-rt/trunk/lib/lsan/lit_tests/use_stacks.cc
compiler-rt/trunk/lib/lsan/lit_tests/TestCases/use_stacks_threaded.cc
- copied, changed from r182999, compiler-rt/trunk/lib/lsan/lit_tests/use_stacks_threaded.cc
compiler-rt/trunk/lib/lsan/lit_tests/TestCases/use_tls_dynamic.cc
- copied, changed from r182999, compiler-rt/trunk/lib/lsan/lit_tests/use_tls_dynamic.cc
compiler-rt/trunk/lib/lsan/lit_tests/TestCases/use_tls_pthread_specific_dynamic.cc
- copied, changed from r182999, compiler-rt/trunk/lib/lsan/lit_tests/use_tls_pthread_specific_dynamic.cc
compiler-rt/trunk/lib/lsan/lit_tests/TestCases/use_tls_pthread_specific_static.cc
- copied, changed from r182999, compiler-rt/trunk/lib/lsan/lit_tests/use_tls_pthread_specific_static.cc
compiler-rt/trunk/lib/lsan/lit_tests/TestCases/use_tls_static.cc
- copied, changed from r182999, compiler-rt/trunk/lib/lsan/lit_tests/use_tls_static.cc
compiler-rt/trunk/lib/lsan/lit_tests/TestCases/use_unaligned.cc
- copied, changed from r182999, compiler-rt/trunk/lib/lsan/lit_tests/use_unaligned.cc
compiler-rt/trunk/lib/lsan/lit_tests/lit.common.cfg
- copied, changed from r182999, compiler-rt/trunk/lib/lsan/lit_tests/lit.cfg
Removed:
compiler-rt/trunk/lib/lsan/lit_tests/SharedLibs/huge_tls_lib_so.cc
compiler-rt/trunk/lib/lsan/lit_tests/SharedLibs/lit.local.cfg
compiler-rt/trunk/lib/lsan/lit_tests/large_allocation_leak.cc
compiler-rt/trunk/lib/lsan/lit_tests/lit.cfg
compiler-rt/trunk/lib/lsan/lit_tests/lit.site.cfg.in
compiler-rt/trunk/lib/lsan/lit_tests/stale_stack_leak.cc
compiler-rt/trunk/lib/lsan/lit_tests/use_globals_initialized.cc
compiler-rt/trunk/lib/lsan/lit_tests/use_globals_uninitialized.cc
compiler-rt/trunk/lib/lsan/lit_tests/use_registers.cc
compiler-rt/trunk/lib/lsan/lit_tests/use_stacks.cc
compiler-rt/trunk/lib/lsan/lit_tests/use_stacks_threaded.cc
compiler-rt/trunk/lib/lsan/lit_tests/use_tls_dynamic.cc
compiler-rt/trunk/lib/lsan/lit_tests/use_tls_pthread_specific_dynamic.cc
compiler-rt/trunk/lib/lsan/lit_tests/use_tls_pthread_specific_static.cc
compiler-rt/trunk/lib/lsan/lit_tests/use_tls_static.cc
compiler-rt/trunk/lib/lsan/lit_tests/use_unaligned.cc
Modified:
compiler-rt/trunk/lib/lsan/lit_tests/CMakeLists.txt
Added: compiler-rt/trunk/lib/lsan/lit_tests/AsanConfig/lit.cfg
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/lsan/lit_tests/AsanConfig/lit.cfg?rev=183000&view=auto
==============================================================================
--- compiler-rt/trunk/lib/lsan/lit_tests/AsanConfig/lit.cfg (added)
+++ compiler-rt/trunk/lib/lsan/lit_tests/AsanConfig/lit.cfg Fri May 31 08:13:55 2013
@@ -0,0 +1,26 @@
+# -*- Python -*-
+
+import os
+
+def get_required_attr(config, attr_name):
+ attr_value = getattr(config, attr_name, None)
+ if not attr_value:
+ lit.fatal("No attribute %r in test configuration! You may need to run "
+ "tests from your build directory or add this attribute "
+ "to lit.site.cfg " % attr_name)
+ return attr_value
+
+lsan_lit_src_root = get_required_attr(config, "lsan_lit_src_root")
+lsan_lit_cfg = os.path.join(lsan_lit_src_root, "lit.common.cfg")
+if not os.path.exists(lsan_lit_cfg):
+ lit.fatal("Can't find common LSan lit config at: %r" % lsan_lit_cfg)
+lit.load_config(config, lsan_lit_cfg)
+
+config.name = 'LeakSanitizer-AddressSanitizer'
+
+clang_lsan_cxxflags = config.clang_cxxflags + " -fsanitize=address "
+
+config.substitutions.append( ("%clangxx_lsan ", (" " + config.clang + " " +
+ clang_lsan_cxxflags + " ")) )
+
+config.environment['ASAN_OPTIONS'] = 'detect_leaks=1'
Copied: compiler-rt/trunk/lib/lsan/lit_tests/AsanConfig/lit.site.cfg.in (from r182999, compiler-rt/trunk/lib/lsan/lit_tests/lit.site.cfg.in)
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/lsan/lit_tests/AsanConfig/lit.site.cfg.in?p2=compiler-rt/trunk/lib/lsan/lit_tests/AsanConfig/lit.site.cfg.in&p1=compiler-rt/trunk/lib/lsan/lit_tests/lit.site.cfg.in&r1=182999&r2=183000&rev=183000&view=diff
==============================================================================
--- compiler-rt/trunk/lib/lsan/lit_tests/lit.site.cfg.in (original)
+++ compiler-rt/trunk/lib/lsan/lit_tests/AsanConfig/lit.site.cfg.in Fri May 31 08:13:55 2013
@@ -7,6 +7,7 @@ config.llvm_obj_root = "@LLVM_BINARY_DIR
config.llvm_tools_dir = "@LLVM_TOOLS_DIR@"
config.clang = "@LLVM_BINARY_DIR@/bin/clang"
config.compiler_rt_arch = "@COMPILER_RT_SUPPORTED_ARCH@"
+config.lsan_lit_src_root = "@LSAN_LIT_SOURCE_DIR@"
# LLVM tools dir can be passed in lit parameters, so try to
# apply substitution.
@@ -17,4 +18,4 @@ except KeyError,e:
lit.fatal("unable to find %r parameter, use '--param=%s=VALUE'" % (key, key))
# Let the main config do the real work.
-lit.load_config(config, "@CMAKE_CURRENT_SOURCE_DIR@/lit.cfg")
+lit.load_config(config, "@LSAN_LIT_SOURCE_DIR@/AsanConfig/lit.cfg")
Modified: compiler-rt/trunk/lib/lsan/lit_tests/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/lsan/lit_tests/CMakeLists.txt?rev=183000&r1=182999&r2=183000&view=diff
==============================================================================
--- compiler-rt/trunk/lib/lsan/lit_tests/CMakeLists.txt (original)
+++ compiler-rt/trunk/lib/lsan/lit_tests/CMakeLists.txt Fri May 31 08:13:55 2013
@@ -1,9 +1,16 @@
set(LSAN_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/..)
set(LSAN_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/..)
+set(LSAN_LIT_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
+
+configure_lit_site_cfg(
+ ${CMAKE_CURRENT_SOURCE_DIR}/LsanConfig/lit.site.cfg.in
+ ${CMAKE_CURRENT_BINARY_DIR}/LsanConfig/lit.site.cfg
+ )
+
configure_lit_site_cfg(
- ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.in
- ${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg
+ ${CMAKE_CURRENT_SOURCE_DIR}/AsanConfig/lit.site.cfg.in
+ ${CMAKE_CURRENT_BINARY_DIR}/AsanConfig/lit.site.cfg
)
configure_lit_site_cfg(
@@ -11,18 +18,20 @@ configure_lit_site_cfg(
${CMAKE_CURRENT_BINARY_DIR}/Unit/lit.site.cfg
)
-if(COMPILER_RT_CAN_EXECUTE_TESTS)
+if(COMPILER_RT_CAN_EXECUTE_TESTS AND NOT APPLE AND NOT ANDROID)
set(LSAN_TEST_DEPS
${SANITIZER_COMMON_LIT_TEST_DEPS}
${LSAN_RUNTIME_LIBRARIES})
- set(LSAN_TEST_PARAMS
- lsan_site_config=${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg)
+ foreach(arch ${LSAN_SUPPORTED_ARCH})
+ list(APPEND LSAN_TEST_DEPS clang_rt.asan-${arch})
+ endforeach()
if(LLVM_INCLUDE_TESTS)
list(APPEND LSAN_TEST_DEPS LsanTests)
endif()
add_lit_testsuite(check-lsan "Running the LeakSanitizer tests"
- ${CMAKE_CURRENT_BINARY_DIR}
- PARAMS ${LSAN_TEST_PARAMS}
+ ${CMAKE_CURRENT_BINARY_DIR}/LsanConfig
+ ${CMAKE_CURRENT_BINARY_DIR}/AsanConfig
+ ${CMAKE_CURRENT_BINARY_DIR}/Unit
DEPENDS ${LSAN_TEST_DEPS})
set_target_properties(check-lsan PROPERTIES FOLDER "LSan tests")
endif()
Added: compiler-rt/trunk/lib/lsan/lit_tests/LsanConfig/lit.cfg
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/lsan/lit_tests/LsanConfig/lit.cfg?rev=183000&view=auto
==============================================================================
--- compiler-rt/trunk/lib/lsan/lit_tests/LsanConfig/lit.cfg (added)
+++ compiler-rt/trunk/lib/lsan/lit_tests/LsanConfig/lit.cfg Fri May 31 08:13:55 2013
@@ -0,0 +1,24 @@
+# -*- Python -*-
+
+import os
+
+def get_required_attr(config, attr_name):
+ attr_value = getattr(config, attr_name, None)
+ if not attr_value:
+ lit.fatal("No attribute %r in test configuration! You may need to run "
+ "tests from your build directory or add this attribute "
+ "to lit.site.cfg " % attr_name)
+ return attr_value
+
+lsan_lit_src_root = get_required_attr(config, "lsan_lit_src_root")
+lsan_lit_cfg = os.path.join(lsan_lit_src_root, "lit.common.cfg")
+if not os.path.exists(lsan_lit_cfg):
+ lit.fatal("Can't find common LSan lit config at: %r" % lsan_lit_cfg)
+lit.load_config(config, lsan_lit_cfg)
+
+config.name = 'LeakSanitizer-Standalone'
+
+clang_lsan_cxxflags = config.clang_cxxflags + " -fsanitize=leak "
+
+config.substitutions.append( ("%clangxx_lsan ", (" " + config.clang + " " +
+ clang_lsan_cxxflags + " ")) )
Copied: compiler-rt/trunk/lib/lsan/lit_tests/LsanConfig/lit.site.cfg.in (from r182999, compiler-rt/trunk/lib/lsan/lit_tests/lit.site.cfg.in)
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/lsan/lit_tests/LsanConfig/lit.site.cfg.in?p2=compiler-rt/trunk/lib/lsan/lit_tests/LsanConfig/lit.site.cfg.in&p1=compiler-rt/trunk/lib/lsan/lit_tests/lit.site.cfg.in&r1=182999&r2=183000&rev=183000&view=diff
==============================================================================
--- compiler-rt/trunk/lib/lsan/lit_tests/lit.site.cfg.in (original)
+++ compiler-rt/trunk/lib/lsan/lit_tests/LsanConfig/lit.site.cfg.in Fri May 31 08:13:55 2013
@@ -7,6 +7,7 @@ config.llvm_obj_root = "@LLVM_BINARY_DIR
config.llvm_tools_dir = "@LLVM_TOOLS_DIR@"
config.clang = "@LLVM_BINARY_DIR@/bin/clang"
config.compiler_rt_arch = "@COMPILER_RT_SUPPORTED_ARCH@"
+config.lsan_lit_src_root = "@LSAN_LIT_SOURCE_DIR@"
# LLVM tools dir can be passed in lit parameters, so try to
# apply substitution.
@@ -17,4 +18,4 @@ except KeyError,e:
lit.fatal("unable to find %r parameter, use '--param=%s=VALUE'" % (key, key))
# Let the main config do the real work.
-lit.load_config(config, "@CMAKE_CURRENT_SOURCE_DIR@/lit.cfg")
+lit.load_config(config, "@LSAN_LIT_SOURCE_DIR@/LsanConfig/lit.cfg")
Removed: compiler-rt/trunk/lib/lsan/lit_tests/SharedLibs/huge_tls_lib_so.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/lsan/lit_tests/SharedLibs/huge_tls_lib_so.cc?rev=182999&view=auto
==============================================================================
--- compiler-rt/trunk/lib/lsan/lit_tests/SharedLibs/huge_tls_lib_so.cc (original)
+++ compiler-rt/trunk/lib/lsan/lit_tests/SharedLibs/huge_tls_lib_so.cc (removed)
@@ -1,12 +0,0 @@
-// 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];
-}
Removed: compiler-rt/trunk/lib/lsan/lit_tests/SharedLibs/lit.local.cfg
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/lsan/lit_tests/SharedLibs/lit.local.cfg?rev=182999&view=auto
==============================================================================
--- compiler-rt/trunk/lib/lsan/lit_tests/SharedLibs/lit.local.cfg (original)
+++ compiler-rt/trunk/lib/lsan/lit_tests/SharedLibs/lit.local.cfg (removed)
@@ -1,4 +0,0 @@
-# Sources in this directory are compiled as shared libraries and used by
-# tests in parent directory.
-
-config.suffixes = []
Copied: compiler-rt/trunk/lib/lsan/lit_tests/TestCases/SharedLibs/huge_tls_lib_so.cc (from r182999, compiler-rt/trunk/lib/lsan/lit_tests/SharedLibs/huge_tls_lib_so.cc)
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/lsan/lit_tests/TestCases/SharedLibs/huge_tls_lib_so.cc?p2=compiler-rt/trunk/lib/lsan/lit_tests/TestCases/SharedLibs/huge_tls_lib_so.cc&p1=compiler-rt/trunk/lib/lsan/lit_tests/SharedLibs/huge_tls_lib_so.cc&r1=182999&r2=183000&rev=183000&view=diff
==============================================================================
(empty)
Copied: compiler-rt/trunk/lib/lsan/lit_tests/TestCases/SharedLibs/lit.local.cfg (from r182999, compiler-rt/trunk/lib/lsan/lit_tests/SharedLibs/lit.local.cfg)
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/lsan/lit_tests/TestCases/SharedLibs/lit.local.cfg?p2=compiler-rt/trunk/lib/lsan/lit_tests/TestCases/SharedLibs/lit.local.cfg&p1=compiler-rt/trunk/lib/lsan/lit_tests/SharedLibs/lit.local.cfg&r1=182999&r2=183000&rev=183000&view=diff
==============================================================================
(empty)
Copied: compiler-rt/trunk/lib/lsan/lit_tests/TestCases/large_allocation_leak.cc (from r182999, compiler-rt/trunk/lib/lsan/lit_tests/large_allocation_leak.cc)
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/lsan/lit_tests/TestCases/large_allocation_leak.cc?p2=compiler-rt/trunk/lib/lsan/lit_tests/TestCases/large_allocation_leak.cc&p1=compiler-rt/trunk/lib/lsan/lit_tests/large_allocation_leak.cc&r1=182999&r2=183000&rev=183000&view=diff
==============================================================================
(empty)
Copied: compiler-rt/trunk/lib/lsan/lit_tests/TestCases/stale_stack_leak.cc (from r182999, compiler-rt/trunk/lib/lsan/lit_tests/stale_stack_leak.cc)
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/lsan/lit_tests/TestCases/stale_stack_leak.cc?p2=compiler-rt/trunk/lib/lsan/lit_tests/TestCases/stale_stack_leak.cc&p1=compiler-rt/trunk/lib/lsan/lit_tests/stale_stack_leak.cc&r1=182999&r2=183000&rev=183000&view=diff
==============================================================================
(empty)
Copied: compiler-rt/trunk/lib/lsan/lit_tests/TestCases/use_globals_initialized.cc (from r182999, compiler-rt/trunk/lib/lsan/lit_tests/use_globals_initialized.cc)
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/lsan/lit_tests/TestCases/use_globals_initialized.cc?p2=compiler-rt/trunk/lib/lsan/lit_tests/TestCases/use_globals_initialized.cc&p1=compiler-rt/trunk/lib/lsan/lit_tests/use_globals_initialized.cc&r1=182999&r2=183000&rev=183000&view=diff
==============================================================================
(empty)
Copied: compiler-rt/trunk/lib/lsan/lit_tests/TestCases/use_globals_uninitialized.cc (from r182999, compiler-rt/trunk/lib/lsan/lit_tests/use_globals_uninitialized.cc)
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/lsan/lit_tests/TestCases/use_globals_uninitialized.cc?p2=compiler-rt/trunk/lib/lsan/lit_tests/TestCases/use_globals_uninitialized.cc&p1=compiler-rt/trunk/lib/lsan/lit_tests/use_globals_uninitialized.cc&r1=182999&r2=183000&rev=183000&view=diff
==============================================================================
(empty)
Copied: compiler-rt/trunk/lib/lsan/lit_tests/TestCases/use_registers.cc (from r182999, compiler-rt/trunk/lib/lsan/lit_tests/use_registers.cc)
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/lsan/lit_tests/TestCases/use_registers.cc?p2=compiler-rt/trunk/lib/lsan/lit_tests/TestCases/use_registers.cc&p1=compiler-rt/trunk/lib/lsan/lit_tests/use_registers.cc&r1=182999&r2=183000&rev=183000&view=diff
==============================================================================
(empty)
Copied: compiler-rt/trunk/lib/lsan/lit_tests/TestCases/use_stacks.cc (from r182999, compiler-rt/trunk/lib/lsan/lit_tests/use_stacks.cc)
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/lsan/lit_tests/TestCases/use_stacks.cc?p2=compiler-rt/trunk/lib/lsan/lit_tests/TestCases/use_stacks.cc&p1=compiler-rt/trunk/lib/lsan/lit_tests/use_stacks.cc&r1=182999&r2=183000&rev=183000&view=diff
==============================================================================
(empty)
Copied: compiler-rt/trunk/lib/lsan/lit_tests/TestCases/use_stacks_threaded.cc (from r182999, compiler-rt/trunk/lib/lsan/lit_tests/use_stacks_threaded.cc)
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/lsan/lit_tests/TestCases/use_stacks_threaded.cc?p2=compiler-rt/trunk/lib/lsan/lit_tests/TestCases/use_stacks_threaded.cc&p1=compiler-rt/trunk/lib/lsan/lit_tests/use_stacks_threaded.cc&r1=182999&r2=183000&rev=183000&view=diff
==============================================================================
(empty)
Copied: compiler-rt/trunk/lib/lsan/lit_tests/TestCases/use_tls_dynamic.cc (from r182999, compiler-rt/trunk/lib/lsan/lit_tests/use_tls_dynamic.cc)
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/lsan/lit_tests/TestCases/use_tls_dynamic.cc?p2=compiler-rt/trunk/lib/lsan/lit_tests/TestCases/use_tls_dynamic.cc&p1=compiler-rt/trunk/lib/lsan/lit_tests/use_tls_dynamic.cc&r1=182999&r2=183000&rev=183000&view=diff
==============================================================================
(empty)
Copied: compiler-rt/trunk/lib/lsan/lit_tests/TestCases/use_tls_pthread_specific_dynamic.cc (from r182999, compiler-rt/trunk/lib/lsan/lit_tests/use_tls_pthread_specific_dynamic.cc)
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/lsan/lit_tests/TestCases/use_tls_pthread_specific_dynamic.cc?p2=compiler-rt/trunk/lib/lsan/lit_tests/TestCases/use_tls_pthread_specific_dynamic.cc&p1=compiler-rt/trunk/lib/lsan/lit_tests/use_tls_pthread_specific_dynamic.cc&r1=182999&r2=183000&rev=183000&view=diff
==============================================================================
(empty)
Copied: compiler-rt/trunk/lib/lsan/lit_tests/TestCases/use_tls_pthread_specific_static.cc (from r182999, compiler-rt/trunk/lib/lsan/lit_tests/use_tls_pthread_specific_static.cc)
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/lsan/lit_tests/TestCases/use_tls_pthread_specific_static.cc?p2=compiler-rt/trunk/lib/lsan/lit_tests/TestCases/use_tls_pthread_specific_static.cc&p1=compiler-rt/trunk/lib/lsan/lit_tests/use_tls_pthread_specific_static.cc&r1=182999&r2=183000&rev=183000&view=diff
==============================================================================
(empty)
Copied: compiler-rt/trunk/lib/lsan/lit_tests/TestCases/use_tls_static.cc (from r182999, compiler-rt/trunk/lib/lsan/lit_tests/use_tls_static.cc)
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/lsan/lit_tests/TestCases/use_tls_static.cc?p2=compiler-rt/trunk/lib/lsan/lit_tests/TestCases/use_tls_static.cc&p1=compiler-rt/trunk/lib/lsan/lit_tests/use_tls_static.cc&r1=182999&r2=183000&rev=183000&view=diff
==============================================================================
(empty)
Copied: compiler-rt/trunk/lib/lsan/lit_tests/TestCases/use_unaligned.cc (from r182999, compiler-rt/trunk/lib/lsan/lit_tests/use_unaligned.cc)
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/lsan/lit_tests/TestCases/use_unaligned.cc?p2=compiler-rt/trunk/lib/lsan/lit_tests/TestCases/use_unaligned.cc&p1=compiler-rt/trunk/lib/lsan/lit_tests/use_unaligned.cc&r1=182999&r2=183000&rev=183000&view=diff
==============================================================================
(empty)
Removed: compiler-rt/trunk/lib/lsan/lit_tests/large_allocation_leak.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/lsan/lit_tests/large_allocation_leak.cc?rev=182999&view=auto
==============================================================================
--- compiler-rt/trunk/lib/lsan/lit_tests/large_allocation_leak.cc (original)
+++ compiler-rt/trunk/lib/lsan/lit_tests/large_allocation_leak.cc (removed)
@@ -1,18 +0,0 @@
-// Test that LargeMmapAllocator's chunks aren't reachable via some internal data structure.
-// RUN: LSAN_BASE="report_blocks=1:use_stacks=0:use_registers=0"
-// RUN: %clangxx_lsan %s -o %t
-// RUN: LSAN_OPTIONS=$LSAN_BASE %t 2>&1 | FileCheck %s
-
-#include <stdio.h>
-#include <stdlib.h>
-
-int main() {
- // maxsize in primary allocator is always less than this (1 << 25).
- void *large_alloc = malloc(33554432);
- fprintf(stderr, "Test alloc: %p.\n", large_alloc);
- return 0;
-}
-// CHECK: Test alloc: [[ADDR:.*]].
-// CHECK: LeakSanitizer: detected memory leaks
-// CHECK: Directly leaked 33554432 byte block at [[ADDR]]
-// CHECK: SUMMARY: LeakSanitizer:
Removed: compiler-rt/trunk/lib/lsan/lit_tests/lit.cfg
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/lsan/lit_tests/lit.cfg?rev=182999&view=auto
==============================================================================
--- compiler-rt/trunk/lib/lsan/lit_tests/lit.cfg (original)
+++ compiler-rt/trunk/lib/lsan/lit_tests/lit.cfg (removed)
@@ -1,50 +0,0 @@
-# -*- Python -*-
-
-import os
-
-def get_required_attr(config, attr_name):
- attr_value = getattr(config, attr_name, None)
- if not attr_value:
- lit.fatal("No attribute %r in test configuration! You may need to run "
- "tests from your build directory or add this attribute "
- "to lit.site.cfg " % attr_name)
- return attr_value
-
-# Setup attributes common for all compiler-rt projects.
-compiler_rt_src_root = get_required_attr(config, 'compiler_rt_src_root')
-compiler_rt_lit_unit_cfg = os.path.join(compiler_rt_src_root, "lib",
- "lit.common.unit.cfg")
-lit.load_config(config, compiler_rt_lit_unit_cfg)
-
-# Setup config name.
-config.name = 'LeakSanitizer'
-
-# Setup source root.
-config.test_source_root = os.path.dirname(__file__)
-
-# Setup attributes common for all compiler-rt projects.
-compiler_rt_lit_cfg = os.path.join(compiler_rt_src_root, "lib",
- "lit.common.cfg")
-if (not compiler_rt_lit_cfg) or (not os.path.exists(compiler_rt_lit_cfg)):
- lit.fatal("Can't find common compiler-rt lit config at: %r"
- % compiler_rt_lit_cfg)
-lit.load_config(config, compiler_rt_lit_cfg)
-
-clang_cxxflags = ("-ccc-cxx "
- + "-g "
- + "-O0 "
- + "-m64 ")
-
-clang_lsan_cxxflags = clang_cxxflags + "-fsanitize=leak "
-
-config.substitutions.append( ("%clangxx ", (" " + config.clang + " " +
- clang_cxxflags + " ")) )
-config.substitutions.append( ("%clangxx_lsan ", (" " + config.clang + " " +
- clang_lsan_cxxflags + " ")) )
-
-# Default test suffixes.
-config.suffixes = ['.c', '.cc', '.cpp']
-
-# LeakSanitizer tests are currently supported on x86-64 Linux only.
-if config.host_os not in ['Linux'] or config.host_arch not in ['x86_64']:
- config.unsupported = True
Copied: compiler-rt/trunk/lib/lsan/lit_tests/lit.common.cfg (from r182999, compiler-rt/trunk/lib/lsan/lit_tests/lit.cfg)
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/lsan/lit_tests/lit.common.cfg?p2=compiler-rt/trunk/lib/lsan/lit_tests/lit.common.cfg&p1=compiler-rt/trunk/lib/lsan/lit_tests/lit.cfg&r1=182999&r2=183000&rev=183000&view=diff
==============================================================================
--- compiler-rt/trunk/lib/lsan/lit_tests/lit.cfg (original)
+++ compiler-rt/trunk/lib/lsan/lit_tests/lit.common.cfg Fri May 31 08:13:55 2013
@@ -1,5 +1,7 @@
# -*- Python -*-
+# Common configuration for running leak detection tests under LSan/ASan.
+
import os
def get_required_attr(config, attr_name):
@@ -10,21 +12,13 @@ def get_required_attr(config, attr_name)
"to lit.site.cfg " % attr_name)
return attr_value
-# Setup attributes common for all compiler-rt projects.
-compiler_rt_src_root = get_required_attr(config, 'compiler_rt_src_root')
-compiler_rt_lit_unit_cfg = os.path.join(compiler_rt_src_root, "lib",
- "lit.common.unit.cfg")
-lit.load_config(config, compiler_rt_lit_unit_cfg)
-
-# Setup config name.
-config.name = 'LeakSanitizer'
-
# Setup source root.
-config.test_source_root = os.path.dirname(__file__)
+lsan_lit_src_root = get_required_attr(config, 'lsan_lit_src_root')
+config.test_source_root = os.path.join(lsan_lit_src_root, 'TestCases')
# Setup attributes common for all compiler-rt projects.
-compiler_rt_lit_cfg = os.path.join(compiler_rt_src_root, "lib",
- "lit.common.cfg")
+compiler_rt_src_root = get_required_attr(config, 'compiler_rt_src_root')
+compiler_rt_lit_cfg = os.path.join(compiler_rt_src_root, "lib", "lit.common.cfg")
if (not compiler_rt_lit_cfg) or (not os.path.exists(compiler_rt_lit_cfg)):
lit.fatal("Can't find common compiler-rt lit config at: %r"
% compiler_rt_lit_cfg)
@@ -35,16 +29,13 @@ clang_cxxflags = ("-ccc-cxx "
+ "-O0 "
+ "-m64 ")
-clang_lsan_cxxflags = clang_cxxflags + "-fsanitize=leak "
+config.clang_cxxflags = clang_cxxflags
config.substitutions.append( ("%clangxx ", (" " + config.clang + " " +
clang_cxxflags + " ")) )
-config.substitutions.append( ("%clangxx_lsan ", (" " + config.clang + " " +
- clang_lsan_cxxflags + " ")) )
-
-# Default test suffixes.
-config.suffixes = ['.c', '.cc', '.cpp']
# LeakSanitizer tests are currently supported on x86-64 Linux only.
if config.host_os not in ['Linux'] or config.host_arch not in ['x86_64']:
config.unsupported = True
+
+config.suffixes = ['.c', '.cc', '.cpp']
Removed: compiler-rt/trunk/lib/lsan/lit_tests/lit.site.cfg.in
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/lsan/lit_tests/lit.site.cfg.in?rev=182999&view=auto
==============================================================================
--- compiler-rt/trunk/lib/lsan/lit_tests/lit.site.cfg.in (original)
+++ compiler-rt/trunk/lib/lsan/lit_tests/lit.site.cfg.in (removed)
@@ -1,20 +0,0 @@
-config.host_os = "@HOST_OS@"
-config.host_arch = "@HOST_ARCH@"
-config.llvm_build_mode = "@LLVM_BUILD_MODE@"
-config.llvm_src_root = "@LLVM_SOURCE_DIR@"
-config.compiler_rt_src_root = "@COMPILER_RT_SOURCE_DIR@"
-config.llvm_obj_root = "@LLVM_BINARY_DIR@"
-config.llvm_tools_dir = "@LLVM_TOOLS_DIR@"
-config.clang = "@LLVM_BINARY_DIR@/bin/clang"
-config.compiler_rt_arch = "@COMPILER_RT_SUPPORTED_ARCH@"
-
-# LLVM tools dir can be passed in lit parameters, so try to
-# apply substitution.
-try:
- config.llvm_tools_dir = config.llvm_tools_dir % lit.params
-except KeyError,e:
- key, = e.args
- lit.fatal("unable to find %r parameter, use '--param=%s=VALUE'" % (key, key))
-
-# Let the main config do the real work.
-lit.load_config(config, "@CMAKE_CURRENT_SOURCE_DIR@/lit.cfg")
Removed: compiler-rt/trunk/lib/lsan/lit_tests/stale_stack_leak.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/lsan/lit_tests/stale_stack_leak.cc?rev=182999&view=auto
==============================================================================
--- compiler-rt/trunk/lib/lsan/lit_tests/stale_stack_leak.cc (original)
+++ compiler-rt/trunk/lib/lsan/lit_tests/stale_stack_leak.cc (removed)
@@ -1,42 +0,0 @@
-// Test that out-of-scope local variables are ignored by LSan.
-// RUN: LSAN_BASE="report_blocks=1:use_registers=0:use_stacks=1"
-// RUN: %clangxx_lsan %s -o %t
-// RUN: LSAN_OPTIONS=$LSAN_BASE %t 2>&1 | FileCheck %s
-// RUN: LSAN_OPTIONS=$LSAN_BASE":exitcode=0" %t 2>&1 | FileCheck --check-prefix=CHECK-sanity %s
-
-#include <stdio.h>
-#include <stdlib.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];
- fprintf(stderr, "Test alloc: %p.\n", 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))
-void ConfirmPointerHasSurvived() {
- fprintf(stderr, "Value after LSan: %p.\n", *pp);
-}
-// CHECK: Test alloc: [[ADDR:.*]].
-// CHECK-sanity: Test alloc: [[ADDR:.*]].
-// CHECK: LeakSanitizer: detected memory leaks
-// CHECK: Directly leaked 1337 byte block at [[ADDR]]
-// CHECK: SUMMARY: LeakSanitizer:
-// CHECK-sanity: Value after LSan: [[ADDR]].
Removed: compiler-rt/trunk/lib/lsan/lit_tests/use_globals_initialized.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/lsan/lit_tests/use_globals_initialized.cc?rev=182999&view=auto
==============================================================================
--- compiler-rt/trunk/lib/lsan/lit_tests/use_globals_initialized.cc (original)
+++ compiler-rt/trunk/lib/lsan/lit_tests/use_globals_initialized.cc (removed)
@@ -1,21 +0,0 @@
-// Test that initialized globals are included in the root set.
-// RUN: LSAN_BASE="report_blocks=1:use_stacks=0:use_registers=0"
-// RUN: %clangxx_lsan %s -o %t
-// RUN: LSAN_OPTIONS=$LSAN_BASE:"use_globals=0" %t 2>&1 | FileCheck %s
-// RUN: LSAN_OPTIONS=$LSAN_BASE:"use_globals=1" %t 2>&1
-// RUN: LSAN_OPTIONS="" %t 2>&1
-
-#include <stdio.h>
-#include <stdlib.h>
-
-void *data_var = (void *)1;
-
-int main() {
- data_var = malloc(1337);
- fprintf(stderr, "Test alloc: %p.\n", data_var);
- return 0;
-}
-// CHECK: Test alloc: [[ADDR:.*]].
-// CHECK: LeakSanitizer: detected memory leaks
-// CHECK: Directly leaked 1337 byte block at [[ADDR]]
-// CHECK: SUMMARY: LeakSanitizer:
Removed: compiler-rt/trunk/lib/lsan/lit_tests/use_globals_uninitialized.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/lsan/lit_tests/use_globals_uninitialized.cc?rev=182999&view=auto
==============================================================================
--- compiler-rt/trunk/lib/lsan/lit_tests/use_globals_uninitialized.cc (original)
+++ compiler-rt/trunk/lib/lsan/lit_tests/use_globals_uninitialized.cc (removed)
@@ -1,21 +0,0 @@
-// Test that uninitialized globals are included in the root set.
-// RUN: LSAN_BASE="report_blocks=1:use_stacks=0:use_registers=0"
-// RUN: %clangxx_lsan %s -o %t
-// RUN: LSAN_OPTIONS=$LSAN_BASE:"use_globals=0" %t 2>&1 | FileCheck %s
-// RUN: LSAN_OPTIONS=$LSAN_BASE:"use_globals=1" %t 2>&1
-// RUN: LSAN_OPTIONS="" %t 2>&1
-
-#include <stdio.h>
-#include <stdlib.h>
-
-void *bss_var;
-
-int main() {
- bss_var = malloc(1337);
- fprintf(stderr, "Test alloc: %p.\n", bss_var);
- return 0;
-}
-// CHECK: Test alloc: [[ADDR:.*]].
-// CHECK: LeakSanitizer: detected memory leaks
-// CHECK: Directly leaked 1337 byte block at [[ADDR]]
-// CHECK: SUMMARY: LeakSanitizer:
Removed: compiler-rt/trunk/lib/lsan/lit_tests/use_registers.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/lsan/lit_tests/use_registers.cc?rev=182999&view=auto
==============================================================================
--- compiler-rt/trunk/lib/lsan/lit_tests/use_registers.cc (original)
+++ compiler-rt/trunk/lib/lsan/lit_tests/use_registers.cc (removed)
@@ -1,51 +0,0 @@
-// Test that registers of running threads are included in the root set.
-// RUN: LSAN_BASE="report_blocks=1:use_stacks=0"
-// RUN: %clangxx_lsan -pthread %s -o %t
-// RUN: LSAN_OPTIONS=$LSAN_BASE:"use_registers=0" %t 2>&1 | FileCheck %s
-// RUN: LSAN_OPTIONS=$LSAN_BASE:"use_registers=1" %t 2>&1
-// RUN: LSAN_OPTIONS="" %t 2>&1
-
-#include <assert.h>
-#include <pthread.h>
-#include <stdio.h>
-#include <stdlib.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)
- );
-#else
-#error "Test is not supported on this architecture."
-#endif
- fprintf(stderr, "Test alloc: %p.\n", p);
- fflush(stderr);
- __sync_fetch_and_xor(sync, 1);
- while (true)
- pthread_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))
- pthread_yield();
- return 0;
-}
-// CHECK: Test alloc: [[ADDR:.*]].
-// CHECK: LeakSanitizer: detected memory leaks
-// CHECK: Directly leaked 1337 byte block at [[ADDR]]
-// CHECK: SUMMARY: LeakSanitizer:
Removed: compiler-rt/trunk/lib/lsan/lit_tests/use_stacks.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/lsan/lit_tests/use_stacks.cc?rev=182999&view=auto
==============================================================================
--- compiler-rt/trunk/lib/lsan/lit_tests/use_stacks.cc (original)
+++ compiler-rt/trunk/lib/lsan/lit_tests/use_stacks.cc (removed)
@@ -1,20 +0,0 @@
-// Test that stack of main thread is included in the root set.
-// RUN: LSAN_BASE="report_blocks=1:use_registers=0"
-// RUN: %clangxx_lsan %s -o %t
-// RUN: LSAN_OPTIONS=$LSAN_BASE:"use_stacks=0" %t 2>&1 | FileCheck %s
-// RUN: LSAN_OPTIONS=$LSAN_BASE:"use_stacks=1" %t 2>&1
-// RUN: LSAN_OPTIONS="" %t 2>&1
-
-#include <stdio.h>
-#include <stdlib.h>
-
-int main() {
- void *stack_var = malloc(1337);
- fprintf(stderr, "Test alloc: %p.\n", stack_var);
- // Do not return from main to prevent the pointer from going out of scope.
- exit(0);
-}
-// CHECK: Test alloc: [[ADDR:.*]].
-// CHECK: LeakSanitizer: detected memory leaks
-// CHECK: Directly leaked 1337 byte block at [[ADDR]]
-// CHECK: SUMMARY: LeakSanitizer:
Removed: compiler-rt/trunk/lib/lsan/lit_tests/use_stacks_threaded.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/lsan/lit_tests/use_stacks_threaded.cc?rev=182999&view=auto
==============================================================================
--- compiler-rt/trunk/lib/lsan/lit_tests/use_stacks_threaded.cc (original)
+++ compiler-rt/trunk/lib/lsan/lit_tests/use_stacks_threaded.cc (removed)
@@ -1,36 +0,0 @@
-// Test that stacks of non-main threads are included in the root set.
-// RUN: LSAN_BASE="report_blocks=1:use_registers=0"
-// RUN: %clangxx_lsan -pthread %s -o %t
-// RUN: LSAN_OPTIONS=$LSAN_BASE:"use_stacks=0" %t 2>&1 | FileCheck %s
-// RUN: LSAN_OPTIONS=$LSAN_BASE:"use_stacks=1" %t 2>&1
-// RUN: LSAN_OPTIONS="" %t 2>&1
-
-#include <assert.h>
-#include <pthread.h>
-#include <stdio.h>
-#include <stdlib.h>
-
-extern "C"
-void *stacks_thread_func(void *arg) {
- int *sync = reinterpret_cast<int *>(arg);
- void *p = malloc(1337);
- fprintf(stderr, "Test alloc: %p.\n", p);
- fflush(stderr);
- __sync_fetch_and_xor(sync, 1);
- while (true)
- pthread_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))
- pthread_yield();
- return 0;
-}
-// CHECK: Test alloc: [[ADDR:.*]].
-// CHECK: LeakSanitizer: detected memory leaks
-// CHECK: Directly leaked 1337 byte block at [[ADDR]]
-// CHECK: SUMMARY: LeakSanitizer:
Removed: compiler-rt/trunk/lib/lsan/lit_tests/use_tls_dynamic.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/lsan/lit_tests/use_tls_dynamic.cc?rev=182999&view=auto
==============================================================================
--- compiler-rt/trunk/lib/lsan/lit_tests/use_tls_dynamic.cc (original)
+++ compiler-rt/trunk/lib/lsan/lit_tests/use_tls_dynamic.cc (removed)
@@ -1,33 +0,0 @@
-// Test that dynamically allocated TLS space is included in the root set.
-// RUN: LSAN_BASE="report_blocks=1:use_stacks=0:use_registers=0"
-// RUN: %clangxx %p/SharedLibs/huge_tls_lib_so.cc -fPIC -shared -o %t-so.so
-// RUN: %clangxx_lsan %s -o %t
-// RUN: LSAN_OPTIONS=$LSAN_BASE:"use_tls=0" %t 2>&1 | FileCheck %s
-// RUN: LSAN_OPTIONS=$LSAN_BASE:"use_tls=1" %t 2>&1
-// RUN: LSAN_OPTIONS="" %t 2>&1
-
-#include <assert.h>
-#include <dlfcn.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string>
-
-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);
- void **p_in_tls = StoreToTLS(p);
- assert(*p_in_tls == p);
- fprintf(stderr, "Test alloc: %p.\n", p);
- return 0;
-}
-// CHECK: Test alloc: [[ADDR:.*]].
-// CHECK: LeakSanitizer: detected memory leaks
-// CHECK: leaked 1337 byte block at [[ADDR]]
-// CHECK: SUMMARY: LeakSanitizer:
Removed: compiler-rt/trunk/lib/lsan/lit_tests/use_tls_pthread_specific_dynamic.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/lsan/lit_tests/use_tls_pthread_specific_dynamic.cc?rev=182999&view=auto
==============================================================================
--- compiler-rt/trunk/lib/lsan/lit_tests/use_tls_pthread_specific_dynamic.cc (original)
+++ compiler-rt/trunk/lib/lsan/lit_tests/use_tls_pthread_specific_dynamic.cc (removed)
@@ -1,37 +0,0 @@
-// Test that dynamically allocated thread-specific storage is included in the root set.
-// RUN: LSAN_BASE="report_blocks=1:use_stacks=0:use_registers=0"
-// RUN: %clangxx_lsan %s -o %t
-// RUN: LSAN_OPTIONS=$LSAN_BASE:"use_tls=0" %t 2>&1 | FileCheck %s
-// RUN: LSAN_OPTIONS=$LSAN_BASE:"use_tls=1" %t 2>&1
-// RUN: LSAN_OPTIONS="" %t 2>&1
-
-#include <assert.h>
-#include <pthread.h>
-#include <stdio.h>
-#include <stdlib.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);
- fprintf(stderr, "Test alloc: %p.\n", p);
- return 0;
-}
-// CHECK: Test alloc: [[ADDR:.*]].
-// CHECK: LeakSanitizer: detected memory leaks
-// CHECK: leaked 1337 byte block at [[ADDR]]
-// CHECK: SUMMARY: LeakSanitizer:
Removed: compiler-rt/trunk/lib/lsan/lit_tests/use_tls_pthread_specific_static.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/lsan/lit_tests/use_tls_pthread_specific_static.cc?rev=182999&view=auto
==============================================================================
--- compiler-rt/trunk/lib/lsan/lit_tests/use_tls_pthread_specific_static.cc (original)
+++ compiler-rt/trunk/lib/lsan/lit_tests/use_tls_pthread_specific_static.cc (removed)
@@ -1,31 +0,0 @@
-// Test that statically allocated thread-specific storage is included in the root set.
-// RUN: LSAN_BASE="report_blocks=1:use_stacks=0:use_registers=0"
-// RUN: %clangxx_lsan %s -o %t
-// RUN: LSAN_OPTIONS=$LSAN_BASE:"use_tls=0" %t 2>&1 | FileCheck %s
-// RUN: LSAN_OPTIONS=$LSAN_BASE:"use_tls=1" %t 2>&1
-// RUN: LSAN_OPTIONS="" %t 2>&1
-
-#include <assert.h>
-#include <pthread.h>
-#include <stdio.h>
-#include <stdlib.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);
- fprintf(stderr, "Test alloc: %p.\n", p);
- return 0;
-}
-// CHECK: Test alloc: [[ADDR:.*]].
-// CHECK: LeakSanitizer: detected memory leaks
-// CHECK: Directly leaked 1337 byte block at [[ADDR]]
-// CHECK: SUMMARY: LeakSanitizer:
Removed: compiler-rt/trunk/lib/lsan/lit_tests/use_tls_static.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/lsan/lit_tests/use_tls_static.cc?rev=182999&view=auto
==============================================================================
--- compiler-rt/trunk/lib/lsan/lit_tests/use_tls_static.cc (original)
+++ compiler-rt/trunk/lib/lsan/lit_tests/use_tls_static.cc (removed)
@@ -1,21 +0,0 @@
-// Test that statically allocated TLS space is included in the root set.
-// RUN: LSAN_BASE="report_blocks=1:use_stacks=0:use_registers=0"
-// RUN: %clangxx_lsan %s -o %t
-// RUN: LSAN_OPTIONS=$LSAN_BASE:"use_tls=0" %t 2>&1 | FileCheck %s
-// RUN: LSAN_OPTIONS=$LSAN_BASE:"use_tls=1" %t 2>&1
-// RUN: LSAN_OPTIONS="" %t 2>&1
-
-#include <stdio.h>
-#include <stdlib.h>
-
-__thread void *tls_var;
-
-int main() {
- tls_var = malloc(1337);
- fprintf(stderr, "Test alloc: %p.\n", tls_var);
- return 0;
-}
-// CHECK: Test alloc: [[ADDR:.*]].
-// CHECK: LeakSanitizer: detected memory leaks
-// CHECK: Directly leaked 1337 byte block at [[ADDR]]
-// CHECK: SUMMARY: LeakSanitizer:
Removed: compiler-rt/trunk/lib/lsan/lit_tests/use_unaligned.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/lsan/lit_tests/use_unaligned.cc?rev=182999&view=auto
==============================================================================
--- compiler-rt/trunk/lib/lsan/lit_tests/use_unaligned.cc (original)
+++ compiler-rt/trunk/lib/lsan/lit_tests/use_unaligned.cc (removed)
@@ -1,23 +0,0 @@
-// Test that unaligned pointers are detected correctly.
-// RUN: LSAN_BASE="report_blocks=1:use_stacks=0:use_registers=0"
-// RUN: %clangxx_lsan %s -o %t
-// RUN: LSAN_OPTIONS=$LSAN_BASE:"use_unaligned=0" %t 2>&1 | FileCheck %s
-// RUN: LSAN_OPTIONS=$LSAN_BASE:"use_unaligned=1" %t 2>&1
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-void *arr[2];
-
-int main() {
- void *p = malloc(1337);
- fprintf(stderr, "Test alloc: %p.\n", p);
- char *char_arr = (char *)arr;
- memcpy(char_arr + 1, &p, sizeof(p));
- return 0;
-}
-// CHECK: Test alloc: [[ADDR:.*]].
-// CHECK: LeakSanitizer: detected memory leaks
-// CHECK: Directly leaked 1337 byte block at [[ADDR]]
-// CHECK: SUMMARY: LeakSanitizer:
More information about the llvm-commits
mailing list