Pirama Arumuga Nainar | cdce50b | 2015-07-01 12:26:56 -0700 | [diff] [blame] | 1 | // Test the handle_abort option. |
| 2 | // RUN: %clang %s -o %t |
| 3 | // RUN: not --crash %run %t 2>&1 | FileCheck --check-prefix=CHECK0 %s |
Pirama Arumuga Nainar | 799172d | 2016-03-03 15:50:30 -0800 | [diff] [blame^] | 4 | // RUN: %env_tool_opts=handle_abort=0 not --crash %run %t 2>&1 | FileCheck --check-prefix=CHECK0 %s |
| 5 | // RUN: %env_tool_opts=handle_abort=1 not %run %t 2>&1 | FileCheck --check-prefix=CHECK1 %s |
Pirama Arumuga Nainar | cdce50b | 2015-07-01 12:26:56 -0700 | [diff] [blame] | 6 | // FIXME: implement in other sanitizers, not just asan. |
| 7 | // XFAIL: msan |
| 8 | // XFAIL: lsan |
| 9 | // XFAIL: tsan |
| 10 | #include <assert.h> |
| 11 | #include <stdio.h> |
| 12 | #include <sanitizer/asan_interface.h> |
| 13 | |
| 14 | void death() { |
| 15 | fprintf(stderr, "DEATH CALLBACK\n"); |
| 16 | } |
| 17 | |
| 18 | int main(int argc, char **argv) { |
| 19 | __sanitizer_set_death_callback(death); |
| 20 | assert(argc == 100); |
| 21 | } |
| 22 | // CHECK1: ERROR: {{.*}}Sanitizer: |
| 23 | // CHECK1: DEATH CALLBACK |
| 24 | // CHECK0-NOT: Sanitizer |