Stephen Hines | 2d1fdb2 | 2014-05-28 23:58:16 -0700 | [diff] [blame] | 1 | // RUN: %clangxx_asan %s -o %t |
| 2 | // RUN: rm -f %t.log.* |
| 3 | // Set verbosity to 1 so that the log files are opened prior to fork(). |
Pirama Arumuga Nainar | 799172d | 2016-03-03 15:50:30 -0800 | [diff] [blame^] | 4 | // RUN: %env_asan_opts=log_path='"%t.log"':verbosity=1 not %run %t 2> %t.out |
Stephen Hines | 2d1fdb2 | 2014-05-28 23:58:16 -0700 | [diff] [blame] | 5 | // RUN: for f in %t.log.* ; do FileCheck %s < $f; done |
| 6 | // RUN: [ `ls %t.log.* | wc -l` == 2 ] |
| 7 | |
| 8 | #include <stdlib.h> |
| 9 | #include <string.h> |
| 10 | #include <unistd.h> |
| 11 | |
| 12 | int main(int argc, char **argv) { |
| 13 | void *x = malloc(10); |
| 14 | free(x); |
| 15 | if (fork() == -1) return 1; |
| 16 | // There are two processes at this point, thus there should be two distinct |
| 17 | // error logs. |
| 18 | free(x); |
| 19 | return 0; |
| 20 | } |
| 21 | |
| 22 | // CHECK: ERROR: AddressSanitizer |