1 // FIXME: https://code.google.com/p/address-sanitizer/issues/detail?id=316
5 // The for loop in the backticks below requires bash.
8 // RUN: %clangxx_asan %s -o %t
11 // RUN: not %run %t 2> %t.out
12 // RUN: FileCheck %s --check-prefix=CHECK-ERROR < %t.out
15 // RUN: rm -f %t.log.*
16 // RUN: %env_asan_opts=log_path=%t.log not %run %t 2> %t.out
17 // RUN: FileCheck %s --check-prefix=CHECK-ERROR < %t.log.*
19 // Invalid log_path in existing directory.
20 // RUN: %env_asan_opts=log_path=/INVALID not %run %t 2> %t.out
21 // RUN: FileCheck %s --check-prefix=CHECK-INVALID < %t.out
23 // Directory of log_path can't be created.
24 // RUN: %env_asan_opts=log_path=/dev/null/INVALID not %run %t 2> %t.out
25 // RUN: FileCheck %s --check-prefix=CHECK-BAD-DIR < %t.out
28 // RUN: %env_asan_opts=log_path=`for((i=0;i<10000;i++)); do echo -n $i; done` \
29 // RUN: not %run %t 2> %t.out
30 // RUN: FileCheck %s --check-prefix=CHECK-LONG < %t.out
32 // Run w/o errors should not produce any log.
33 // RUN: rm -f %t.log.*
34 // RUN: %env_asan_opts=log_path=%t.log %run %t ARG ARG ARG
35 // RUN: not cat %t.log.*
37 // FIXME: log_path is not supported on Windows yet.
38 // XFAIL: target={{.*windows-msvc.*}}
42 int main(int argc
, char **argv
) {
43 if (argc
> 2) return 0;
44 char *x
= (char*)malloc(10);
46 int res
= x
[argc
* 10]; // BOOOM
50 // CHECK-ERROR: ERROR: AddressSanitizer
51 // CHECK-INVALID: ERROR: Can't open file: /INVALID
52 // CHECK-BAD-DIR: ERROR: Can't create directory: /dev/null
53 // CHECK-LONG: ERROR: Path is too long: 01234