[llvm-commits] [compiler-rt] r150375 - /compiler-rt/trunk/lib/asan/output_tests/

Alexey Samsonov samsonov at google.com
Mon Feb 13 04:21:59 PST 2012


Author: samsonov
Date: Mon Feb 13 06:21:58 2012
New Revision: 150375

URL: http://llvm.org/viewvc/llvm-project?rev=150375&view=rev
Log:
AddressSanitizer: Convert templates for output tests to FileCheck format and move them inside sources

Added:
    compiler-rt/trunk/lib/asan/output_tests/stack-use-after-return.cc.disabled
      - copied, changed from r150367, compiler-rt/trunk/lib/asan/output_tests/stack-use-after-return.cc
Removed:
    compiler-rt/trunk/lib/asan/output_tests/clone_test.tmpl
    compiler-rt/trunk/lib/asan/output_tests/deep_tail_call.tmpl
    compiler-rt/trunk/lib/asan/output_tests/dlclose-test.tmpl
    compiler-rt/trunk/lib/asan/output_tests/global-overflow.tmpl
    compiler-rt/trunk/lib/asan/output_tests/heap-overflow.tmpl
    compiler-rt/trunk/lib/asan/output_tests/heap-overflow.tmpl.Darwin
    compiler-rt/trunk/lib/asan/output_tests/large_func_test.tmpl
    compiler-rt/trunk/lib/asan/output_tests/null_deref.tmpl
    compiler-rt/trunk/lib/asan/output_tests/null_deref.tmpl.Darwin
    compiler-rt/trunk/lib/asan/output_tests/shared-lib-test.tmpl
    compiler-rt/trunk/lib/asan/output_tests/stack-overflow.tmpl
    compiler-rt/trunk/lib/asan/output_tests/stack-use-after-return.cc
    compiler-rt/trunk/lib/asan/output_tests/stack-use-after-return.disabled
    compiler-rt/trunk/lib/asan/output_tests/strncpy-overflow.tmpl
    compiler-rt/trunk/lib/asan/output_tests/strncpy-overflow.tmpl.Darwin
    compiler-rt/trunk/lib/asan/output_tests/use-after-free.tmpl
    compiler-rt/trunk/lib/asan/output_tests/use-after-free.tmpl.Darwin
Modified:
    compiler-rt/trunk/lib/asan/output_tests/clone_test.cc
    compiler-rt/trunk/lib/asan/output_tests/deep_tail_call.cc
    compiler-rt/trunk/lib/asan/output_tests/dlclose-test.cc
    compiler-rt/trunk/lib/asan/output_tests/global-overflow.cc
    compiler-rt/trunk/lib/asan/output_tests/heap-overflow.cc
    compiler-rt/trunk/lib/asan/output_tests/large_func_test.cc
    compiler-rt/trunk/lib/asan/output_tests/null_deref.cc
    compiler-rt/trunk/lib/asan/output_tests/shared-lib-test.cc
    compiler-rt/trunk/lib/asan/output_tests/stack-overflow.cc
    compiler-rt/trunk/lib/asan/output_tests/strncpy-overflow.cc
    compiler-rt/trunk/lib/asan/output_tests/test_output.sh
    compiler-rt/trunk/lib/asan/output_tests/use-after-free.cc

Modified: compiler-rt/trunk/lib/asan/output_tests/clone_test.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/output_tests/clone_test.cc?rev=150375&r1=150374&r2=150375&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/output_tests/clone_test.cc (original)
+++ compiler-rt/trunk/lib/asan/output_tests/clone_test.cc Mon Feb 13 06:21:58 2012
@@ -29,5 +29,6 @@
 #include <stdio.h>
 int main() {
   printf("PASSED\n");
+  // CHECK: PASSED
 }
 #endif

Removed: compiler-rt/trunk/lib/asan/output_tests/clone_test.tmpl
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/output_tests/clone_test.tmpl?rev=150374&view=auto
==============================================================================
--- compiler-rt/trunk/lib/asan/output_tests/clone_test.tmpl (original)
+++ compiler-rt/trunk/lib/asan/output_tests/clone_test.tmpl (removed)
@@ -1 +0,0 @@
-PASSED

Modified: compiler-rt/trunk/lib/asan/output_tests/deep_tail_call.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/output_tests/deep_tail_call.cc?rev=150375&r1=150374&r2=150375&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/output_tests/deep_tail_call.cc (original)
+++ compiler-rt/trunk/lib/asan/output_tests/deep_tail_call.cc Mon Feb 13 06:21:58 2012
@@ -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];

Removed: compiler-rt/trunk/lib/asan/output_tests/deep_tail_call.tmpl
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/output_tests/deep_tail_call.tmpl?rev=150374&view=auto
==============================================================================
--- compiler-rt/trunk/lib/asan/output_tests/deep_tail_call.tmpl (original)
+++ compiler-rt/trunk/lib/asan/output_tests/deep_tail_call.tmpl (removed)
@@ -1,6 +0,0 @@
-AddressSanitizer global-buffer-overflow
-    #0.*call4
-    #1.*call3
-    #2.*call2
-    #3.*call1
-    #4.*main

Modified: compiler-rt/trunk/lib/asan/output_tests/dlclose-test.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/output_tests/dlclose-test.cc?rev=150375&r1=150374&r2=150375&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/output_tests/dlclose-test.cc (original)
+++ compiler-rt/trunk/lib/asan/output_tests/dlclose-test.cc Mon Feb 13 06:21:58 2012
@@ -69,5 +69,6 @@
   }
   addr[1] = 2;  // BOOM (if the bug is not fixed).
   printf("PASS\n");
+  // CHECK: PASS
   return 0;
 }

Removed: compiler-rt/trunk/lib/asan/output_tests/dlclose-test.tmpl
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/output_tests/dlclose-test.tmpl?rev=150374&view=auto
==============================================================================
--- compiler-rt/trunk/lib/asan/output_tests/dlclose-test.tmpl (original)
+++ compiler-rt/trunk/lib/asan/output_tests/dlclose-test.tmpl (removed)
@@ -1 +0,0 @@
-PASS

Modified: compiler-rt/trunk/lib/asan/output_tests/global-overflow.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/output_tests/global-overflow.cc?rev=150375&r1=150374&r2=150375&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/output_tests/global-overflow.cc (original)
+++ compiler-rt/trunk/lib/asan/output_tests/global-overflow.cc Mon Feb 13 06:21:58 2012
@@ -7,6 +7,9 @@
   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;
 }

Removed: compiler-rt/trunk/lib/asan/output_tests/global-overflow.tmpl
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/output_tests/global-overflow.tmpl?rev=150374&view=auto
==============================================================================
--- compiler-rt/trunk/lib/asan/output_tests/global-overflow.tmpl (original)
+++ compiler-rt/trunk/lib/asan/output_tests/global-overflow.tmpl (removed)
@@ -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

Modified: compiler-rt/trunk/lib/asan/output_tests/heap-overflow.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/output_tests/heap-overflow.cc?rev=150375&r1=150374&r2=150375&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/output_tests/heap-overflow.cc (original)
+++ compiler-rt/trunk/lib/asan/output_tests/heap-overflow.cc Mon Feb 13 06:21:58 2012
@@ -7,3 +7,19 @@
   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]}}

Removed: compiler-rt/trunk/lib/asan/output_tests/heap-overflow.tmpl
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/output_tests/heap-overflow.tmpl?rev=150374&view=auto
==============================================================================
--- compiler-rt/trunk/lib/asan/output_tests/heap-overflow.tmpl (original)
+++ compiler-rt/trunk/lib/asan/output_tests/heap-overflow.tmpl (removed)
@@ -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]

Removed: compiler-rt/trunk/lib/asan/output_tests/heap-overflow.tmpl.Darwin
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/output_tests/heap-overflow.tmpl.Darwin?rev=150374&view=auto
==============================================================================
--- compiler-rt/trunk/lib/asan/output_tests/heap-overflow.tmpl.Darwin (original)
+++ compiler-rt/trunk/lib/asan/output_tests/heap-overflow.tmpl.Darwin (removed)
@@ -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]

Modified: compiler-rt/trunk/lib/asan/output_tests/large_func_test.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/output_tests/large_func_test.cc?rev=150375&r1=150374&r2=150375&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/output_tests/large_func_test.cc (original)
+++ compiler-rt/trunk/lib/asan/output_tests/large_func_test.cc Mon Feb 13 06:21:58 2012
@@ -31,3 +31,12 @@
   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}}

Removed: compiler-rt/trunk/lib/asan/output_tests/large_func_test.tmpl
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/output_tests/large_func_test.tmpl?rev=150374&view=auto
==============================================================================
--- compiler-rt/trunk/lib/asan/output_tests/large_func_test.tmpl (original)
+++ compiler-rt/trunk/lib/asan/output_tests/large_func_test.tmpl (removed)
@@ -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

Modified: compiler-rt/trunk/lib/asan/output_tests/null_deref.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/output_tests/null_deref.cc?rev=150375&r1=150374&r2=150375&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/output_tests/null_deref.cc (original)
+++ compiler-rt/trunk/lib/asan/output_tests/null_deref.cc Mon Feb 13 06:21:58 2012
@@ -5,3 +5,14 @@
 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]}}

Removed: compiler-rt/trunk/lib/asan/output_tests/null_deref.tmpl
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/output_tests/null_deref.tmpl?rev=150374&view=auto
==============================================================================
--- compiler-rt/trunk/lib/asan/output_tests/null_deref.tmpl (original)
+++ compiler-rt/trunk/lib/asan/output_tests/null_deref.tmpl (removed)
@@ -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]

Removed: compiler-rt/trunk/lib/asan/output_tests/null_deref.tmpl.Darwin
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/output_tests/null_deref.tmpl.Darwin?rev=150374&view=auto
==============================================================================
--- compiler-rt/trunk/lib/asan/output_tests/null_deref.tmpl.Darwin (original)
+++ compiler-rt/trunk/lib/asan/output_tests/null_deref.tmpl.Darwin (removed)
@@ -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]

Modified: compiler-rt/trunk/lib/asan/output_tests/shared-lib-test.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/output_tests/shared-lib-test.cc?rev=150375&r1=150374&r2=150375&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/output_tests/shared-lib-test.cc (original)
+++ compiler-rt/trunk/lib/asan/output_tests/shared-lib-test.cc Mon Feb 13 06:21:58 2012
@@ -32,6 +32,11 @@
   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]}}

Removed: compiler-rt/trunk/lib/asan/output_tests/shared-lib-test.tmpl
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/output_tests/shared-lib-test.tmpl?rev=150374&view=auto
==============================================================================
--- compiler-rt/trunk/lib/asan/output_tests/shared-lib-test.tmpl (original)
+++ compiler-rt/trunk/lib/asan/output_tests/shared-lib-test.tmpl (removed)
@@ -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

Modified: compiler-rt/trunk/lib/asan/output_tests/stack-overflow.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/output_tests/stack-overflow.cc?rev=150375&r1=150374&r2=150375&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/output_tests/stack-overflow.cc (original)
+++ compiler-rt/trunk/lib/asan/output_tests/stack-overflow.cc Mon Feb 13 06:21:58 2012
@@ -5,3 +5,7 @@
   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>}}

Removed: compiler-rt/trunk/lib/asan/output_tests/stack-overflow.tmpl
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/output_tests/stack-overflow.tmpl?rev=150374&view=auto
==============================================================================
--- compiler-rt/trunk/lib/asan/output_tests/stack-overflow.tmpl (original)
+++ compiler-rt/trunk/lib/asan/output_tests/stack-overflow.tmpl (removed)
@@ -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>

Removed: compiler-rt/trunk/lib/asan/output_tests/stack-use-after-return.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/output_tests/stack-use-after-return.cc?rev=150374&view=auto
==============================================================================
--- compiler-rt/trunk/lib/asan/output_tests/stack-use-after-return.cc (original)
+++ compiler-rt/trunk/lib/asan/output_tests/stack-use-after-return.cc (removed)
@@ -1,24 +0,0 @@
-#include <stdio.h>
-
-__attribute__((noinline))
-char *Ident(char *x) {
-  fprintf(stderr, "1: %p\n", x);
-  return x;
-}
-
-__attribute__((noinline))
-char *Func1() {
-  char local;
-  return Ident(&local);
-}
-
-__attribute__((noinline))
-void Func2(char *x) {
-  fprintf(stderr, "2: %p\n", x);
-  *x = 1;
-}
-
-int main(int argc, char **argv) {
-  Func2(Func1());
-  return 0;
-}

Copied: compiler-rt/trunk/lib/asan/output_tests/stack-use-after-return.cc.disabled (from r150367, compiler-rt/trunk/lib/asan/output_tests/stack-use-after-return.cc)
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/output_tests/stack-use-after-return.cc.disabled?p2=compiler-rt/trunk/lib/asan/output_tests/stack-use-after-return.cc.disabled&p1=compiler-rt/trunk/lib/asan/output_tests/stack-use-after-return.cc&r1=150367&r2=150375&rev=150375&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/output_tests/stack-use-after-return.cc (original)
+++ compiler-rt/trunk/lib/asan/output_tests/stack-use-after-return.cc.disabled Mon Feb 13 06:21:58 2012
@@ -16,6 +16,9 @@
 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) {

Removed: compiler-rt/trunk/lib/asan/output_tests/stack-use-after-return.disabled
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/output_tests/stack-use-after-return.disabled?rev=150374&view=auto
==============================================================================
--- compiler-rt/trunk/lib/asan/output_tests/stack-use-after-return.disabled (original)
+++ compiler-rt/trunk/lib/asan/output_tests/stack-use-after-return.disabled (removed)
@@ -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

Modified: compiler-rt/trunk/lib/asan/output_tests/strncpy-overflow.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/output_tests/strncpy-overflow.cc?rev=150375&r1=150374&r2=150375&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/output_tests/strncpy-overflow.cc (original)
+++ compiler-rt/trunk/lib/asan/output_tests/strncpy-overflow.cc Mon Feb 13 06:21:58 2012
@@ -7,3 +7,21 @@
   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}}

Removed: compiler-rt/trunk/lib/asan/output_tests/strncpy-overflow.tmpl
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/output_tests/strncpy-overflow.tmpl?rev=150374&view=auto
==============================================================================
--- compiler-rt/trunk/lib/asan/output_tests/strncpy-overflow.tmpl (original)
+++ compiler-rt/trunk/lib/asan/output_tests/strncpy-overflow.tmpl (removed)
@@ -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

Removed: compiler-rt/trunk/lib/asan/output_tests/strncpy-overflow.tmpl.Darwin
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/output_tests/strncpy-overflow.tmpl.Darwin?rev=150374&view=auto
==============================================================================
--- compiler-rt/trunk/lib/asan/output_tests/strncpy-overflow.tmpl.Darwin (original)
+++ compiler-rt/trunk/lib/asan/output_tests/strncpy-overflow.tmpl.Darwin (removed)
@@ -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

Modified: compiler-rt/trunk/lib/asan/output_tests/test_output.sh
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/output_tests/test_output.sh?rev=150375&r1=150374&r2=150375&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/output_tests/test_output.sh (original)
+++ compiler-rt/trunk/lib/asan/output_tests/test_output.sh Mon Feb 13 06:21:58 2012
@@ -39,10 +39,14 @@
 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 @@
       $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

Modified: compiler-rt/trunk/lib/asan/output_tests/use-after-free.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/output_tests/use-after-free.cc?rev=150375&r1=150374&r2=150375&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/output_tests/use-after-free.cc (original)
+++ compiler-rt/trunk/lib/asan/output_tests/use-after-free.cc Mon Feb 13 06:21:58 2012
@@ -4,3 +4,29 @@
   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}}

Removed: compiler-rt/trunk/lib/asan/output_tests/use-after-free.tmpl
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/output_tests/use-after-free.tmpl?rev=150374&view=auto
==============================================================================
--- compiler-rt/trunk/lib/asan/output_tests/use-after-free.tmpl (original)
+++ compiler-rt/trunk/lib/asan/output_tests/use-after-free.tmpl (removed)
@@ -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

Removed: compiler-rt/trunk/lib/asan/output_tests/use-after-free.tmpl.Darwin
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/output_tests/use-after-free.tmpl.Darwin?rev=150374&view=auto
==============================================================================
--- compiler-rt/trunk/lib/asan/output_tests/use-after-free.tmpl.Darwin (original)
+++ compiler-rt/trunk/lib/asan/output_tests/use-after-free.tmpl.Darwin (removed)
@@ -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





More information about the llvm-commits mailing list