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
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
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
death()14 void death() {
15 fprintf(stderr, "DEATH CALLBACK\n");
16 }
17
main(int argc,char ** argv)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
25