summaryrefslogtreecommitdiffstats
path: root/compiler-rt
diff options
context:
space:
mode:
authorAlexey Samsonov <samsonov@google.com>2012-02-13 12:21:58 +0000
committerAlexey Samsonov <samsonov@google.com>2012-02-13 12:21:58 +0000
commit92a0b806a6ab3661125b3af2bd50720cc40c03db (patch)
tree46dcea36520f669cf2157a32d0d0927ec0f178fd /compiler-rt
parentb25d0d2318ba6dea1869d12b532f8e80b3a7a772 (diff)
downloadbcm5719-llvm-92a0b806a6ab3661125b3af2bd50720cc40c03db.tar.gz
bcm5719-llvm-92a0b806a6ab3661125b3af2bd50720cc40c03db.zip
AddressSanitizer: Convert templates for output tests to FileCheck format and move them inside sources
llvm-svn: 150375
Diffstat (limited to 'compiler-rt')
-rw-r--r--compiler-rt/lib/asan/output_tests/clone_test.cc1
-rw-r--r--compiler-rt/lib/asan/output_tests/clone_test.tmpl1
-rw-r--r--compiler-rt/lib/asan/output_tests/deep_tail_call.cc18
-rw-r--r--compiler-rt/lib/asan/output_tests/deep_tail_call.tmpl6
-rw-r--r--compiler-rt/lib/asan/output_tests/dlclose-test.cc1
-rw-r--r--compiler-rt/lib/asan/output_tests/dlclose-test.tmpl1
-rw-r--r--compiler-rt/lib/asan/output_tests/global-overflow.cc3
-rw-r--r--compiler-rt/lib/asan/output_tests/global-overflow.tmpl3
-rw-r--r--compiler-rt/lib/asan/output_tests/heap-overflow.cc16
-rw-r--r--compiler-rt/lib/asan/output_tests/heap-overflow.tmpl6
-rw-r--r--compiler-rt/lib/asan/output_tests/heap-overflow.tmpl.Darwin8
-rw-r--r--compiler-rt/lib/asan/output_tests/large_func_test.cc9
-rw-r--r--compiler-rt/lib/asan/output_tests/large_func_test.tmpl8
-rw-r--r--compiler-rt/lib/asan/output_tests/null_deref.cc11
-rw-r--r--compiler-rt/lib/asan/output_tests/null_deref.tmpl4
-rw-r--r--compiler-rt/lib/asan/output_tests/null_deref.tmpl.Darwin5
-rw-r--r--compiler-rt/lib/asan/output_tests/shared-lib-test.cc7
-rw-r--r--compiler-rt/lib/asan/output_tests/shared-lib-test.tmpl7
-rw-r--r--compiler-rt/lib/asan/output_tests/stack-overflow.cc4
-rw-r--r--compiler-rt/lib/asan/output_tests/stack-overflow.tmpl3
-rw-r--r--compiler-rt/lib/asan/output_tests/stack-use-after-return.cc.disabled (renamed from compiler-rt/lib/asan/output_tests/stack-use-after-return.cc)3
-rw-r--r--compiler-rt/lib/asan/output_tests/stack-use-after-return.disabled3
-rw-r--r--compiler-rt/lib/asan/output_tests/strncpy-overflow.cc18
-rw-r--r--compiler-rt/lib/asan/output_tests/strncpy-overflow.tmpl7
-rw-r--r--compiler-rt/lib/asan/output_tests/strncpy-overflow.tmpl.Darwin9
-rwxr-xr-xcompiler-rt/lib/asan/output_tests/test_output.sh18
-rw-r--r--compiler-rt/lib/asan/output_tests/use-after-free.cc26
-rw-r--r--compiler-rt/lib/asan/output_tests/use-after-free.tmpl10
-rw-r--r--compiler-rt/lib/asan/output_tests/use-after-free.tmpl.Darwin14
29 files changed, 119 insertions, 111 deletions
diff --git a/compiler-rt/lib/asan/output_tests/clone_test.cc b/compiler-rt/lib/asan/output_tests/clone_test.cc
index 6a615acd014..aba9c24dca7 100644
--- a/compiler-rt/lib/asan/output_tests/clone_test.cc
+++ b/compiler-rt/lib/asan/output_tests/clone_test.cc
@@ -29,5 +29,6 @@ int main(int argc, char **argv) {
#include <stdio.h>
int main() {
printf("PASSED\n");
+ // CHECK: PASSED
}
#endif
diff --git a/compiler-rt/lib/asan/output_tests/clone_test.tmpl b/compiler-rt/lib/asan/output_tests/clone_test.tmpl
deleted file mode 100644
index 53cdf1e9393..00000000000
--- a/compiler-rt/lib/asan/output_tests/clone_test.tmpl
+++ /dev/null
@@ -1 +0,0 @@
-PASSED
diff --git a/compiler-rt/lib/asan/output_tests/deep_tail_call.cc b/compiler-rt/lib/asan/output_tests/deep_tail_call.cc
index bf6225e2580..96009508aa9 100644
--- a/compiler-rt/lib/asan/output_tests/deep_tail_call.cc
+++ b/compiler-rt/lib/asan/output_tests/deep_tail_call.cc
@@ -1,12 +1,14 @@
+// CHECK: AddressSanitizer global-buffer-overflow
int global[10];
-__attribute__((noinline))
-void call4(int i) { global[i+10]++; }
-__attribute__((noinline))
-void call3(int i) { call4(i); }
-__attribute__((noinline))
-void call2(int i) { call3(i); }
-__attribute__((noinline))
-void call1(int i) { call2(i); }
+// CHECK: {{#0.*call4}}
+void __attribute__((noinline)) call4(int i) { global[i+10]++; }
+// CHECK: {{#1.*call3}}
+void __attribute__((noinline)) call3(int i) { call4(i); }
+// CHECK: {{#2.*call2}}
+void __attribute__((noinline)) call2(int i) { call3(i); }
+// CHECK: {{#3.*call1}}
+void __attribute__((noinline)) call1(int i) { call2(i); }
+// CHECK: {{#4.*main}}
int main(int argc, char **argv) {
call1(argc);
return global[0];
diff --git a/compiler-rt/lib/asan/output_tests/deep_tail_call.tmpl b/compiler-rt/lib/asan/output_tests/deep_tail_call.tmpl
deleted file mode 100644
index 8a31d932232..00000000000
--- a/compiler-rt/lib/asan/output_tests/deep_tail_call.tmpl
+++ /dev/null
@@ -1,6 +0,0 @@
-AddressSanitizer global-buffer-overflow
- #0.*call4
- #1.*call3
- #2.*call2
- #3.*call1
- #4.*main
diff --git a/compiler-rt/lib/asan/output_tests/dlclose-test.cc b/compiler-rt/lib/asan/output_tests/dlclose-test.cc
index 307886667b1..3c398500326 100644
--- a/compiler-rt/lib/asan/output_tests/dlclose-test.cc
+++ b/compiler-rt/lib/asan/output_tests/dlclose-test.cc
@@ -69,5 +69,6 @@ int main(int argc, char *argv[]) {
}
addr[1] = 2; // BOOM (if the bug is not fixed).
printf("PASS\n");
+ // CHECK: PASS
return 0;
}
diff --git a/compiler-rt/lib/asan/output_tests/dlclose-test.tmpl b/compiler-rt/lib/asan/output_tests/dlclose-test.tmpl
deleted file mode 100644
index 7ef22e9a431..00000000000
--- a/compiler-rt/lib/asan/output_tests/dlclose-test.tmpl
+++ /dev/null
@@ -1 +0,0 @@
-PASS
diff --git a/compiler-rt/lib/asan/output_tests/global-overflow.cc b/compiler-rt/lib/asan/output_tests/global-overflow.cc
index b85c4d2a18b..0869da05efb 100644
--- a/compiler-rt/lib/asan/output_tests/global-overflow.cc
+++ b/compiler-rt/lib/asan/output_tests/global-overflow.cc
@@ -7,6 +7,9 @@ int main(int argc, char **argv) {
memset(YYY, 0, 10);
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:9}}
+ // CHECK: {{0x.* is located 0 bytes to the right of global variable .*YYY.* of size 10}}
res += XXX[argc] + ZZZ[argc];
return res;
}
diff --git a/compiler-rt/lib/asan/output_tests/global-overflow.tmpl b/compiler-rt/lib/asan/output_tests/global-overflow.tmpl
deleted file mode 100644
index c5d54428143..00000000000
--- a/compiler-rt/lib/asan/output_tests/global-overflow.tmpl
+++ /dev/null
@@ -1,3 +0,0 @@
-READ of size 1 at 0x.* thread T0
- #0 0x.* in main .*global-overflow.cc:9
-0x.* is located 0 bytes to the right of global variable .*YYY.* of size 10
diff --git a/compiler-rt/lib/asan/output_tests/heap-overflow.cc b/compiler-rt/lib/asan/output_tests/heap-overflow.cc
index 475d1637385..ffc50bede7b 100644
--- a/compiler-rt/lib/asan/output_tests/heap-overflow.cc
+++ b/compiler-rt/lib/asan/output_tests/heap-overflow.cc
@@ -7,3 +7,19 @@ int main(int argc, char **argv) {
free(x);
return res;
}
+
+// CHECK: {{READ of size 1 at 0x.* thread T0}}
+// CHECK: {{ #0 0x.* in main .*heap-overflow.cc:6}}
+// CHECK: {{0x.* is located 0 bytes to the right of 10-byte region}}
+// CHECK: {{allocated by thread T0 here:}}
+// CHECK: {{ #0 0x.* in malloc}}
+// CHECK: {{ #1 0x.* in main .*heap-overflow.cc:[45]}}
+
+// Darwin: {{READ of size 1 at 0x.* thread T0}}
+// Darwin: {{ #0 0x.* in main .*heap-overflow.cc:6}}
+// Darwin: {{0x.* is located 0 bytes to the right of 10-byte region}}
+// Darwin: {{allocated by thread T0 here:}}
+// Darwin: {{ #0 0x.* in .*mz_malloc.*}}
+// Darwin: {{ #1 0x.* in malloc_zone_malloc.*}}
+// Darwin: {{ #2 0x.* in malloc.*}}
+// Darwin: {{ #3 0x.* in main heap-overflow.cc:[45]}}
diff --git a/compiler-rt/lib/asan/output_tests/heap-overflow.tmpl b/compiler-rt/lib/asan/output_tests/heap-overflow.tmpl
deleted file mode 100644
index e2ab65f17d8..00000000000
--- a/compiler-rt/lib/asan/output_tests/heap-overflow.tmpl
+++ /dev/null
@@ -1,6 +0,0 @@
-READ of size 1 at 0x.* thread T0
- #0 0x.* in main .*heap-overflow.cc:6
-0x.* is located 0 bytes to the right of 10-byte region
-allocated by thread T0 here:
- #0 0x.* in malloc
- #1 0x.* in main .*heap-overflow.cc:[45]
diff --git a/compiler-rt/lib/asan/output_tests/heap-overflow.tmpl.Darwin b/compiler-rt/lib/asan/output_tests/heap-overflow.tmpl.Darwin
deleted file mode 100644
index cb76269d7f7..00000000000
--- a/compiler-rt/lib/asan/output_tests/heap-overflow.tmpl.Darwin
+++ /dev/null
@@ -1,8 +0,0 @@
-READ of size 1 at 0x.* thread T0
- #0 0x.* in main .*heap-overflow.cc:6
-0x.* is located 0 bytes to the right of 10-byte region
-allocated by thread T0 here:
- #0 0x.* in .*mz_malloc.*
- #1 0x.* in malloc_zone_malloc.*
- #2 0x.* in malloc.*
- #3 0x.* in main heap-overflow.cc:[45]
diff --git a/compiler-rt/lib/asan/output_tests/large_func_test.cc b/compiler-rt/lib/asan/output_tests/large_func_test.cc
index 70bc36f40b8..3de025f8905 100644
--- a/compiler-rt/lib/asan/output_tests/large_func_test.cc
+++ b/compiler-rt/lib/asan/output_tests/large_func_test.cc
@@ -31,3 +31,12 @@ int main(int argc, char **argv) {
LargeFunction(x, argc - 1);
delete x;
}
+
+// CHECK: {{.*ERROR: AddressSanitizer heap-buffer-overflow on address 0x.* at pc 0x.* bp 0x.* sp 0x.*}}
+// CHECK: {{READ of size 4 at 0x.* thread T0}}
+// CHECK: {{ #0 0x.* in LargeFunction .*large_func_test.cc:15}}
+// CHECK: {{ #1 0x.* in main .*large_func_test.cc:3[012]}}
+// 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:30}}
diff --git a/compiler-rt/lib/asan/output_tests/large_func_test.tmpl b/compiler-rt/lib/asan/output_tests/large_func_test.tmpl
deleted file mode 100644
index 45a13d0bc5b..00000000000
--- a/compiler-rt/lib/asan/output_tests/large_func_test.tmpl
+++ /dev/null
@@ -1,8 +0,0 @@
-.*ERROR: AddressSanitizer heap-buffer-overflow on address 0x.* at pc 0x.* bp 0x.* sp 0x.*
-READ of size 4 at 0x.* thread T0
- #0 0x.* in LargeFunction .*large_func_test.cc:15
- #1 0x.* in main .*large_func_test.cc:3[012]
-0x.* is located 44 bytes to the right of 400-byte region
-allocated by thread T0 here:
- #0 0x.* in operator new.*
- #1 0x.* in main .*large_func_test.cc:30
diff --git a/compiler-rt/lib/asan/output_tests/null_deref.cc b/compiler-rt/lib/asan/output_tests/null_deref.cc
index f7ba4dd5f63..a44604d4f36 100644
--- a/compiler-rt/lib/asan/output_tests/null_deref.cc
+++ b/compiler-rt/lib/asan/output_tests/null_deref.cc
@@ -5,3 +5,14 @@ static void NullDeref(int *ptr) {
int main() {
NullDeref((int*)0);
}
+
+// CHECK: {{.*ERROR: AddressSanitizer crashed on unknown address 0x0*00028 .*pc 0x.*}}
+// CHECK: {{AddressSanitizer can not provide additional info. ABORTING}}
+// CHECK: {{ #0 0x.* in NullDeref.*null_deref.cc:3}}
+// CHECK: {{ #1 0x.* in main.*null_deref.cc:[67]}}
+
+// Darwin: {{.*ERROR: AddressSanitizer crashed on unknown address 0x0*00028 .*pc 0x.*}}
+// Darwin: {{AddressSanitizer can not provide additional info. ABORTING}}
+// atos cannot resolve the file:line info for frame 0 on the O1 level
+// Darwin: {{ #0 0x.* in NullDeref.*}}
+// Darwin: {{ #1 0x.* in main.*null_deref.cc:[67]}}
diff --git a/compiler-rt/lib/asan/output_tests/null_deref.tmpl b/compiler-rt/lib/asan/output_tests/null_deref.tmpl
deleted file mode 100644
index d27cccc06bc..00000000000
--- a/compiler-rt/lib/asan/output_tests/null_deref.tmpl
+++ /dev/null
@@ -1,4 +0,0 @@
-.*ERROR: AddressSanitizer crashed on unknown address 0x0*00028 .*pc 0x.*
-AddressSanitizer can not provide additional info. ABORTING
- #0 0x.* in NullDeref.*null_deref.cc:3
- #1 0x.* in main.*null_deref.cc:[67]
diff --git a/compiler-rt/lib/asan/output_tests/null_deref.tmpl.Darwin b/compiler-rt/lib/asan/output_tests/null_deref.tmpl.Darwin
deleted file mode 100644
index 8c121431ec5..00000000000
--- a/compiler-rt/lib/asan/output_tests/null_deref.tmpl.Darwin
+++ /dev/null
@@ -1,5 +0,0 @@
-.*ERROR: AddressSanitizer crashed on unknown address 0x0*00028 .*pc 0x.*
-AddressSanitizer can not provide additional info. ABORTING
-# atos cannot resolve the file:line info for frame 0 on the O1 level
- #0 0x.* in NullDeref.*
- #1 0x.* in main.*null_deref.cc:[67]
diff --git a/compiler-rt/lib/asan/output_tests/shared-lib-test.cc b/compiler-rt/lib/asan/output_tests/shared-lib-test.cc
index e492572c728..d0f90d0a7ba 100644
--- a/compiler-rt/lib/asan/output_tests/shared-lib-test.cc
+++ b/compiler-rt/lib/asan/output_tests/shared-lib-test.cc
@@ -32,6 +32,11 @@ int main(int argc, char *argv[]) {
if (!inc) return 1;
printf("ok\n");
inc(1);
- inc(-1);
+ inc(-1); // BOOM
return 0;
}
+
+// 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:3[567]}}
diff --git a/compiler-rt/lib/asan/output_tests/shared-lib-test.tmpl b/compiler-rt/lib/asan/output_tests/shared-lib-test.tmpl
deleted file mode 100644
index 564e3eb5cb8..00000000000
--- a/compiler-rt/lib/asan/output_tests/shared-lib-test.tmpl
+++ /dev/null
@@ -1,7 +0,0 @@
-#.*ERROR: AddressSanitizer global-buffer-overflow on address 0x.* at pc 0x.* bp 0x.* sp 0x.*
-#READ of size 4 at 0x.* thread T0
-# #0 0x.* in inc .*shared-lib-test-so.cc:11
-# #1 0x.* in main .*shared-lib-test.cc:33
-# #2 0x.* in __libc_start_main.*
-#0x.* is located 4 bytes to the left of global variable 'GLOB' (.*) of size 40
-#0x.* is located 52 bytes to the right of global variable 'pad' (.*) of size 40
diff --git a/compiler-rt/lib/asan/output_tests/stack-overflow.cc b/compiler-rt/lib/asan/output_tests/stack-overflow.cc
index dd86aa32514..2a0a1383e49 100644
--- a/compiler-rt/lib/asan/output_tests/stack-overflow.cc
+++ b/compiler-rt/lib/asan/output_tests/stack-overflow.cc
@@ -5,3 +5,7 @@ int main(int argc, char **argv) {
int res = x[argc * 10]; // BOOOM
return res;
}
+
+// CHECK: {{READ of size 1 at 0x.* thread T0}}
+// CHECK: {{ #0 0x.* in main .*stack-overflow.cc:5}}
+// CHECK: {{Address 0x.* is .* frame <main>}}
diff --git a/compiler-rt/lib/asan/output_tests/stack-overflow.tmpl b/compiler-rt/lib/asan/output_tests/stack-overflow.tmpl
deleted file mode 100644
index 6aa717a82b2..00000000000
--- a/compiler-rt/lib/asan/output_tests/stack-overflow.tmpl
+++ /dev/null
@@ -1,3 +0,0 @@
-READ of size 1 at 0x.* thread T0
- #0 0x.* in main .*stack-overflow.cc:5
-Address 0x.* is .* frame <main>
diff --git a/compiler-rt/lib/asan/output_tests/stack-use-after-return.cc b/compiler-rt/lib/asan/output_tests/stack-use-after-return.cc.disabled
index 9098edf0adb..97a37bc04f0 100644
--- a/compiler-rt/lib/asan/output_tests/stack-use-after-return.cc
+++ b/compiler-rt/lib/asan/output_tests/stack-use-after-return.cc.disabled
@@ -16,6 +16,9 @@ __attribute__((noinline))
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: {{is located in frame <.*Func1.*> of T0's stack}}
}
int main(int argc, char **argv) {
diff --git a/compiler-rt/lib/asan/output_tests/stack-use-after-return.disabled b/compiler-rt/lib/asan/output_tests/stack-use-after-return.disabled
deleted file mode 100644
index 02729bc43a7..00000000000
--- a/compiler-rt/lib/asan/output_tests/stack-use-after-return.disabled
+++ /dev/null
@@ -1,3 +0,0 @@
-WRITE of size 1 .* thread T0
-#0.*Func2.*stack-use-after-return.cc:18
-is located in frame <.*Func1.*> of T0's stack
diff --git a/compiler-rt/lib/asan/output_tests/strncpy-overflow.cc b/compiler-rt/lib/asan/output_tests/strncpy-overflow.cc
index 044f6494bfa..cc202aedb50 100644
--- a/compiler-rt/lib/asan/output_tests/strncpy-overflow.cc
+++ b/compiler-rt/lib/asan/output_tests/strncpy-overflow.cc
@@ -7,3 +7,21 @@ int main(int argc, char **argv) {
strncpy(short_buffer, hello, 10); // BOOM
return short_buffer[8];
}
+
+// CHECK: {{WRITE of size 1 at 0x.* thread T0}}
+// CHECK: {{ #0 0x.* in strncpy}}
+// CHECK: {{ #1 0x.* in main .*strncpy-overflow.cc:[78]}}
+// CHECK: {{0x.* is located 0 bytes to the right of 9-byte region}}
+// CHECK: {{allocated by thread T0 here:}}
+// CHECK: {{ #0 0x.* in malloc}}
+// CHECK: {{ #1 0x.* in main .*strncpy-overflow.cc:6}}
+
+// Darwin: {{WRITE of size 1 at 0x.* thread T0}}
+// Darwin: {{ #0 0x.* in wrap_strncpy}}
+// Darwin: {{ #1 0x.* in main .*strncpy-overflow.cc:[78]}}
+// Darwin: {{0x.* is located 0 bytes to the right of 9-byte region}}
+// Darwin: {{allocated by thread T0 here:}}
+// Darwin: {{ #0 0x.* in .*mz_malloc.*}}
+// Darwin: {{ #1 0x.* in malloc_zone_malloc.*}}
+// Darwin: {{ #2 0x.* in malloc.*}}
+// Darwin: {{ #3 0x.* in main .*strncpy-overflow.cc:6}}
diff --git a/compiler-rt/lib/asan/output_tests/strncpy-overflow.tmpl b/compiler-rt/lib/asan/output_tests/strncpy-overflow.tmpl
deleted file mode 100644
index 3780aa81921..00000000000
--- a/compiler-rt/lib/asan/output_tests/strncpy-overflow.tmpl
+++ /dev/null
@@ -1,7 +0,0 @@
-WRITE of size 1 at 0x.* thread T0
- #0 0x.* in strncpy
- #1 0x.* in main .*strncpy-overflow.cc:[78]
-0x.* is located 0 bytes to the right of 9-byte region
-allocated by thread T0 here:
- #0 0x.* in malloc
- #1 0x.* in main .*strncpy-overflow.cc:6
diff --git a/compiler-rt/lib/asan/output_tests/strncpy-overflow.tmpl.Darwin b/compiler-rt/lib/asan/output_tests/strncpy-overflow.tmpl.Darwin
deleted file mode 100644
index 80919e6c519..00000000000
--- a/compiler-rt/lib/asan/output_tests/strncpy-overflow.tmpl.Darwin
+++ /dev/null
@@ -1,9 +0,0 @@
-WRITE of size 1 at 0x.* thread T0
- #0 0x.* in wrap_strncpy
- #1 0x.* in main .*strncpy-overflow.cc:[78]
-0x.* is located 0 bytes to the right of 9-byte region
-allocated by thread T0 here:
- #0 0x.* in .*mz_malloc.*
- #1 0x.* in malloc_zone_malloc.*
- #2 0x.* in malloc.*
- #3 0x.* in main .*strncpy-overflow.cc:6
diff --git a/compiler-rt/lib/asan/output_tests/test_output.sh b/compiler-rt/lib/asan/output_tests/test_output.sh
index 3cc91c36c89..112d71c6a21 100755
--- a/compiler-rt/lib/asan/output_tests/test_output.sh
+++ b/compiler-rt/lib/asan/output_tests/test_output.sh
@@ -39,10 +39,14 @@ check_program a.out $C_TEST.c CHECKSLEEP
export ASAN_OPTIONS=""
rm ./a.out
-for t in *.tmpl; do
+for t in *.cc; do
for b in 32 64; do
for O in 0 1 2 3; do
- c=`basename $t .tmpl`
+ c=`basename $t .cc`
+ if [[ "$c" == *"-so" ]]
+ then
+ continue
+ fi
c_so=$c-so
exe=$c.$b.O$O
so=$c.$b.O$O-so.so
@@ -52,14 +56,14 @@ for t in *.tmpl; do
$build_command
[ -e "$c_so.cc" ] && $CXX $CXXFLAGS -g -m$b -faddress-sanitizer -O$O $c_so.cc -fPIC -shared -o $so
# If there's an OS-specific template, use it.
- # Please minimize the use of OS-specific templates.
- if [ -e "$t.$OS" ]
+ # Otherwise use default template.
+ if [ `grep -c "$OS" $c.cc` -gt 0 ]
then
- actual_t="$t.$OS"
+ check_prefix="$OS"
else
- actual_t="$t"
+ check_prefix="CHECK"
fi
- ./$exe 2>&1 | $SYMBOLIZER 2> /dev/null | c++filt | ./match_output.py $actual_t
+ check_program $exe $c.cc $check_prefix
rm ./$exe
[ -e "$so" ] && rm ./$so
done
diff --git a/compiler-rt/lib/asan/output_tests/use-after-free.cc b/compiler-rt/lib/asan/output_tests/use-after-free.cc
index 60626bff778..fbf2ab46d52 100644
--- a/compiler-rt/lib/asan/output_tests/use-after-free.cc
+++ b/compiler-rt/lib/asan/output_tests/use-after-free.cc
@@ -4,3 +4,29 @@ int main() {
free(x);
return x[5];
}
+
+// CHECK: {{.*ERROR: AddressSanitizer heap-use-after-free on address 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:5}}
+// CHECK: {{0x.* is located 5 bytes inside of 10-byte region .0x.*,0x.*}}
+// CHECK: {{freed by thread T0 here:}}
+// CHECK: {{ #0 0x.* in free}}
+// CHECK: {{ #1 0x.* in main .*use-after-free.cc:[45]}}
+// CHECK: {{previously allocated by thread T0 here:}}
+// CHECK: {{ #0 0x.* in malloc}}
+// CHECK: {{ #1 0x.* in main .*use-after-free.cc:3}}
+
+// Darwin: {{.*ERROR: AddressSanitizer heap-use-after-free on address 0x.* at pc 0x.* bp 0x.* sp 0x.*}}
+// Darwin: {{READ of size 1 at 0x.* thread T0}}
+// Darwin: {{ #0 0x.* in main .*use-after-free.cc:5}}
+// Darwin: {{0x.* is located 5 bytes inside of 10-byte region .0x.*,0x.*}}
+// Darwin: {{freed by thread T0 here:}}
+// Darwin: {{ #0 0x.* in .*mz_free.*}}
+// We override free() on Darwin, thus no malloc_zone_free
+// Darwin: {{ #1 0x.* in free}}
+// Darwin: {{ #2 0x.* in main .*use-after-free.cc:[45]}}
+// Darwin: {{previously allocated by thread T0 here:}}
+// Darwin: {{ #0 0x.* in .*mz_malloc.*}}
+// Darwin: {{ #1 0x.* in malloc_zone_malloc.*}}
+// Darwin: {{ #2 0x.* in malloc.*}}
+// Darwin: {{ #3 0x.* in main .*use-after-free.cc:3}}
diff --git a/compiler-rt/lib/asan/output_tests/use-after-free.tmpl b/compiler-rt/lib/asan/output_tests/use-after-free.tmpl
deleted file mode 100644
index c4b5c74d988..00000000000
--- a/compiler-rt/lib/asan/output_tests/use-after-free.tmpl
+++ /dev/null
@@ -1,10 +0,0 @@
-.*ERROR: AddressSanitizer heap-use-after-free on address 0x.* at pc 0x.* bp 0x.* sp 0x.*
-READ of size 1 at 0x.* thread T0
- #0 0x.* in main .*use-after-free.cc:5
-0x.* is located 5 bytes inside of 10-byte region .0x.*,0x.*
-freed by thread T0 here:
- #0 0x.* in free
- #1 0x.* in main .*use-after-free.cc:[45]
-previously allocated by thread T0 here:
- #0 0x.* in malloc
- #1 0x.* in main .*use-after-free.cc:3
diff --git a/compiler-rt/lib/asan/output_tests/use-after-free.tmpl.Darwin b/compiler-rt/lib/asan/output_tests/use-after-free.tmpl.Darwin
deleted file mode 100644
index f4f66cd8e18..00000000000
--- a/compiler-rt/lib/asan/output_tests/use-after-free.tmpl.Darwin
+++ /dev/null
@@ -1,14 +0,0 @@
-.*ERROR: AddressSanitizer heap-use-after-free on address 0x.* at pc 0x.* bp 0x.* sp 0x.*
-READ of size 1 at 0x.* thread T0
- #0 0x.* in main .*use-after-free.cc:5
-0x.* is located 5 bytes inside of 10-byte region .0x.*,0x.*
-freed by thread T0 here:
- #0 0x.* in .*mz_free.*
-# We override free() on Darwin, thus no malloc_zone_free
- #1 0x.* in free
- #2 0x.* in main .*use-after-free.cc:[45]
-previously allocated by thread T0 here:
- #0 0x.* in .*mz_malloc.*
- #1 0x.* in malloc_zone_malloc.*
- #2 0x.* in malloc.*
- #3 0x.* in main .*use-after-free.cc:3
OpenPOWER on IntegriCloud