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// RUN: cp -a %S/Inputs/crash-recovery/Frameworks %t/i/
9// RUN: mkdir -p %t/i/Frameworks/A.framework/Frameworks
10// RUN: ln -s ../../B.framework %t/i/Frameworks/A.framework/Frameworks/B.framework
11
12// RUN: not env FORCE_CLANG_DIAGNOSTICS_CRASH= TMPDIR=%t TEMP=%t TMP=%t \
13// RUN: %clang -nostdinc -fsyntax-only %s \
14// RUN:     -F %/t/i/Frameworks -fmodules \
15// RUN:     -fmodules-cache-path=%t/m/ 2>&1 | FileCheck %s
16
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 "B.framework/Headers/B.h" | count 1
21
22// CHECK: Preprocessed source(s) and associated run script(s) are located at:
23// CHECK-NEXT: note: diagnostic msg: {{.*}}.m
24// CHECK-NEXT: note: diagnostic msg: {{.*}}.cache
25
26// CHECKYAML:      'type': 'directory',
27// CHECKYAML:      'name': "/[[PATH:.*]]/i/Frameworks/A.framework/Frameworks/B.framework/Headers",
28// CHECKYAML-NEXT:      'contents': [
29// CHECKYAML-NEXT:        {
30// CHECKYAML-NEXT:          'type': 'file',
31// CHECKYAML-NEXT:          'name': "B.h",
32// CHECKYAML-NEXT:          'external-contents': "/[[PATH]]/i/Frameworks/B.framework/Headers/B.h"
33
34// CHECKYAML:      'type': 'directory',
35// CHECKYAML:      'name': "/[[PATH]]/i/Frameworks/B.framework/Headers",
36// CHECKYAML-NEXT:      'contents': [
37// CHECKYAML-NEXT:        {
38// CHECKYAML-NEXT:          'type': 'file',
39// CHECKYAML-NEXT:          'name': "B.h",
40// CHECKYAML-NEXT:          'external-contents': "/[[PATH]]/i/Frameworks/B.framework/Headers/B.h"
41
42@import I;
43
44// Run the reproducer script - regular exit code is enough to test it works. The
45// intent here is to guarantee that the collect umbrella headers into the VFS
46// can be used, testing that vfs::recursive_directory_iterator is used correctly
47// Make sure to erase the include paths used to build the modules to guarantee
48// that the VFS overlay won't fallback to use it. Also wipe out the module cache
49// to force header search.
50//
51// RUN: cd %t
52// RUN: rm -rf i
53// RUN: rm -rf crash-vfs-umbrella-*.cache/modules/*
54// RUN: chmod 755 crash-vfs-*.sh
55// RUN: ./crash-vfs-*.sh
56