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