1// REQUIRES: crash-recovery, system-darwin
2// RUN: rm -rf %t
3// RUN: mkdir -p %t/i %t/m %t
4
5// RUN: env FORCE_CLANG_DIAGNOSTICS_CRASH= TMPDIR=%t TEMP=%t TMP=%t \
6// RUN: not %clang -fsyntax-only %s \
7// RUN:   -I %S/Inputs/module -isysroot %/t/i/ \
8// RUN:   -fmodules -fmodules-cache-path=%t/m/ -DFOO=BAR 2>&1 | \
9// RUN:   FileCheck -check-prefix=CRASH_ENV %s
10
11// RUN: env TMPDIR=%t TEMP=%t TMP=%t \
12// RUN: not %clang -gen-reproducer -fsyntax-only %s \
13// RUN:   -I %S/Inputs/module -isysroot %/t/i/ \
14// RUN:   -fmodules -fmodules-cache-path=%t/m/ -DFOO=BAR 2>&1 | \
15// RUN:   FileCheck -check-prefix=CRASH_FLAG %s
16
17@import simple;
18const int x = MODULE_MACRO;
19
20// CRASH_ENV: failing because environment variable 'FORCE_CLANG_DIAGNOSTICS_CRASH' is set
21// CRASH_ENV: PLEASE submit a bug report to {{.*}} and include the crash backtrace, preprocessed source, and associated run script.
22// CRASH_ENV: Preprocessed source(s) and associated run script(s) are located at:
23// CRASH_ENV-NEXT: note: diagnostic msg: {{.*}}.m
24// CRASH_ENV-NEXT: note: diagnostic msg: {{.*}}.cache
25// CRASH_ENV-NEXT: note: diagnostic msg: {{.*}}.sh
26// CRASH_ENV-NEXT: note: diagnostic msg: Crash backtrace is located in
27// CRASH_ENV-NEXT: note: diagnostic msg: {{.*}}Library/Logs/DiagnosticReports{{.*}}
28
29// CRASH_FLAG: failing because '-gen-reproducer' is used
30// CRASH_FLAG: Preprocessed source(s) and associated run script(s) are located at:
31// CRASH_FLAG-NEXT: note: diagnostic msg: {{.*}}.m
32// CRASH_FLAG-NEXT: note: diagnostic msg: {{.*}}.cache
33// CRASH_FLAG-NEXT: note: diagnostic msg: {{.*}}.sh
34// CRASH_FLAG-NEXT: note: diagnostic msg: Crash backtrace is located in
35// CRASH_FLAG-NEXT: note: diagnostic msg: {{.*}}Library/Logs/DiagnosticReports{{.*}}
36