blob: 5d58ea4f7e81824b3737e1ea158a5e22dcb606d3 [file] [log] [blame]
Pirama Arumuga Nainarcdce50b2015-07-01 12:26:56 -07001// 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 Nainar799172d2016-03-03 15:50:30 -08004// 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 Nainarcdce50b2015-07-01 12:26:56 -07006// 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
14void death() {
15 fprintf(stderr, "DEATH CALLBACK\n");
16}
17
18int 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