[docs] Add LICENSE.txt to the root of the mono-repo
[llvm-project.git] / clang / test / Driver / crash-report-with-asserts.c
blob7a614aa8fe0250feba471b322e511d1505ab0473
1 // RUN: rm -rf %t
2 // RUN: mkdir %t
4 // RUN: echo '-fsyntax-only \
5 // RUN: -F/tmp/ -I /tmp/ -idirafter /tmp/ -iquote /tmp/ -isystem /tmp/ \
6 // RUN: -iprefix /the/prefix -iwithprefix /tmp -iwithprefixbefore /tmp/ \
7 // RUN: -Xclang -internal-isystem -Xclang /tmp/ \
8 // RUN: -Xclang -internal-externc-isystem -Xclang /tmp/ \
9 // RUN: -Xclang -main-file-name -Xclang foo.c \
10 // RUN: -DFOO=BAR -DBAR="BAZ QUX"' > %t.rsp
12 // RUN: env TMPDIR=%t TEMP=%t TMP=%t RC_DEBUG_OPTIONS=1 \
13 // RUN: CC_PRINT_HEADERS=1 CC_LOG_DIAGNOSTICS=1 \
14 // RUN: not %clang %s @%t.rsp -DASSERT 2>&1 | FileCheck %s
15 // RUN: cat %t/crash-report-*.c | FileCheck --check-prefix=CHECKSRC %s
16 // RUN: cat %t/crash-report-*.sh | FileCheck --check-prefix=CHECKSH %s
18 // RUN: env TMPDIR=%t TEMP=%t TMP=%t RC_DEBUG_OPTIONS=1 \
19 // RUN: CC_PRINT_HEADERS=1 CC_LOG_DIAGNOSTICS=1 \
20 // RUN: not %clang %s @%t.rsp -DUNREACHABLE 2>&1 | FileCheck %s
21 // RUN: cat %t/crash-report-with-asserts-*.c | FileCheck --check-prefix=CHECKSRC %s
22 // RUN: cat %t/crash-report-with-asserts-*.sh | FileCheck --check-prefix=CHECKSH %s
24 // REQUIRES: crash-recovery, asserts
26 #ifdef ASSERT
27 #pragma clang __debug assert
28 #elif UNREACHABLE
29 #pragma clang __debug llvm_unreachable
30 #endif
32 // CHECK: Preprocessed source(s) and associated run script(s) are located at:
33 // CHECK-NEXT: note: diagnostic msg: {{.*}}crash-report-with-asserts-{{.*}}.c
34 FOO
35 // CHECKSRC: FOO
36 // CHECKSH: # Crash reproducer
37 // CHECKSH-NEXT: # Driver args: {{.*}}"-fsyntax-only"
38 // CHECKSH-SAME: "-D" "FOO=BAR"
39 // CHECKSH-SAME: "-D" "BAR=BAZ QUX"
40 // CHECKSH-NEXT: # Original command: {{.*$}}
41 // CHECKSH-NEXT: "-cc1"
42 // CHECKSH: "-main-file-name" "crash-report-with-asserts.c"
43 // CHECKSH-NOT: "-header-include-file"
44 // CHECKSH-NOT: "-diagnostic-log-file"
45 // CHECKSH: "-D" "FOO=BAR"
46 // CHECKSH: "-D" "BAR=BAZ QUX"
47 // CHECKSH-NOT: "-F/tmp/"
48 // CHECKSH-NOT: "-I" "/tmp/"
49 // CHECKSH-NOT: "-idirafter" "/tmp/"
50 // CHECKSH-NOT: "-iquote" "/tmp/"
51 // CHECKSH-NOT: "-isystem" "/tmp/"
52 // CHECKSH-NOT: "-iprefix" "/the/prefix"
53 // CHECKSH-NOT: "-iwithprefix" "/tmp/"
54 // CHECKSH-NOT: "-iwithprefixbefore" "/tmp/"
55 // CHECKSH-NOT: "-internal-isystem" "/tmp/"
56 // CHECKSH-NOT: "-internal-externc-isystem" "/tmp/"
57 // CHECKSH-NOT: "-dwarf-debug-flags"
58 // CHECKSH: "crash-report-with-asserts-{{[^ ]*}}.c"