[compiler-rt] r209295 - [asan] add a test which ensures that we dump coverage after SEGV

Kostya Serebryany kcc at google.com
Wed May 21 06:20:14 PDT 2014


Author: kcc
Date: Wed May 21 08:20:14 2014
New Revision: 209295

URL: http://llvm.org/viewvc/llvm-project?rev=209295&view=rev
Log:
[asan] add a test which ensures that we dump coverage after SEGV

Modified:
    compiler-rt/trunk/test/asan/TestCases/Linux/coverage.cc

Modified: compiler-rt/trunk/test/asan/TestCases/Linux/coverage.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/TestCases/Linux/coverage.cc?rev=209295&r1=209294&r2=209295&view=diff
==============================================================================
--- compiler-rt/trunk/test/asan/TestCases/Linux/coverage.cc (original)
+++ compiler-rt/trunk/test/asan/TestCases/Linux/coverage.cc Wed May 21 08:20:14 2014
@@ -6,7 +6,8 @@
 // RUN: %run %t foo 2>&1     | FileCheck %s --check-prefix=CHECK-foo
 // RUN: %run %t bar 2>&1     | FileCheck %s --check-prefix=CHECK-bar
 // RUN: %run %t foo bar 2>&1 | FileCheck %s --check-prefix=CHECK-foo-bar
-// RUN: not %run %t foo bar 1 2  2>&1 | FileCheck %s --check-prefix=CHECK-report
+// RUN: not %run %t foo bar 4    2>&1 | FileCheck %s --check-prefix=CHECK-report
+// RUN: not %run %t foo bar 4 5  2>&1 | FileCheck %s --check-prefix=CHECK-segv
 // RUN: cd .. && rm coverage -r
 //
 // https://code.google.com/p/address-sanitizer/issues/detail?id=263
@@ -33,6 +34,10 @@ int main(int argc, char **argv) {
     if (!strcmp(argv[i], "bar"))
       bar();
   }
+  if (argc == 5) {
+    static volatile char *zero = 0;
+    *zero = 0;  // SEGV if argc == 5.
+  }
   return G[argc];  // Buffer overflow if argc >= 4.
 }
 #endif
@@ -55,3 +60,6 @@ int main(int argc, char **argv) {
 //
 // CHECK-report: AddressSanitizer: global-buffer-overflow
 // CHECK-report: PCs written
+//
+// CHECK-segv: AddressSanitizer: SEGV
+// CHECK-segv: PCs written





More information about the llvm-commits mailing list