1// REQUIRES: crash-recovery, shell 2 3// FIXME: This XFAIL is cargo-culted from crash-report.c. Do we need it? 4// XFAIL: mingw32 5 6// RUN: rm -rf %t 7// RUN: mkdir -p %t/i %t/m %t 8 9// RUN: not env FORCE_CLANG_DIAGNOSTICS_CRASH= TMPDIR=%t TEMP=%t TMP=%t \ 10// RUN: %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 13 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 20 21#include <stdio.h> 22 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 26 27// CHECKSRC: @import cstd.stdio; 28 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/modules" 38 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': [ 45// CHECKYAML-NEXT: { 46// CHECKYAML-NEXT: 'type': 'file', 47// CHECKYAML-NEXT: 'name': "module.map", 48// CHECKYAML-NOT: 'external-contents': "{{[^ ]*}}.cache 49// CHECKYAML-NEXT: 'external-contents': "/[[PATH]]/Inputs/crash-recovery/usr/include/module.map" 50// CHECKYAML-NEXT: }, 51 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. 54 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 60 61// CHECKOVERLAY: @import cstd.stdio; /* clang -E: implicit import for "/{{[^ ].*}}/usr/include/stdio.h" */ 62