Jay Foad 0160570a0f [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
2014-11-25 07:56:04 +00:00

17 lines
470 B
C++

// Minimal test for LeakSanitizer+AddressSanitizer.
// REQUIRES: leak-detection
//
// RUN: %clangxx_asan %s -o %t
// RUN: ASAN_OPTIONS=detect_leaks=1 not %run %t 2>&1 | FileCheck %s
// RUN: ASAN_OPTIONS="" not %run %t 2>&1 | FileCheck %s
// RUN: ASAN_OPTIONS=detect_leaks=0 %run %t
#include <stdio.h>
int *t;
int main(int argc, char **argv) {
t = new int[argc - 1];
printf("t: %p\n", t);
t = 0;
}
// CHECK: LeakSanitizer: detected memory leaks