[asan] add a test which ensures that we dump coverage after SEGV

llvm-svn: 209295
This commit is contained in:
Kostya Serebryany 2014-05-21 13:20:14 +00:00
parent 5ebb2f3625
commit 301a38b0b7
1 changed files with 9 additions and 1 deletions

View File

@ -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