71 lines · plain
1// Needs symlinks2// UNSUPPORTED: system-windows3// REQUIRES: crash-recovery4 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 the9// crash reproducer if there's a symbolic link component in the path.10 11// RUN: rm -rf %t12// RUN: mkdir -p %t/i %t/m %t %t/sysroot13// RUN: cp -R %S/Inputs/crash-recovery/usr %t/i/14// RUN: ln -s include/tcl-private %t/i/usr/x15 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 %s19 20// RUN: FileCheck --check-prefix=CHECKSRC %s -input-file %t/crash-vfs-*.m21// RUN: FileCheck --check-prefix=CHECKSH %s -input-file %t/crash-vfs-*.sh22// RUN: FileCheck --check-prefix=CHECKYAML %s -input-file \23// RUN: %t/crash-vfs-*.cache/vfs/vfs.yaml24// RUN: find %t/crash-vfs-*.cache/vfs | \25// RUN: grep "usr/include/stdio.h" | count 126 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: {{.*}}.m31// CHECK-NEXT: note: diagnostic msg: {{.*}}.cache32 33// CHECKSRC: #pragma clang module import cstd.stdio34 35// CHECKSH: # Crash reproducer36// 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 the59// right files inside the overlay and map the virtual request for a path that60// previously contained a symlink to work. To make sure of this, wipe out the61// %/t/i directory containing the symlink component.62 63// RUN: rm -rf %/t/i64// 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=CHECKOVERLAY69 70// CHECKOVERLAY: #pragma clang module import cstd.stdio /* clang -E: implicit import71