26 lines · cpp
1// Test the handle_abort option.2 3// RUN: %clangxx %s -o %t4// RUN: not --crash %run %t 2>&1 | FileCheck --check-prefix=CHECK0 %s5// RUN: %env_tool_opts=handle_abort=0 not --crash %run %t 2>&1 | FileCheck --check-prefix=CHECK0 %s6// RUN: %env_tool_opts=handle_abort=1 not %run %t 2>&1 | FileCheck --check-prefix=CHECK1 %s7 8#include <assert.h>9#include <stdio.h>10#include <sanitizer/asan_interface.h>11 12void death() {13 fprintf(stderr, "DEATH CALLBACK\n");14}15 16int main(int argc, char **argv) {17 __sanitizer_set_death_callback(death);18 assert(argc == 100);19}20 21// CHECK0-NOT: Sanitizer:DEADLYSIGNAL22// CHECK1: ERROR: {{.*}}Sanitizer: ABRT23// CHECK1: {{ #0 }}24// CHECK1: DEATH CALLBACK25// CHECK0-NOT: Sanitizer26