1 // REQUIRES: crash-recovery, shell
3 // FIXME: This XFAIL is cargo-culted from crash-report.c. Do we need it?
4 // XFAIL: target={{.*-windows-gnu}}
7 // RUN: mkdir -p %t/i %t/m %t
9 // RUN: env FORCE_CLANG_DIAGNOSTICS_CRASH= TMPDIR=%t TEMP=%t TMP=%t \
10 // RUN: not %clang -fsyntax-only -nostdinc %s \
11 // RUN: -I %S/Inputs/crash-recovery/usr/include -isysroot %/t/i/ \
12 // RUN: -fmodules -fmodules-cache-path=%t/m/ 2>&1 | FileCheck %s
14 // RUN: FileCheck --check-prefix=CHECKSRC %s -input-file %t/crash-vfs-*.m
15 // RUN: FileCheck --check-prefix=CHECKSH %s -input-file %t/crash-vfs-*.sh
16 // RUN: FileCheck --check-prefix=CHECKYAML %s -input-file \
17 // RUN: %t/crash-vfs-*.cache/vfs/vfs.yaml
18 // RUN: find %t/crash-vfs-*.cache/vfs | \
19 // RUN: grep "Inputs/crash-recovery/usr/include/stdio.h" | count 1
23 // CHECK: Preprocessed source(s) and associated run script(s) are located at:
24 // CHECK-NEXT: note: diagnostic msg: {{.*}}.m
25 // CHECK-NEXT: note: diagnostic msg: {{.*}}.cache
27 // CHECKSRC: #pragma clang module import cstd.stdio
29 // CHECKSH: # Crash reproducer
30 // CHECKSH-NEXT: # Driver args: "-fsyntax-only"
31 // CHECKSH-NEXT: # Original command: {{.*$}}
32 // CHECKSH-NEXT: "-cc1"
33 // CHECKSH: "-resource-dir"
34 // CHECKSH: "-isysroot" "{{[^"]*}}/i/"
35 // CHECKSH: "crash-vfs-{{[^ ]*}}.m"
36 // CHECKSH: "-ivfsoverlay" "crash-vfs-{{[^ ]*}}.cache/vfs/vfs.yaml"
37 // CHECKSH: "-fmodules-cache-path=crash-vfs-{{[^ ]*}}.cache/repro-modules"
39 // CHECKYAML: 'case-sensitive':
40 // CHECKYAML-NEXT: 'use-external-names': 'false',
41 // CHECKYAML-NEXT: 'overlay-relative': 'true',
42 // CHECKYAML: 'type': 'directory'
43 // CHECKYAML: 'name': "/[[PATH:.*]]/Inputs/crash-recovery/usr/include",
44 // CHECKYAML-NEXT: 'contents': [
46 // CHECKYAML-NEXT: 'type': 'file',
47 // CHECKYAML-NEXT: 'name': "module.modulemap",
48 // CHECKYAML-NOT: 'external-contents': "{{[^ ]*}}.cache
49 // CHECKYAML-NEXT: 'external-contents': "/[[PATH]]/Inputs/crash-recovery/usr/include/module.modulemap"
52 // Test that reading the YAML file will yield the correct path after
53 // the overlay dir is prefixed to access headers in .cache/vfs directory.
55 // RUN: unset FORCE_CLANG_DIAGNOSTICS_CRASH
56 // RUN: %clang -E %s -I %S/Inputs/crash-recovery/usr/include -isysroot %/t/i/ \
57 // RUN: -ivfsoverlay %t/crash-vfs-*.cache/vfs/vfs.yaml -fmodules \
58 // RUN: -fmodules-cache-path=%t/m/ 2>&1 \
59 // RUN: | FileCheck %s --check-prefix=CHECKOVERLAY
61 // CHECKOVERLAY: #pragma clang module import cstd.stdio /* clang -E: implicit import