30 lines · cpp
1// UNSUPPORTED: ios2// We can reduce the scope of this test to check that we set the crash reporter3// buffers correctly instead of reading from the crashlog.4// For now, disable this test.5// REQUIRES: rdar_745442826// REQUIRES: expensive7// Check that ASan reports on OS X actually crash the process (abort_on_error=1)8// and that crash is logged via the crash reporter with ASan logs in the9// Application Specific Information section of the log.10 11// RUN: %clangxx_asan %s -o %t12 13// crash hard so the crashlog is created.14// RUN: %env_asan_opts=abort_on_error=1 not --crash %run %t > %t.process_output.txt 2>&115// RUN: %print_crashreport_for_pid --binary-filename=%basename_t.tmp \16// RUN: --pid=$(%get_pid_from_output --infile=%t.process_output.txt) \17// RUN: | FileCheck %s --check-prefixes CHECK-CRASHLOG18 19#include <stdlib.h>20int main() {21 char *x = (char *)malloc(10 * sizeof(char));22 free(x);23 return x[5];24 // needs to crash hard so the crashlog exists...25 // CHECK-CRASHLOG: {{.*Application Specific Information:}}26 // CHECK-CRASHLOG-NEXT: {{=====}}27 // CHECK-CRASHLOG-NEXT: {{.*ERROR: AddressSanitizer: heap-use-after-free on address}}28 // CHECK-CRASHLOG: {{abort()}}29}30