[compiler-rt] r222738 - [ASan] Fix leak tests on 64-bit targets other than x86-64 (take two)

Jay Foad jay.foad at gmail.com
Mon Nov 24 23:56:04 PST 2014


Author: foad
Date: Tue Nov 25 01:56:04 2014
New Revision: 222738

URL: http://llvm.org/viewvc/llvm-project?rev=222738&view=rev
Log:
[ASan] Fix leak tests on 64-bit targets other than x86-64 (take two)

Summary:
First, remove lit configuration that sets ASAN_OPTIONS to detect_leaks=1
because this is already the default when leak detection is supported.
This removes a bit of duplication between various lit.cfg files.

Second, add a new feature 'leak-detection' if we're targetting x86_64
(not i386) on Linux.

Third, change a couple of tests that need leak detection to require the
new 'leak-detection' feature.

Reviewers: kcc, earthdok, samsonov

Reviewed By: samsonov

Subscribers: llvm-commits

Differential Revision: http://reviews.llvm.org/D6396

Modified:
    compiler-rt/trunk/test/asan/TestCases/Linux/coverage-and-lsan.cc
    compiler-rt/trunk/test/asan/TestCases/Linux/leak.cc
    compiler-rt/trunk/test/asan/Unit/lit.site.cfg.in
    compiler-rt/trunk/test/asan/lit.cfg
    compiler-rt/trunk/test/lsan/lit.common.cfg

Modified: compiler-rt/trunk/test/asan/TestCases/Linux/coverage-and-lsan.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/TestCases/Linux/coverage-and-lsan.cc?rev=222738&r1=222737&r2=222738&view=diff
==============================================================================
--- compiler-rt/trunk/test/asan/TestCases/Linux/coverage-and-lsan.cc (original)
+++ compiler-rt/trunk/test/asan/TestCases/Linux/coverage-and-lsan.cc Tue Nov 25 01:56:04 2014
@@ -8,7 +8,7 @@
 // RUN: ASAN_OPTIONS=coverage=1:coverage_dir=%T/coverage-and-lsan:verbosity=1 not %run %t 2>&1 | FileCheck %s
 // RUN: %sancov print %T/coverage-and-lsan/*.sancov 2>&1
 //
-// REQUIRES: asan-64-bits
+// REQUIRES: leak-detection
 
 int *g = new int;
 int main(int argc, char **argv) {

Modified: compiler-rt/trunk/test/asan/TestCases/Linux/leak.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/TestCases/Linux/leak.cc?rev=222738&r1=222737&r2=222738&view=diff
==============================================================================
--- compiler-rt/trunk/test/asan/TestCases/Linux/leak.cc (original)
+++ compiler-rt/trunk/test/asan/TestCases/Linux/leak.cc Tue Nov 25 01:56:04 2014
@@ -1,5 +1,5 @@
 // Minimal test for LeakSanitizer+AddressSanitizer.
-// REQUIRES: asan-64-bits
+// REQUIRES: leak-detection
 //
 // RUN: %clangxx_asan  %s -o %t
 // RUN: ASAN_OPTIONS=detect_leaks=1 not %run %t  2>&1 | FileCheck %s

Modified: compiler-rt/trunk/test/asan/Unit/lit.site.cfg.in
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/Unit/lit.site.cfg.in?rev=222738&r1=222737&r2=222738&view=diff
==============================================================================
--- compiler-rt/trunk/test/asan/Unit/lit.site.cfg.in (original)
+++ compiler-rt/trunk/test/asan/Unit/lit.site.cfg.in Tue Nov 25 01:56:04 2014
@@ -22,7 +22,3 @@ config.test_source_root = config.test_ex
 
 # Set LD_LIBRARY_PATH to pick dynamic runtime up properly.
 push_ld_library_path(config, config.compiler_rt_libdir)
-
-# Enable leak detection in ASan unit tests on x86_64-linux.
-if config.host_os == 'Linux' and config.host_arch == 'x86_64':
-  config.environment['ASAN_OPTIONS'] = 'detect_leaks=1'

Modified: compiler-rt/trunk/test/asan/lit.cfg
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/lit.cfg?rev=222738&r1=222737&r2=222738&view=diff
==============================================================================
--- compiler-rt/trunk/test/asan/lit.cfg (original)
+++ compiler-rt/trunk/test/asan/lit.cfg Tue Nov 25 01:56:04 2014
@@ -123,8 +123,8 @@ if config.target_arch != 'arm':
   config.available_features.add('stable-runtime')
 
 # Turn on leak detection on 64-bit Linux.
-if config.host_os == 'Linux' and config.bits == '64':
-  config.environment['ASAN_OPTIONS'] = 'detect_leaks=1'
+if config.host_os == 'Linux' and config.target_arch == 'x86_64':
+  config.available_features.add('leak-detection')
 
 # Set LD_LIBRARY_PATH to pick dynamic runtime up properly.
 push_ld_library_path(config, config.compiler_rt_libdir)

Modified: compiler-rt/trunk/test/lsan/lit.common.cfg
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/lsan/lit.common.cfg?rev=222738&r1=222737&r2=222738&view=diff
==============================================================================
--- compiler-rt/trunk/test/lsan/lit.common.cfg (original)
+++ compiler-rt/trunk/test/lsan/lit.common.cfg Tue Nov 25 01:56:04 2014
@@ -25,7 +25,6 @@ elif lsan_lit_test_mode == "AddressSanit
   config.name = "LeakSanitizer-AddressSanitizer"
   lsan_cflags = ["-fsanitize=address"]
   config.available_features.add('asan')
-  config.environment['ASAN_OPTIONS'] = 'detect_leaks=1'
 else:
   lit_config.fatal("Unknown LSan test mode: %r" % lsan_lit_test_mode)
 





More information about the llvm-commits mailing list