From 0160570a0f4f460cf5df5afd1123785aae416fde Mon Sep 17 00:00:00 2001 From: Jay Foad <jay.foad@gmail.com> Date: Tue, 25 Nov 2014 07:56:04 +0000 Subject: [PATCH] [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 --- compiler-rt/test/asan/TestCases/Linux/coverage-and-lsan.cc | 2 +- compiler-rt/test/asan/TestCases/Linux/leak.cc | 2 +- compiler-rt/test/asan/Unit/lit.site.cfg.in | 4 ---- compiler-rt/test/asan/lit.cfg | 4 ++-- compiler-rt/test/lsan/lit.common.cfg | 1 - 5 files changed, 4 insertions(+), 9 deletions(-) diff --git a/compiler-rt/test/asan/TestCases/Linux/coverage-and-lsan.cc b/compiler-rt/test/asan/TestCases/Linux/coverage-and-lsan.cc index f0d371f1593b..4cb8e2af3084 100644 --- a/compiler-rt/test/asan/TestCases/Linux/coverage-and-lsan.cc +++ b/compiler-rt/test/asan/TestCases/Linux/coverage-and-lsan.cc @@ -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) { diff --git a/compiler-rt/test/asan/TestCases/Linux/leak.cc b/compiler-rt/test/asan/TestCases/Linux/leak.cc index df7850fa3cf2..36dc6ddb8adf 100644 --- a/compiler-rt/test/asan/TestCases/Linux/leak.cc +++ b/compiler-rt/test/asan/TestCases/Linux/leak.cc @@ -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 diff --git a/compiler-rt/test/asan/Unit/lit.site.cfg.in b/compiler-rt/test/asan/Unit/lit.site.cfg.in index 46eea1ff9a68..1791b6b05b1c 100644 --- a/compiler-rt/test/asan/Unit/lit.site.cfg.in +++ b/compiler-rt/test/asan/Unit/lit.site.cfg.in @@ -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' diff --git a/compiler-rt/test/asan/lit.cfg b/compiler-rt/test/asan/lit.cfg index 2acc54293483..ffe353de7347 100644 --- a/compiler-rt/test/asan/lit.cfg +++ b/compiler-rt/test/asan/lit.cfg @@ -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) diff --git a/compiler-rt/test/lsan/lit.common.cfg b/compiler-rt/test/lsan/lit.common.cfg index e11c90a6f9fe..bd1aa2769c42 100644 --- a/compiler-rt/test/lsan/lit.common.cfg +++ b/compiler-rt/test/lsan/lit.common.cfg @@ -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)