[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

llvm-svn: 222738
This commit is contained in:
Jay Foad 2014-11-25 07:56:04 +00:00
parent e335fd343e
commit 0160570a0f
5 changed files with 4 additions and 9 deletions

View File

@ -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) {

View File

@ -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

View File

@ -22,7 +22,3 @@ config.test_source_root = config.test_exec_root
# 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'

View File

@ -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)

View File

@ -25,7 +25,6 @@ elif lsan_lit_test_mode == "AddressSanitizer":
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)