xref: /llvm-project/clang/test/Modules/crash-vfs-umbrella-frameworks.m (revision 7bca6f452f53a4a8d31a56b480e5b9fbaabad4fb)
1// REQUIRES: crash-recovery, shell
2
3// FIXME: This XFAIL is cargo-culted from crash-report.c. Do we need it?
4// XFAIL: target={{.*-windows-gnu}}
5
6// RUN: rm -rf %t
7// RUN: mkdir -p %t/i %t/m %t
8// RUN: cp -R %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: env FORCE_CLANG_DIAGNOSTICS_CRASH= TMPDIR=%t TEMP=%t TMP=%t \
13// RUN: not %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/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@import I;
35
36// Run the reproducer script - regular exit code is enough to test it works. The
37// intent here is to guarantee that the collect umbrella headers into the VFS
38// can be used, testing that vfs::recursive_directory_iterator is used correctly
39// Make sure to erase the include paths used to build the modules to guarantee
40// that the VFS overlay won't fallback to use it. Also wipe out the module cache
41// to force header search.
42//
43// RUN: cd %t
44// RUN: rm -rf i
45// RUN: rm -rf crash-vfs-umbrella-*.cache/modules/*
46// RUN: chmod 755 crash-vfs-*.sh
47// RUN: ./crash-vfs-*.sh
48