1// Test the handle_abort option.
2
3// RUN: %clangxx %s -o %t
4// RUN: not --crash %run %t 2>&1 | FileCheck --check-prefix=CHECK0 %s
5// RUN: %env_tool_opts=handle_abort=0 not --crash %run %t 2>&1 | FileCheck --check-prefix=CHECK0 %s
6// RUN: %env_tool_opts=handle_abort=1 not %run %t 2>&1 | FileCheck --check-prefix=CHECK1 %s
7
8#include <assert.h>
9#include <stdio.h>
10#include <sanitizer/asan_interface.h>
11
12void death() {
13 fprintf(stderr, format: "DEATH CALLBACK\n");
14}
15
16int main(int argc, char **argv) {
17 __sanitizer_set_death_callback(callback: death);
18 assert(argc == 100);
19}
20
21// CHECK0-NOT: Sanitizer:DEADLYSIGNAL
22// CHECK1: ERROR: {{.*}}Sanitizer: ABRT
23// CHECK1: {{ #0 }}
24// CHECK1: DEATH CALLBACK
25// CHECK0-NOT: Sanitizer
26

source code of compiler-rt/test/sanitizer_common/TestCases/Linux/assert.cpp