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}}
6 // Test clang can collect symbolic link headers used in modules.
7 // crash reproducer if there's a symbolic link header file used in a module.
10 // RUN: mkdir -p %t/i %t/m %t %t/sysroot
11 // RUN: cp -R %S/Inputs/crash-recovery/usr %t/i/
12 // RUN: rm -f %t/i/usr/include/pthread_impl.h
13 // RUN: ln -s pthread/pthread_impl.h %t/i/usr/include/pthread_impl.h
15 // RUN: env FORCE_CLANG_DIAGNOSTICS_CRASH= TMPDIR=%t TEMP=%t TMP=%t \
16 // RUN: not %clang -fsyntax-only %s -I %/t/i -isysroot %/t/sysroot/ \
17 // RUN: -fmodules -fmodules-cache-path=%t/m/ 2>&1 | FileCheck %s
19 // RUN: FileCheck --check-prefix=CHECKSRC %s -input-file %t/crash-vfs-*.m
20 // RUN: FileCheck --check-prefix=CHECKSH %s -input-file %t/crash-vfs-*.sh
21 // RUN: FileCheck --check-prefix=CHECKYAML %s -input-file \
22 // RUN: %t/crash-vfs-*.cache/vfs/vfs.yaml
23 // RUN: find %t/crash-vfs-*.cache/vfs | \
24 // RUN: grep "usr/include/pthread_impl.h" | count 1
26 #include "usr/include/stdio.h"
28 // CHECK: Preprocessed source(s) and associated run script(s) are located at:
29 // CHECK-NEXT: note: diagnostic msg: {{.*}}.m
30 // CHECK-NEXT: note: diagnostic msg: {{.*}}.cache
32 // CHECKSRC: #pragma clang module import cstd.stdio
34 // CHECKSH: # Crash reproducer
35 // CHECKSH-NEXT: # Driver args: "-fsyntax-only"
36 // CHECKSH-NEXT: # Original command: {{.*$}}
37 // CHECKSH-NEXT: "-cc1"
38 // CHECKSH: "-isysroot" "{{[^"]*}}/sysroot/"
39 // CHECKSH-NOT: "-fmodules-cache-path="
40 // CHECKSH: "crash-vfs-{{[^ ]*}}.m"
41 // CHECKSH: "-ivfsoverlay" "crash-vfs-{{[^ ]*}}.cache/vfs/vfs.yaml"
42 // CHECKSH: "-fmodules-cache-path=crash-vfs-{{[^ ]*}}.cache/repro-modules"
44 // CHECKYAML: 'type': 'directory',
45 // CHECKYAML: 'name': "",
46 // CHECKYAML-NEXT: 'contents': [
48 // CHECKYAML-NEXT: 'type': 'file',
49 // CHECKYAML-NEXT: 'name': "pthread_impl.h",
50 // CHECKYAML-NEXT: 'external-contents': "/{{.*}}/i/usr/include/pthread_impl.h"