summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexey Samsonov <samsonov@google.com>2012-08-15 11:26:57 +0000
committerAlexey Samsonov <samsonov@google.com>2012-08-15 11:26:57 +0000
commit9fe914b0990fe51d3a83f3d96cccd221bdfc401e (patch)
tree3b3b27a61775b1cef258757da095a4cbc866e0ac
parent26b568d9d5561f5c71ee49c708e3776eb6e52778 (diff)
downloadbcm5719-llvm-9fe914b0990fe51d3a83f3d96cccd221bdfc401e.tar.gz
bcm5719-llvm-9fe914b0990fe51d3a83f3d96cccd221bdfc401e.zip
[ASan] Port (the last one) tricky interface_test to lit, and a *huge* chunks of boilerplate to run tests for 32/64 bits and all optimization levels. Alas, lit doesn't support for loops in RUN-lines...
llvm-svn: 161941
-rw-r--r--compiler-rt/lib/asan/lit_tests/Linux/clone_test.cc10
-rw-r--r--compiler-rt/lib/asan/lit_tests/Linux/interception_failure_test.cc10
-rw-r--r--compiler-rt/lib/asan/lit_tests/Linux/interception_malloc_test.cc10
-rw-r--r--compiler-rt/lib/asan/lit_tests/Linux/interception_test.cc10
-rw-r--r--compiler-rt/lib/asan/lit_tests/deep_tail_call.cc10
-rw-r--r--compiler-rt/lib/asan/lit_tests/dlclose-test.cc38
-rw-r--r--compiler-rt/lib/asan/lit_tests/global-overflow.cc12
-rw-r--r--compiler-rt/lib/asan/lit_tests/heap-overflow.cc26
-rw-r--r--compiler-rt/lib/asan/lit_tests/interface_symbols.c20
-rw-r--r--compiler-rt/lib/asan/lit_tests/large_func_test.cc28
-rw-r--r--compiler-rt/lib/asan/lit_tests/lit.cfg5
-rw-r--r--compiler-rt/lib/asan/lit_tests/memcmp_test.cc10
-rw-r--r--compiler-rt/lib/asan/lit_tests/null_deref.cc26
-rw-r--r--compiler-rt/lib/asan/lit_tests/shared-lib-test.cc41
-rw-r--r--compiler-rt/lib/asan/lit_tests/stack-overflow.cc12
-rw-r--r--compiler-rt/lib/asan/lit_tests/stack-use-after-return.cc12
-rw-r--r--compiler-rt/lib/asan/lit_tests/strncpy-overflow.cc26
-rw-r--r--compiler-rt/lib/asan/lit_tests/use-after-free.cc30
18 files changed, 244 insertions, 92 deletions
diff --git a/compiler-rt/lib/asan/lit_tests/Linux/clone_test.cc b/compiler-rt/lib/asan/lit_tests/Linux/clone_test.cc
index 6bc419381a3..429dbab093d 100644
--- a/compiler-rt/lib/asan/lit_tests/Linux/clone_test.cc
+++ b/compiler-rt/lib/asan/lit_tests/Linux/clone_test.cc
@@ -1,8 +1,14 @@
// Regression test for:
// http://code.google.com/p/address-sanitizer/issues/detail?id=37
-// RUN: %clangxx_asan -O2 %s -o %t
-// RUN: %t | FileCheck %s
+// RUN: %clangxx_asan -m64 -O0 %s -o %t && %t | FileCheck %s
+// RUN: %clangxx_asan -m64 -O1 %s -o %t && %t | FileCheck %s
+// RUN: %clangxx_asan -m64 -O2 %s -o %t && %t | FileCheck %s
+// RUN: %clangxx_asan -m64 -O3 %s -o %t && %t | FileCheck %s
+// RUN: %clangxx_asan -m32 -O0 %s -o %t && %t | FileCheck %s
+// RUN: %clangxx_asan -m32 -O1 %s -o %t && %t | FileCheck %s
+// RUN: %clangxx_asan -m32 -O2 %s -o %t && %t | FileCheck %s
+// RUN: %clangxx_asan -m32 -O3 %s -o %t && %t | FileCheck %s
#include <stdio.h>
#include <sched.h>
diff --git a/compiler-rt/lib/asan/lit_tests/Linux/interception_failure_test.cc b/compiler-rt/lib/asan/lit_tests/Linux/interception_failure_test.cc
index 56bb2e89116..dfad909f528 100644
--- a/compiler-rt/lib/asan/lit_tests/Linux/interception_failure_test.cc
+++ b/compiler-rt/lib/asan/lit_tests/Linux/interception_failure_test.cc
@@ -1,8 +1,14 @@
// If user provides his own libc functions, ASan doesn't
// intercept these functions.
-// RUN: %clangxx_asan -O2 %s -o %t
-// RUN: %t 2>&1 | FileCheck %s
+// RUN: %clangxx_asan -m64 -O0 %s -o %t && %t 2>&1 | FileCheck %s
+// RUN: %clangxx_asan -m64 -O1 %s -o %t && %t 2>&1 | FileCheck %s
+// RUN: %clangxx_asan -m64 -O2 %s -o %t && %t 2>&1 | FileCheck %s
+// RUN: %clangxx_asan -m64 -O3 %s -o %t && %t 2>&1 | FileCheck %s
+// RUN: %clangxx_asan -m32 -O0 %s -o %t && %t 2>&1 | FileCheck %s
+// RUN: %clangxx_asan -m32 -O1 %s -o %t && %t 2>&1 | FileCheck %s
+// RUN: %clangxx_asan -m32 -O2 %s -o %t && %t 2>&1 | FileCheck %s
+// RUN: %clangxx_asan -m32 -O3 %s -o %t && %t 2>&1 | FileCheck %s
#include <stdlib.h>
#include <stdio.h>
diff --git a/compiler-rt/lib/asan/lit_tests/Linux/interception_malloc_test.cc b/compiler-rt/lib/asan/lit_tests/Linux/interception_malloc_test.cc
index 6885c851306..8f66788e9a8 100644
--- a/compiler-rt/lib/asan/lit_tests/Linux/interception_malloc_test.cc
+++ b/compiler-rt/lib/asan/lit_tests/Linux/interception_malloc_test.cc
@@ -1,7 +1,13 @@
// ASan interceptor can be accessed with __interceptor_ prefix.
-// RUN: %clangxx_asan -O2 %s -o %t
-// RUN: %t 2>&1 | FileCheck %s
+// RUN: %clangxx_asan -m64 -O0 %s -o %t && %t 2>&1 | FileCheck %s
+// RUN: %clangxx_asan -m64 -O1 %s -o %t && %t 2>&1 | FileCheck %s
+// RUN: %clangxx_asan -m64 -O2 %s -o %t && %t 2>&1 | FileCheck %s
+// RUN: %clangxx_asan -m64 -O3 %s -o %t && %t 2>&1 | FileCheck %s
+// RUN: %clangxx_asan -m32 -O0 %s -o %t && %t 2>&1 | FileCheck %s
+// RUN: %clangxx_asan -m32 -O1 %s -o %t && %t 2>&1 | FileCheck %s
+// RUN: %clangxx_asan -m32 -O2 %s -o %t && %t 2>&1 | FileCheck %s
+// RUN: %clangxx_asan -m32 -O3 %s -o %t && %t 2>&1 | FileCheck %s
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
diff --git a/compiler-rt/lib/asan/lit_tests/Linux/interception_test.cc b/compiler-rt/lib/asan/lit_tests/Linux/interception_test.cc
index 8a876d88916..94fb499f2f8 100644
--- a/compiler-rt/lib/asan/lit_tests/Linux/interception_test.cc
+++ b/compiler-rt/lib/asan/lit_tests/Linux/interception_test.cc
@@ -1,7 +1,13 @@
// ASan interceptor can be accessed with __interceptor_ prefix.
-// RUN: %clangxx_asan -O2 %s -o %t
-// RUN: %t 2>&1 | FileCheck %s
+// RUN: %clangxx_asan -m64 -O0 %s -o %t && %t 2>&1 | FileCheck %s
+// RUN: %clangxx_asan -m64 -O1 %s -o %t && %t 2>&1 | FileCheck %s
+// RUN: %clangxx_asan -m64 -O2 %s -o %t && %t 2>&1 | FileCheck %s
+// RUN: %clangxx_asan -m64 -O3 %s -o %t && %t 2>&1 | FileCheck %s
+// RUN: %clangxx_asan -m32 -O0 %s -o %t && %t 2>&1 | FileCheck %s
+// RUN: %clangxx_asan -m32 -O1 %s -o %t && %t 2>&1 | FileCheck %s
+// RUN: %clangxx_asan -m32 -O2 %s -o %t && %t 2>&1 | FileCheck %s
+// RUN: %clangxx_asan -m32 -O3 %s -o %t && %t 2>&1 | FileCheck %s
#include <stdlib.h>
#include <stdio.h>
diff --git a/compiler-rt/lib/asan/lit_tests/deep_tail_call.cc b/compiler-rt/lib/asan/lit_tests/deep_tail_call.cc
index eb9cd0c3b1d..8f8a5d2781b 100644
--- a/compiler-rt/lib/asan/lit_tests/deep_tail_call.cc
+++ b/compiler-rt/lib/asan/lit_tests/deep_tail_call.cc
@@ -1,5 +1,11 @@
-// RUN: %clangxx_asan -m64 -O2 %s -o %t
-// RUN: %t 2>&1 | %symbolizer | FileCheck %s
+// RUN: %clangxx_asan -m64 -O0 %s -o %t && %t 2>&1 | %symbolize | FileCheck %s
+// RUN: %clangxx_asan -m64 -O1 %s -o %t && %t 2>&1 | %symbolize | FileCheck %s
+// RUN: %clangxx_asan -m64 -O2 %s -o %t && %t 2>&1 | %symbolize | FileCheck %s
+// RUN: %clangxx_asan -m64 -O3 %s -o %t && %t 2>&1 | %symbolize | FileCheck %s
+// RUN: %clangxx_asan -m32 -O0 %s -o %t && %t 2>&1 | %symbolize | FileCheck %s
+// RUN: %clangxx_asan -m32 -O1 %s -o %t && %t 2>&1 | %symbolize | FileCheck %s
+// RUN: %clangxx_asan -m32 -O2 %s -o %t && %t 2>&1 | %symbolize | FileCheck %s
+// RUN: %clangxx_asan -m32 -O3 %s -o %t && %t 2>&1 | %symbolize | FileCheck %s
// CHECK: AddressSanitizer global-buffer-overflow
int global[10];
diff --git a/compiler-rt/lib/asan/lit_tests/dlclose-test.cc b/compiler-rt/lib/asan/lit_tests/dlclose-test.cc
index ca1ef0c130f..229f508294b 100644
--- a/compiler-rt/lib/asan/lit_tests/dlclose-test.cc
+++ b/compiler-rt/lib/asan/lit_tests/dlclose-test.cc
@@ -1,14 +1,3 @@
-//===----------- dlclose-test.cc --------------------------------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file is a part of AddressSanitizer, an address sanity checker.
-//
// Regression test for
// http://code.google.com/p/address-sanitizer/issues/detail?id=19
// Bug description:
@@ -19,12 +8,31 @@
// 5. application starts using this mmaped memory, but asan still thinks there
// are globals.
// 6. BOOM
-//===----------------------------------------------------------------------===//
-// RUN: %clangxx_asan -O2 %p/SharedLibs/dlclose-test-so.cc \
+// RUN: %clangxx_asan -m64 -O0 %p/SharedLibs/dlclose-test-so.cc \
// RUN: -fPIC -shared -o %t-so.so
-// RUN: %clangxx_asan -O2 %s -o %t
-// RUN: %t | FileCheck %s
+// RUN: %clangxx_asan -m64 -O0 %s -o %t && %t 2>&1 | FileCheck %s
+// RUN: %clangxx_asan -m64 -O1 %p/SharedLibs/dlclose-test-so.cc \
+// RUN: -fPIC -shared -o %t-so.so
+// RUN: %clangxx_asan -m64 -O1 %s -o %t && %t 2>&1 | FileCheck %s
+// RUN: %clangxx_asan -m64 -O2 %p/SharedLibs/dlclose-test-so.cc \
+// RUN: -fPIC -shared -o %t-so.so
+// RUN: %clangxx_asan -m64 -O2 %s -o %t && %t 2>&1 | FileCheck %s
+// RUN: %clangxx_asan -m64 -O3 %p/SharedLibs/dlclose-test-so.cc \
+// RUN: -fPIC -shared -o %t-so.so
+// RUN: %clangxx_asan -m64 -O3 %s -o %t && %t 2>&1 | FileCheck %s
+// RUN: %clangxx_asan -m32 -O0 %p/SharedLibs/dlclose-test-so.cc \
+// RUN: -fPIC -shared -o %t-so.so
+// RUN: %clangxx_asan -m32 -O0 %s -o %t && %t 2>&1 | FileCheck %s
+// RUN: %clangxx_asan -m32 -O1 %p/SharedLibs/dlclose-test-so.cc \
+// RUN: -fPIC -shared -o %t-so.so
+// RUN: %clangxx_asan -m32 -O1 %s -o %t && %t 2>&1 | FileCheck %s
+// RUN: %clangxx_asan -m32 -O2 %p/SharedLibs/dlclose-test-so.cc \
+// RUN: -fPIC -shared -o %t-so.so
+// RUN: %clangxx_asan -m32 -O2 %s -o %t && %t 2>&1 | FileCheck %s
+// RUN: %clangxx_asan -m32 -O3 %p/SharedLibs/dlclose-test-so.cc \
+// RUN: -fPIC -shared -o %t-so.so
+// RUN: %clangxx_asan -m32 -O3 %s -o %t && %t 2>&1 | FileCheck %s
#include <assert.h>
#include <dlfcn.h>
diff --git a/compiler-rt/lib/asan/lit_tests/global-overflow.cc b/compiler-rt/lib/asan/lit_tests/global-overflow.cc
index 573da6c3987..9a0cd1d4338 100644
--- a/compiler-rt/lib/asan/lit_tests/global-overflow.cc
+++ b/compiler-rt/lib/asan/lit_tests/global-overflow.cc
@@ -1,5 +1,11 @@
-// RUN: %clangxx_asan -m64 -O2 %s -o %t
-// RUN: %t 2>&1 | %symbolizer | FileCheck %s
+// RUN: %clangxx_asan -m64 -O0 %s -o %t && %t 2>&1 | %symbolize | FileCheck %s
+// RUN: %clangxx_asan -m64 -O1 %s -o %t && %t 2>&1 | %symbolize | FileCheck %s
+// RUN: %clangxx_asan -m64 -O2 %s -o %t && %t 2>&1 | %symbolize | FileCheck %s
+// RUN: %clangxx_asan -m64 -O3 %s -o %t && %t 2>&1 | %symbolize | FileCheck %s
+// RUN: %clangxx_asan -m32 -O0 %s -o %t && %t 2>&1 | %symbolize | FileCheck %s
+// RUN: %clangxx_asan -m32 -O1 %s -o %t && %t 2>&1 | %symbolize | FileCheck %s
+// RUN: %clangxx_asan -m32 -O2 %s -o %t && %t 2>&1 | %symbolize | FileCheck %s
+// RUN: %clangxx_asan -m32 -O3 %s -o %t && %t 2>&1 | %symbolize | FileCheck %s
#include <string.h>
int main(int argc, char **argv) {
@@ -11,7 +17,7 @@ int main(int argc, char **argv) {
memset(ZZZ, 0, 10);
int res = YYY[argc * 10]; // BOOOM
// CHECK: {{READ of size 1 at 0x.* thread T0}}
- // CHECK: {{ #0 0x.* in main .*global-overflow.cc:12}}
+ // CHECK: {{ #0 0x.* in main .*global-overflow.cc:18}}
// CHECK: {{0x.* is located 0 bytes to the right of global variable}}
// CHECK: {{.*YYY.* of size 10}}
res += XXX[argc] + ZZZ[argc];
diff --git a/compiler-rt/lib/asan/lit_tests/heap-overflow.cc b/compiler-rt/lib/asan/lit_tests/heap-overflow.cc
index 043139aff53..345d0b994c5 100644
--- a/compiler-rt/lib/asan/lit_tests/heap-overflow.cc
+++ b/compiler-rt/lib/asan/lit_tests/heap-overflow.cc
@@ -1,7 +1,19 @@
-// RUN: %clangxx_asan -m64 -O2 %s -o %t
-// RUN: %t 2>&1 | %symbolizer > %t.output
-// RUN: FileCheck %s < %t.output
-// RUN: FileCheck %s --check-prefix=CHECK-%os < %t.output
+// RUN: %clangxx_asan -m64 -O0 %s -o %t && %t 2>&1 | %symbolize > %t.out
+// RUN: FileCheck %s < %t.out && FileCheck %s --check-prefix=CHECK-%os < %t.out
+// RUN: %clangxx_asan -m64 -O1 %s -o %t && %t 2>&1 | %symbolize > %t.out
+// RUN: FileCheck %s < %t.out && FileCheck %s --check-prefix=CHECK-%os < %t.out
+// RUN: %clangxx_asan -m64 -O2 %s -o %t && %t 2>&1 | %symbolize > %t.out
+// RUN: FileCheck %s < %t.out && FileCheck %s --check-prefix=CHECK-%os < %t.out
+// RUN: %clangxx_asan -m64 -O3 %s -o %t && %t 2>&1 | %symbolize > %t.out
+// RUN: FileCheck %s < %t.out && FileCheck %s --check-prefix=CHECK-%os < %t.out
+// RUN: %clangxx_asan -m32 -O0 %s -o %t && %t 2>&1 | %symbolize > %t.out
+// RUN: FileCheck %s < %t.out && FileCheck %s --check-prefix=CHECK-%os < %t.out
+// RUN: %clangxx_asan -m32 -O1 %s -o %t && %t 2>&1 | %symbolize > %t.out
+// RUN: FileCheck %s < %t.out && FileCheck %s --check-prefix=CHECK-%os < %t.out
+// RUN: %clangxx_asan -m32 -O2 %s -o %t && %t 2>&1 | %symbolize > %t.out
+// RUN: FileCheck %s < %t.out && FileCheck %s --check-prefix=CHECK-%os < %t.out
+// RUN: %clangxx_asan -m32 -O3 %s -o %t && %t 2>&1 | %symbolize > %t.out
+// RUN: FileCheck %s < %t.out && FileCheck %s --check-prefix=CHECK-%os < %t.out
#include <stdlib.h>
#include <string.h>
@@ -10,17 +22,17 @@ int main(int argc, char **argv) {
memset(x, 0, 10);
int res = x[argc * 10]; // BOOOM
// CHECK: {{READ of size 1 at 0x.* thread T0}}
- // CHECK: {{ #0 0x.* in main .*heap-overflow.cc:11}}
+ // CHECK: {{ #0 0x.* in main .*heap-overflow.cc:23}}
// CHECK: {{0x.* is located 0 bytes to the right of 10-byte region}}
// CHECK: {{allocated by thread T0 here:}}
// CHECK-Linux: {{ #0 0x.* in .*malloc}}
- // CHECK-Linux: {{ #1 0x.* in main .*heap-overflow.cc:9}}
+ // CHECK-Linux: {{ #1 0x.* in main .*heap-overflow.cc:21}}
// CHECK-Darwin: {{ #0 0x.* in .*mz_malloc.*}}
// CHECK-Darwin: {{ #1 0x.* in malloc_zone_malloc.*}}
// CHECK-Darwin: {{ #2 0x.* in malloc.*}}
- // CHECK-Darwin: {{ #3 0x.* in main heap-overflow.cc:9}}
+ // CHECK-Darwin: {{ #3 0x.* in main heap-overflow.cc:21}}
free(x);
return res;
}
diff --git a/compiler-rt/lib/asan/lit_tests/interface_symbols.c b/compiler-rt/lib/asan/lit_tests/interface_symbols.c
new file mode 100644
index 00000000000..410b87f1c76
--- /dev/null
+++ b/compiler-rt/lib/asan/lit_tests/interface_symbols.c
@@ -0,0 +1,20 @@
+// Check the presense of interface symbols in compiled file.
+
+// RUN: %clang -faddress-sanitizer -dead_strip -O2 %s -o %t.exe
+// RUN: llvm-nm %t.exe | egrep " [TW] " | sed "s/.* T //" | sed "s/.* W //" \
+// RUN: | grep "__asan_" | sed "s/___asan_/__asan_/" > %t.symbols
+// RUN: cat %p/../asan_interface.h | sed "s/\/\/.*//" | grep "__asan_.*(" \
+// RUN: | sed "s/.* __asan_/__asan_/;s/(.*//" > %t.interface
+// RUN: echo __asan_report_load1 >> %t.interface
+// RUN: echo __asan_report_load2 >> %t.interface
+// RUN: echo __asan_report_load4 >> %t.interface
+// RUN: echo __asan_report_load8 >> %t.interface
+// RUN: echo __asan_report_load16 >> %t.interface
+// RUN: echo __asan_report_store1 >> %t.interface
+// RUN: echo __asan_report_store2 >> %t.interface
+// RUN: echo __asan_report_store4 >> %t.interface
+// RUN: echo __asan_report_store8 >> %t.interface
+// RUN: echo __asan_report_store16 >> %t.interface
+// RUN: cat %t.interface | sort -u | diff %t.symbols -
+
+int main() { return 0; }
diff --git a/compiler-rt/lib/asan/lit_tests/large_func_test.cc b/compiler-rt/lib/asan/lit_tests/large_func_test.cc
index a353de1836d..a1119e90c47 100644
--- a/compiler-rt/lib/asan/lit_tests/large_func_test.cc
+++ b/compiler-rt/lib/asan/lit_tests/large_func_test.cc
@@ -1,7 +1,19 @@
-// RUN: %clangxx_asan -m64 -O2 %s -o %t
-// RUN: %t 2>&1 | %symbolizer | c++filt > %t.output
-// RUN: FileCheck %s < %t.output
-// RUN: FileCheck %s --check-prefix=CHECK-%os < %t.output
+// RUN: %clangxx_asan -m64 -O0 %s -o %t && %t 2>&1 | %symbolize > %t.out
+// RUN: FileCheck %s < %t.out && FileCheck %s --check-prefix=CHECK-%os < %t.out
+// RUN: %clangxx_asan -m64 -O1 %s -o %t && %t 2>&1 | %symbolize > %t.out
+// RUN: FileCheck %s < %t.out && FileCheck %s --check-prefix=CHECK-%os < %t.out
+// RUN: %clangxx_asan -m64 -O2 %s -o %t && %t 2>&1 | %symbolize > %t.out
+// RUN: FileCheck %s < %t.out && FileCheck %s --check-prefix=CHECK-%os < %t.out
+// RUN: %clangxx_asan -m64 -O3 %s -o %t && %t 2>&1 | %symbolize > %t.out
+// RUN: FileCheck %s < %t.out && FileCheck %s --check-prefix=CHECK-%os < %t.out
+// RUN: %clangxx_asan -m32 -O0 %s -o %t && %t 2>&1 | %symbolize > %t.out
+// RUN: FileCheck %s < %t.out && FileCheck %s --check-prefix=CHECK-%os < %t.out
+// RUN: %clangxx_asan -m32 -O1 %s -o %t && %t 2>&1 | %symbolize > %t.out
+// RUN: FileCheck %s < %t.out && FileCheck %s --check-prefix=CHECK-%os < %t.out
+// RUN: %clangxx_asan -m32 -O2 %s -o %t && %t 2>&1 | %symbolize > %t.out
+// RUN: FileCheck %s < %t.out && FileCheck %s --check-prefix=CHECK-%os < %t.out
+// RUN: %clangxx_asan -m32 -O3 %s -o %t && %t 2>&1 | %symbolize > %t.out
+// RUN: FileCheck %s < %t.out && FileCheck %s --check-prefix=CHECK-%os < %t.out
#include <stdlib.h>
__attribute__((noinline))
@@ -43,11 +55,11 @@ int main(int argc, char **argv) {
// atos incorrectly extracts the symbol name for the static functions on
// Darwin.
-// CHECK-Linux: {{ #0 0x.* in LargeFunction.*large_func_test.cc:20}}
-// CHECK-Darwin: {{ #0 0x.* in .*LargeFunction.*large_func_test.cc:20}}
+// CHECK-Linux: {{ #0 0x.* in LargeFunction.*large_func_test.cc:32}}
+// CHECK-Darwin: {{ #0 0x.* in .*LargeFunction.*large_func_test.cc:32}}
-// CHECK: {{ #1 0x.* in main .*large_func_test.cc:36}}
+// CHECK: {{ #1 0x.* in main .*large_func_test.cc:48}}
// CHECK: {{0x.* is located 44 bytes to the right of 400-byte region}}
// CHECK: {{allocated by thread T0 here:}}
// CHECK: {{ #0 0x.* in operator new.*}}
-// CHECK: {{ #1 0x.* in main .*large_func_test.cc:35}}
+// CHECK: {{ #1 0x.* in main .*large_func_test.cc:47}}
diff --git a/compiler-rt/lib/asan/lit_tests/lit.cfg b/compiler-rt/lib/asan/lit_tests/lit.cfg
index 8fadd91a617..e48fa0bc904 100644
--- a/compiler-rt/lib/asan/lit_tests/lit.cfg
+++ b/compiler-rt/lib/asan/lit_tests/lit.cfg
@@ -42,7 +42,10 @@ symbolizer = os.path.join(asan_source_dir,
'scripts', 'asan_symbolize.py')
if not os.path.exists(symbolizer):
lit.fatal("Can't find symbolizer script on path %r" % symbolizer)
-config.substitutions.append( ('%symbolizer', (" " + symbolizer + " " )))
+# Define %symbolize substitution that filters output through
+# symbolizer and c++filt (for demangling).
+config.substitutions.append( ("%symbolize ", (" " + symbolizer +
+ " | c++filt " )))
# Define CHECK-%os to check for OS-dependent output.
config.substitutions.append( ('CHECK-%os', ("CHECK-" + config.host_os)))
diff --git a/compiler-rt/lib/asan/lit_tests/memcmp_test.cc b/compiler-rt/lib/asan/lit_tests/memcmp_test.cc
index 64b831309bf..d839c201c92 100644
--- a/compiler-rt/lib/asan/lit_tests/memcmp_test.cc
+++ b/compiler-rt/lib/asan/lit_tests/memcmp_test.cc
@@ -1,5 +1,11 @@
-// RUN: %clangxx_asan -m64 -O2 %s -o %t
-// RUN: %t 2>&1 | %symbolizer | c++filt | FileCheck %s
+// RUN: %clangxx_asan -m64 -O0 %s -o %t && %t 2>&1 | %symbolize | FileCheck %s
+// RUN: %clangxx_asan -m64 -O1 %s -o %t && %t 2>&1 | %symbolize | FileCheck %s
+// RUN: %clangxx_asan -m64 -O2 %s -o %t && %t 2>&1 | %symbolize | FileCheck %s
+// RUN: %clangxx_asan -m64 -O3 %s -o %t && %t 2>&1 | %symbolize | FileCheck %s
+// RUN: %clangxx_asan -m32 -O0 %s -o %t && %t 2>&1 | %symbolize | FileCheck %s
+// RUN: %clangxx_asan -m32 -O1 %s -o %t && %t 2>&1 | %symbolize | FileCheck %s
+// RUN: %clangxx_asan -m32 -O2 %s -o %t && %t 2>&1 | %symbolize | FileCheck %s
+// RUN: %clangxx_asan -m32 -O3 %s -o %t && %t 2>&1 | %symbolize | FileCheck %s
#include <string.h>
int main(int argc, char **argv) {
diff --git a/compiler-rt/lib/asan/lit_tests/null_deref.cc b/compiler-rt/lib/asan/lit_tests/null_deref.cc
index 91366dc04f6..259e6ec62c0 100644
--- a/compiler-rt/lib/asan/lit_tests/null_deref.cc
+++ b/compiler-rt/lib/asan/lit_tests/null_deref.cc
@@ -1,7 +1,19 @@
-// RUN: %clangxx_asan -m64 -O2 %s -o %t
-// RUN: %t 2>&1 | %symbolizer | c++filt > %t.output
-// RUN: FileCheck %s < %t.output
-// RUN: FileCheck %s --check-prefix=CHECK-%os < %t.output
+// RUN: %clangxx_asan -m64 -O0 %s -o %t && %t 2>&1 | %symbolize > %t.out
+// RUN: FileCheck %s < %t.out && FileCheck %s --check-prefix=CHECK-%os < %t.out
+// RUN: %clangxx_asan -m64 -O1 %s -o %t && %t 2>&1 | %symbolize > %t.out
+// RUN: FileCheck %s < %t.out && FileCheck %s --check-prefix=CHECK-%os < %t.out
+// RUN: %clangxx_asan -m64 -O2 %s -o %t && %t 2>&1 | %symbolize > %t.out
+// RUN: FileCheck %s < %t.out && FileCheck %s --check-prefix=CHECK-%os < %t.out
+// RUN: %clangxx_asan -m64 -O3 %s -o %t && %t 2>&1 | %symbolize > %t.out
+// RUN: FileCheck %s < %t.out && FileCheck %s --check-prefix=CHECK-%os < %t.out
+// RUN: %clangxx_asan -m32 -O0 %s -o %t && %t 2>&1 | %symbolize > %t.out
+// RUN: FileCheck %s < %t.out && FileCheck %s --check-prefix=CHECK-%os < %t.out
+// RUN: %clangxx_asan -m32 -O1 %s -o %t && %t 2>&1 | %symbolize > %t.out
+// RUN: FileCheck %s < %t.out && FileCheck %s --check-prefix=CHECK-%os < %t.out
+// RUN: %clangxx_asan -m32 -O2 %s -o %t && %t 2>&1 | %symbolize > %t.out
+// RUN: FileCheck %s < %t.out && FileCheck %s --check-prefix=CHECK-%os < %t.out
+// RUN: %clangxx_asan -m32 -O3 %s -o %t && %t 2>&1 | %symbolize > %t.out
+// RUN: FileCheck %s < %t.out && FileCheck %s --check-prefix=CHECK-%os < %t.out
__attribute__((noinline))
static void NullDeref(int *ptr) {
@@ -16,7 +28,7 @@ int main() {
// CHECK: {{AddressSanitizer can not provide additional info.}}
// atos on Mac cannot extract the symbol name correctly.
-// CHECK-Linux: {{ #0 0x.* in NullDeref.*null_deref.cc:8}}
-// CHECK-Darwin: {{ #0 0x.* in .*NullDeref.*null_deref.cc:8}}
+// CHECK-Linux: {{ #0 0x.* in NullDeref.*null_deref.cc:20}}
+// CHECK-Darwin: {{ #0 0x.* in .*NullDeref.*null_deref.cc:20}}
-// CHECK: {{ #1 0x.* in main.*null_deref.cc:11}}
+// CHECK: {{ #1 0x.* in main.*null_deref.cc:23}}
diff --git a/compiler-rt/lib/asan/lit_tests/shared-lib-test.cc b/compiler-rt/lib/asan/lit_tests/shared-lib-test.cc
index 199076edb77..f77e1375e25 100644
--- a/compiler-rt/lib/asan/lit_tests/shared-lib-test.cc
+++ b/compiler-rt/lib/asan/lit_tests/shared-lib-test.cc
@@ -1,20 +1,27 @@
-//===----------- shared-lib-test.cc -----------------------------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file is a part of AddressSanitizer, an address sanity checker.
-//
-//===----------------------------------------------------------------------===//
-
-// RUN: %clangxx_asan -O2 %p/SharedLibs/shared-lib-test-so.cc \
+// RUN: %clangxx_asan -m64 -O0 %p/SharedLibs/shared-lib-test-so.cc \
+// RUN: -fPIC -shared -o %t-so.so
+// RUN: %clangxx_asan -m64 -O0 %s -o %t && %t 2>&1 | %symbolize | FileCheck %s
+// RUN: %clangxx_asan -m64 -O1 %p/SharedLibs/shared-lib-test-so.cc \
+// RUN: -fPIC -shared -o %t-so.so
+// RUN: %clangxx_asan -m64 -O1 %s -o %t && %t 2>&1 | %symbolize | FileCheck %s
+// RUN: %clangxx_asan -m64 -O2 %p/SharedLibs/shared-lib-test-so.cc \
+// RUN: -fPIC -shared -o %t-so.so
+// RUN: %clangxx_asan -m64 -O2 %s -o %t && %t 2>&1 | %symbolize | FileCheck %s
+// RUN: %clangxx_asan -m64 -O3 %p/SharedLibs/shared-lib-test-so.cc \
+// RUN: -fPIC -shared -o %t-so.so
+// RUN: %clangxx_asan -m64 -O3 %s -o %t && %t 2>&1 | %symbolize | FileCheck %s
+// RUN: %clangxx_asan -m32 -O0 %p/SharedLibs/shared-lib-test-so.cc \
+// RUN: -fPIC -shared -o %t-so.so
+// RUN: %clangxx_asan -m32 -O0 %s -o %t && %t 2>&1 | %symbolize | FileCheck %s
+// RUN: %clangxx_asan -m32 -O1 %p/SharedLibs/shared-lib-test-so.cc \
+// RUN: -fPIC -shared -o %t-so.so
+// RUN: %clangxx_asan -m32 -O1 %s -o %t && %t 2>&1 | %symbolize | FileCheck %s
+// RUN: %clangxx_asan -m32 -O2 %p/SharedLibs/shared-lib-test-so.cc \
+// RUN: -fPIC -shared -o %t-so.so
+// RUN: %clangxx_asan -m32 -O2 %s -o %t && %t 2>&1 | %symbolize | FileCheck %s
+// RUN: %clangxx_asan -m32 -O3 %p/SharedLibs/shared-lib-test-so.cc \
// RUN: -fPIC -shared -o %t-so.so
-// RUN: %clangxx_asan -O2 %s -o %t
-// RUN: %t 2>&1 | %symbolizer | FileCheck %s
+// RUN: %clangxx_asan -m32 -O3 %s -o %t && %t 2>&1 | %symbolize | FileCheck %s
#include <dlfcn.h>
#include <stdio.h>
@@ -42,6 +49,6 @@ int main(int argc, char *argv[]) {
// CHECK: {{.*ERROR: AddressSanitizer global-buffer-overflow}}
// CHECK: {{READ of size 4 at 0x.* thread T0}}
// CHECK: {{ #0 0x.*}}
- // CHECK: {{ #1 0x.* in main .*shared-lib-test.cc:41}}
+ // CHECK: {{ #1 0x.* in main .*shared-lib-test.cc:48}}
return 0;
}
diff --git a/compiler-rt/lib/asan/lit_tests/stack-overflow.cc b/compiler-rt/lib/asan/lit_tests/stack-overflow.cc
index 552a97a7c2b..2c64ec6635d 100644
--- a/compiler-rt/lib/asan/lit_tests/stack-overflow.cc
+++ b/compiler-rt/lib/asan/lit_tests/stack-overflow.cc
@@ -1,5 +1,11 @@
-// RUN: %clangxx_asan -m64 -O2 %s -o %t
-// RUN: %t 2>&1 | %symbolizer | FileCheck %s
+// RUN: %clangxx_asan -m64 -O0 %s -o %t && %t 2>&1 | %symbolize | FileCheck %s
+// RUN: %clangxx_asan -m64 -O1 %s -o %t && %t 2>&1 | %symbolize | FileCheck %s
+// RUN: %clangxx_asan -m64 -O2 %s -o %t && %t 2>&1 | %symbolize | FileCheck %s
+// RUN: %clangxx_asan -m64 -O3 %s -o %t && %t 2>&1 | %symbolize | FileCheck %s
+// RUN: %clangxx_asan -m32 -O0 %s -o %t && %t 2>&1 | %symbolize | FileCheck %s
+// RUN: %clangxx_asan -m32 -O1 %s -o %t && %t 2>&1 | %symbolize | FileCheck %s
+// RUN: %clangxx_asan -m32 -O2 %s -o %t && %t 2>&1 | %symbolize | FileCheck %s
+// RUN: %clangxx_asan -m32 -O3 %s -o %t && %t 2>&1 | %symbolize | FileCheck %s
#include <string.h>
int main(int argc, char **argv) {
@@ -7,7 +13,7 @@ int main(int argc, char **argv) {
memset(x, 0, 10);
int res = x[argc * 10]; // BOOOM
// CHECK: {{READ of size 1 at 0x.* thread T0}}
- // CHECK: {{ #0 0x.* in main .*stack-overflow.cc:8}}
+ // CHECK: {{ #0 0x.* in main .*stack-overflow.cc:14}}
// CHECK: {{Address 0x.* is .* frame <main>}}
return res;
}
diff --git a/compiler-rt/lib/asan/lit_tests/stack-use-after-return.cc b/compiler-rt/lib/asan/lit_tests/stack-use-after-return.cc
index 929e7605899..201efa603cd 100644
--- a/compiler-rt/lib/asan/lit_tests/stack-use-after-return.cc
+++ b/compiler-rt/lib/asan/lit_tests/stack-use-after-return.cc
@@ -1,6 +1,12 @@
// XFAIL: *
-// RUN: %clangxx_asan -m64 -O2 %s -o %t
-// RUN: %t 2>&1 | %symbolizer | c++filt | FileCheck %s
+// RUN: %clangxx_asan -m64 -O0 %s -o %t && %t 2>&1 | %symbolize | FileCheck %s
+// RUN: %clangxx_asan -m64 -O1 %s -o %t && %t 2>&1 | %symbolize | FileCheck %s
+// RUN: %clangxx_asan -m64 -O2 %s -o %t && %t 2>&1 | %symbolize | FileCheck %s
+// RUN: %clangxx_asan -m64 -O3 %s -o %t && %t 2>&1 | %symbolize | FileCheck %s
+// RUN: %clangxx_asan -m32 -O0 %s -o %t && %t 2>&1 | %symbolize | FileCheck %s
+// RUN: %clangxx_asan -m32 -O1 %s -o %t && %t 2>&1 | %symbolize | FileCheck %s
+// RUN: %clangxx_asan -m32 -O2 %s -o %t && %t 2>&1 | %symbolize | FileCheck %s
+// RUN: %clangxx_asan -m32 -O3 %s -o %t && %t 2>&1 | %symbolize | FileCheck %s
#include <stdio.h>
@@ -21,7 +27,7 @@ void Func2(char *x) {
fprintf(stderr, "2: %p\n", x);
*x = 1;
// CHECK: {{WRITE of size 1 .* thread T0}}
- // CHECK: {{ #0.*Func2.*stack-use-after-return.cc:18}}
+ // CHECK: {{ #0.*Func2.*stack-use-after-return.cc:28}}
// CHECK: {{is located in frame <.*Func1.*> of T0's stack}}
}
diff --git a/compiler-rt/lib/asan/lit_tests/strncpy-overflow.cc b/compiler-rt/lib/asan/lit_tests/strncpy-overflow.cc
index ce537a46d4b..a0dd8c1821d 100644
--- a/compiler-rt/lib/asan/lit_tests/strncpy-overflow.cc
+++ b/compiler-rt/lib/asan/lit_tests/strncpy-overflow.cc
@@ -1,7 +1,19 @@
-// RUN: %clangxx_asan -m64 -O2 %s -o %t
-// RUN: %t 2>&1 | %symbolizer | c++filt > %t.output
-// RUN: FileCheck %s < %t.output
-// RUN: FileCheck %s --check-prefix=CHECK-%os < %t.output
+// RUN: %clangxx_asan -m64 -O0 %s -o %t && %t 2>&1 | %symbolize > %t.out
+// RUN: FileCheck %s < %t.out && FileCheck %s --check-prefix=CHECK-%os < %t.out
+// RUN: %clangxx_asan -m64 -O1 %s -o %t && %t 2>&1 | %symbolize > %t.out
+// RUN: FileCheck %s < %t.out && FileCheck %s --check-prefix=CHECK-%os < %t.out
+// RUN: %clangxx_asan -m64 -O2 %s -o %t && %t 2>&1 | %symbolize > %t.out
+// RUN: FileCheck %s < %t.out && FileCheck %s --check-prefix=CHECK-%os < %t.out
+// RUN: %clangxx_asan -m64 -O3 %s -o %t && %t 2>&1 | %symbolize > %t.out
+// RUN: FileCheck %s < %t.out && FileCheck %s --check-prefix=CHECK-%os < %t.out
+// RUN: %clangxx_asan -m32 -O0 %s -o %t && %t 2>&1 | %symbolize > %t.out
+// RUN: FileCheck %s < %t.out && FileCheck %s --check-prefix=CHECK-%os < %t.out
+// RUN: %clangxx_asan -m32 -O1 %s -o %t && %t 2>&1 | %symbolize > %t.out
+// RUN: FileCheck %s < %t.out && FileCheck %s --check-prefix=CHECK-%os < %t.out
+// RUN: %clangxx_asan -m32 -O2 %s -o %t && %t 2>&1 | %symbolize > %t.out
+// RUN: FileCheck %s < %t.out && FileCheck %s --check-prefix=CHECK-%os < %t.out
+// RUN: %clangxx_asan -m32 -O3 %s -o %t && %t 2>&1 | %symbolize > %t.out
+// RUN: FileCheck %s < %t.out && FileCheck %s --check-prefix=CHECK-%os < %t.out
#include <string.h>
#include <stdlib.h>
@@ -13,16 +25,16 @@ int main(int argc, char **argv) {
// CHECK: {{WRITE of size 1 at 0x.* thread T0}}
// CHECK-Linux: {{ #0 0x.* in .*strncpy}}
// CHECK-Darwin: {{ #0 0x.* in wrap_strncpy}}
- // CHECK: {{ #1 0x.* in main .*strncpy-overflow.cc:12}}
+ // CHECK: {{ #1 0x.* in main .*strncpy-overflow.cc:24}}
// CHECK: {{0x.* is located 0 bytes to the right of 9-byte region}}
// CHECK: {{allocated by thread T0 here:}}
// CHECK-Linux: {{ #0 0x.* in .*malloc}}
- // CHECK-Linux: {{ #1 0x.* in main .*strncpy-overflow.cc:11}}
+ // CHECK-Linux: {{ #1 0x.* in main .*strncpy-overflow.cc:23}}
// CHECK-Darwin: {{ #0 0x.* in .*mz_malloc.*}}
// CHECK-Darwin: {{ #1 0x.* in malloc_zone_malloc.*}}
// CHECK-Darwin: {{ #2 0x.* in malloc.*}}
- // CHECK-Darwin: {{ #3 0x.* in main .*strncpy-overflow.cc:11}}
+ // CHECK-Darwin: {{ #3 0x.* in main .*strncpy-overflow.cc:23}}
return short_buffer[8];
}
diff --git a/compiler-rt/lib/asan/lit_tests/use-after-free.cc b/compiler-rt/lib/asan/lit_tests/use-after-free.cc
index d047153791c..9d8e8ac384e 100644
--- a/compiler-rt/lib/asan/lit_tests/use-after-free.cc
+++ b/compiler-rt/lib/asan/lit_tests/use-after-free.cc
@@ -1,7 +1,19 @@
-// RUN: %clangxx_asan -m64 -O2 %s -o %t
-// RUN: %t 2>&1 | %symbolizer | c++filt > %t.output
-// RUN: FileCheck %s < %t.output
-// RUN: FileCheck %s --check-prefix=CHECK-%os < %t.output
+// RUN: %clangxx_asan -m64 -O0 %s -o %t && %t 2>&1 | %symbolize > %t.out
+// RUN: FileCheck %s < %t.out && FileCheck %s --check-prefix=CHECK-%os < %t.out
+// RUN: %clangxx_asan -m64 -O1 %s -o %t && %t 2>&1 | %symbolize > %t.out
+// RUN: FileCheck %s < %t.out && FileCheck %s --check-prefix=CHECK-%os < %t.out
+// RUN: %clangxx_asan -m64 -O2 %s -o %t && %t 2>&1 | %symbolize > %t.out
+// RUN: FileCheck %s < %t.out && FileCheck %s --check-prefix=CHECK-%os < %t.out
+// RUN: %clangxx_asan -m64 -O3 %s -o %t && %t 2>&1 | %symbolize > %t.out
+// RUN: FileCheck %s < %t.out && FileCheck %s --check-prefix=CHECK-%os < %t.out
+// RUN: %clangxx_asan -m32 -O0 %s -o %t && %t 2>&1 | %symbolize > %t.out
+// RUN: FileCheck %s < %t.out && FileCheck %s --check-prefix=CHECK-%os < %t.out
+// RUN: %clangxx_asan -m32 -O1 %s -o %t && %t 2>&1 | %symbolize > %t.out
+// RUN: FileCheck %s < %t.out && FileCheck %s --check-prefix=CHECK-%os < %t.out
+// RUN: %clangxx_asan -m32 -O2 %s -o %t && %t 2>&1 | %symbolize > %t.out
+// RUN: FileCheck %s < %t.out && FileCheck %s --check-prefix=CHECK-%os < %t.out
+// RUN: %clangxx_asan -m32 -O3 %s -o %t && %t 2>&1 | %symbolize > %t.out
+// RUN: FileCheck %s < %t.out && FileCheck %s --check-prefix=CHECK-%os < %t.out
#include <stdlib.h>
int main() {
@@ -11,25 +23,25 @@ int main() {
// CHECK: {{.*ERROR: AddressSanitizer heap-use-after-free on address}}
// CHECK: {{0x.* at pc 0x.* bp 0x.* sp 0x.*}}
// CHECK: {{READ of size 1 at 0x.* thread T0}}
- // CHECK: {{ #0 0x.* in main .*use-after-free.cc:10}}
+ // CHECK: {{ #0 0x.* in main .*use-after-free.cc:22}}
// CHECK: {{0x.* is located 5 bytes inside of 10-byte region .0x.*,0x.*}}
// CHECK: {{freed by thread T0 here:}}
// CHECK-Linux: {{ #0 0x.* in .*free}}
- // CHECK-Linux: {{ #1 0x.* in main .*use-after-free.cc:9}}
+ // CHECK-Linux: {{ #1 0x.* in main .*use-after-free.cc:21}}
// CHECK-Darwin: {{ #0 0x.* in .*mz_free.*}}
// We override free() on Darwin, thus no malloc_zone_free
// CHECK-Darwin: {{ #1 0x.* in wrap_free}}
- // CHECK-Darwin: {{ #2 0x.* in main .*use-after-free.cc:9}}
+ // CHECK-Darwin: {{ #2 0x.* in main .*use-after-free.cc:21}}
// CHECK: {{previously allocated by thread T0 here:}}
// CHECK-Linux: {{ #0 0x.* in .*malloc}}
- // CHECK-Linux: {{ #1 0x.* in main .*use-after-free.cc:8}}
+ // CHECK-Linux: {{ #1 0x.* in main .*use-after-free.cc:20}}
// CHECK-Darwin: {{ #0 0x.* in .*mz_malloc.*}}
// CHECK-Darwin: {{ #1 0x.* in malloc_zone_malloc.*}}
// CHECK-Darwin: {{ #2 0x.* in malloc.*}}
- // CHECK-Darwin: {{ #3 0x.* in main .*use-after-free.cc:8}}
+ // CHECK-Darwin: {{ #3 0x.* in main .*use-after-free.cc:20}}
}
OpenPOWER on IntegriCloud