Debian Codegraph @

clang/test/Modules/crash-vfs-relative-overlay.m

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