| 1 |
// Needs symlinks |
| 2 |
// UNSUPPORTED: system-windows |
| 3 |
// REQUIRES: crash-recovery |
| 4 |
|
| 5 |
// FIXME: This XFAIL is cargo-culted from crash-report.c. Do we need it? |
| 6 |
// XFAIL: target={{.*-windows-gnu}} |
| 7 |
|
| 8 |
// Test that clang is capable of collecting the right header files in the |
| 9 |
// crash reproducer if there's a symbolic link component in the path. |
| 10 |
|
| 11 |
// RUN: rm -rf %t |
| 12 |
// RUN: mkdir -p %t/i %t/m %t %t/sysroot |
| 13 |
// RUN: cp -R %S/Inputs/crash-recovery/usr %t/i/ |
| 14 |
// RUN: ln -s include/tcl-private %t/i/usr/x |
| 15 |
|
| 16 |
// RUN: env FORCE_CLANG_DIAGNOSTICS_CRASH= TMPDIR=%t TEMP=%t TMP=%t \ |
| 17 |
// RUN: not %clang -fsyntax-only %s -I %/t/i -isysroot %/t/sysroot/ \ |
| 18 |
// RUN: -fmodules -fmodules-cache-path=%t/m/ 2>&1 | FileCheck %s |
| 19 |
|
| 20 |
// RUN: FileCheck --check-prefix=CHECKSRC %s -input-file %t/crash-vfs-*.m |
| 21 |
// RUN: FileCheck --check-prefix=CHECKSH %s -input-file %t/crash-vfs-*.sh |
| 22 |
// RUN: FileCheck --check-prefix=CHECKYAML %s -input-file \ |
| 23 |
// RUN: %t/crash-vfs-*.cache/vfs/vfs.yaml |
| 24 |
// RUN: find %t/crash-vfs-*.cache/vfs | \ |
| 25 |
// RUN: grep "usr/include/stdio.h" | count 1 |
| 26 |
|
| 27 |
#include "usr/x/../stdio.h" |
| 28 |
|
| 29 |
// CHECK: Preprocessed source(s) and associated run script(s) are located at: |
| 30 |
// CHECK-NEXT: note: diagnostic msg: {{.*}}.m |
| 31 |
// CHECK-NEXT: note: diagnostic msg: {{.*}}.cache |
| 32 |
|
| 33 |
// CHECKSRC: #pragma clang module import cstd.stdio |
| 34 |
|
| 35 |
// CHECKSH: # Crash reproducer |
| 36 |
// CHECKSH-NEXT: # Driver args: "-fsyntax-only" |
| 37 |
// CHECKSH-NEXT: # Original command: {{.*$}} |
| 38 |
// CHECKSH-NEXT: "-cc1" |
| 39 |
// CHECKSH: "-isysroot" "{{[^"]*}}/sysroot/" |
| 40 |
// CHECKSH-NOT: "-fmodules-cache-path=" |
| 41 |
// CHECKSH: "crash-vfs-{{[^ ]*}}.m" |
| 42 |
// CHECKSH: "-ivfsoverlay" "crash-vfs-{{[^ ]*}}.cache/vfs/vfs.yaml" |
| 43 |
// CHECKSH: "-fmodules-cache-path=crash-vfs-{{[^ ]*}}.cache/repro-modules" |
| 44 |
|
| 45 |
// CHECKYAML: 'case-sensitive': |
| 46 |
// CHECKYAML-NEXT: 'use-external-names': 'false', |
| 47 |
// CHECKYAML-NEXT: 'overlay-relative': 'true', |
| 48 |
|
| 49 |
// CHECKYAML: 'type': 'directory' |
| 50 |
// CHECKYAML: 'name': "/[[PATH:.*]]/i/usr", |
| 51 |
// CHECKYAML-NEXT: 'contents': [ |
| 52 |
// CHECKYAML-NEXT: { |
| 53 |
// CHECKYAML-NEXT: 'type': 'file', |
| 54 |
// CHECKYAML-NEXT: 'name': "module.modulemap", |
| 55 |
// CHECKYAML-NEXT: 'external-contents': "/[[PATH]]/i/usr/include/module.modulemap" |
| 56 |
// CHECKYAML-NEXT: }, |
| 57 |
|
| 58 |
// Test that by using the previous generated YAML file clang is able to find the |
| 59 |
// right files inside the overlay and map the virtual request for a path that |
| 60 |
// previously contained a symlink to work. To make sure of this, wipe out the |
| 61 |
// %/t/i directory containing the symlink component. |
| 62 |
|
| 63 |
// RUN: rm -rf %/t/i |
| 64 |
// RUN: env -u FORCE_CLANG_DIAGNOSTICS_CRASH \ |
| 65 |
// RUN: %clang -E %s -I %/t/i -isysroot %/t/sysroot/ \ |
| 66 |
// RUN: -ivfsoverlay %t/crash-vfs-*.cache/vfs/vfs.yaml -fmodules \ |
| 67 |
// RUN: -fmodules-cache-path=%t/m/ 2>&1 \ |
| 68 |
// RUN: | FileCheck %s --check-prefix=CHECKOVERLAY |
| 69 |
|
| 70 |
// CHECKOVERLAY: #pragma clang module import cstd.stdio /* clang -E: implicit import |