diff options
Diffstat (limited to 'test/VFS')
-rw-r--r-- | test/VFS/Inputs/Broken.framework/Headers/Error.h | 3 | ||||
-rw-r--r-- | test/VFS/Inputs/Broken.framework/Modules/module.modulemap | 6 | ||||
-rw-r--r-- | test/VFS/Inputs/Broken.framework/VFSHeaders/A.h | 1 | ||||
-rw-r--r-- | test/VFS/Inputs/MissingVFS/vfsoverlay.yaml | 1 | ||||
-rw-r--r-- | test/VFS/Inputs/Nonmodular/nonmodular-headers.yaml | 1 | ||||
-rw-r--r-- | test/VFS/Inputs/bar-headers.yaml | 1 | ||||
-rw-r--r-- | test/VFS/Inputs/vfsoverlay2.yaml | 1 | ||||
-rw-r--r-- | test/VFS/Inputs/vfsroot.yaml | 55 | ||||
-rw-r--r-- | test/VFS/subframework-symlink.m | 23 | ||||
-rw-r--r-- | test/VFS/umbrella-framework-import-skipnonexist.m | 2 | ||||
-rw-r--r-- | test/VFS/vfsroot-include.c | 17 | ||||
-rw-r--r-- | test/VFS/vfsroot-module.m | 10 | ||||
-rw-r--r-- | test/VFS/vfsroot-with-overlay.c | 12 |
13 files changed, 128 insertions, 5 deletions
diff --git a/test/VFS/Inputs/Broken.framework/Headers/Error.h b/test/VFS/Inputs/Broken.framework/Headers/Error.h new file mode 100644 index 0000000000000..12352dd19a544 --- /dev/null +++ b/test/VFS/Inputs/Broken.framework/Headers/Error.h @@ -0,0 +1,3 @@ +// Error.h + +#error Should not include this header in a module diff --git a/test/VFS/Inputs/Broken.framework/Modules/module.modulemap b/test/VFS/Inputs/Broken.framework/Modules/module.modulemap new file mode 100644 index 0000000000000..5d033c635a5ed --- /dev/null +++ b/test/VFS/Inputs/Broken.framework/Modules/module.modulemap @@ -0,0 +1,6 @@ +framework module Broken [extern_c] { + umbrella "Headers" + export * + module * { export * } +} + diff --git a/test/VFS/Inputs/Broken.framework/VFSHeaders/A.h b/test/VFS/Inputs/Broken.framework/VFSHeaders/A.h new file mode 100644 index 0000000000000..975f1f0437bb1 --- /dev/null +++ b/test/VFS/Inputs/Broken.framework/VFSHeaders/A.h @@ -0,0 +1 @@ +// A.h diff --git a/test/VFS/Inputs/MissingVFS/vfsoverlay.yaml b/test/VFS/Inputs/MissingVFS/vfsoverlay.yaml index 49517a1590803..cb74879bafa27 100644 --- a/test/VFS/Inputs/MissingVFS/vfsoverlay.yaml +++ b/test/VFS/Inputs/MissingVFS/vfsoverlay.yaml @@ -1,6 +1,5 @@ { 'version': 0, - 'ignore-non-existent-contents': false, 'roots': [ { 'name': 'INPUT_DIR', 'type': 'directory', 'contents': [ diff --git a/test/VFS/Inputs/Nonmodular/nonmodular-headers.yaml b/test/VFS/Inputs/Nonmodular/nonmodular-headers.yaml index a041728752280..7ccddd2d2f82b 100644 --- a/test/VFS/Inputs/Nonmodular/nonmodular-headers.yaml +++ b/test/VFS/Inputs/Nonmodular/nonmodular-headers.yaml @@ -1,7 +1,6 @@ { 'version': 0, 'case-sensitive': 'false', - 'ignore-non-existent-contents': 'true', 'roots': [ { 'type': 'directory', diff --git a/test/VFS/Inputs/bar-headers.yaml b/test/VFS/Inputs/bar-headers.yaml index 846d55cc9ecec..710e6cb060073 100644 --- a/test/VFS/Inputs/bar-headers.yaml +++ b/test/VFS/Inputs/bar-headers.yaml @@ -1,7 +1,6 @@ { 'version': 0, 'case-sensitive': 'false', - 'ignore-non-existent-contents': 'true', 'roots': [ { 'type': 'directory', diff --git a/test/VFS/Inputs/vfsoverlay2.yaml b/test/VFS/Inputs/vfsoverlay2.yaml index 688ae643df031..ae2a0ce4ec98f 100644 --- a/test/VFS/Inputs/vfsoverlay2.yaml +++ b/test/VFS/Inputs/vfsoverlay2.yaml @@ -1,6 +1,5 @@ { 'version': 0, - 'ignore-non-existent-contents': false, 'roots': [ { 'name': 'OUT_DIR', 'type': 'directory', 'contents': [ diff --git a/test/VFS/Inputs/vfsroot.yaml b/test/VFS/Inputs/vfsroot.yaml new file mode 100644 index 0000000000000..0b00692b64510 --- /dev/null +++ b/test/VFS/Inputs/vfsroot.yaml @@ -0,0 +1,55 @@ +{ + 'version': 0, + 'use-external-names': false, + 'fallthrough': false, + 'roots': [ + { 'name': '/tests', 'type': 'directory', + 'contents': [ + { 'name': 'vfsroot-include.c', 'type': 'file', + 'external-contents': 'TEST_DIR/vfsroot-include.c' + }, + { 'name': 'vfsroot-with-overlay.c', 'type': 'file', + 'external-contents': 'TEST_DIR/vfsroot-with-overlay.c' + }, + { 'name': 'vfsroot-module.m', 'type': 'file', + 'external-contents': 'TEST_DIR/vfsroot-module.m' + } + ] + }, + { 'name': '/direct-vfs-root-files', 'type': 'directory', + 'contents': [ + { 'name': 'not_real.h', 'type': 'file', + 'external-contents': 'TEST_DIR/Inputs/actual_header.h' + }, + { 'name': 'vfsoverlay.yaml', 'type': 'file', + 'external-contents': 'OUT_DIR/vfsoverlay.yaml' + } + ] + }, + { 'name': '/indirect-vfs-root-files', 'type': 'directory', + 'contents': [ + { 'name': 'actual_header.h', 'type': 'file', + 'external-contents': 'TEST_DIR/Inputs/actual_header.h' + } + ] + }, + { 'name': 'TEST_DIR/Inputs/Broken.framework', 'type': 'directory', + 'contents': [ + { 'name': 'Headers/A.h', 'type': 'file', + 'external-contents': 'TEST_DIR/Inputs/Broken.framework/VFSHeaders/A.h' + }, + { 'name': 'Modules/module.modulemap', 'type': 'file', + 'external-contents': 'TEST_DIR/Inputs/Broken.framework/Modules/module.modulemap' + } + ] + }, + # Locations for modules. + { 'name': 'OUT_DIR/cache', 'type': 'directory', + 'contents': [ + { 'name': 'Broken.pcm', 'type': 'file', + 'external-contents': 'OUT_DIR/cache/Broken.pcm' + } + ] + } + ] +} diff --git a/test/VFS/subframework-symlink.m b/test/VFS/subframework-symlink.m new file mode 100644 index 0000000000000..1c6fd06409383 --- /dev/null +++ b/test/VFS/subframework-symlink.m @@ -0,0 +1,23 @@ +// REQUIRES: shell + +// Test that when a subframework is a symlink to another framework, we don't +// add it as a submodule to the enclosing framework. We also need to make clang +// to infer module for the enclosing framework. For this we don't have +// a module map for the framework itself but have it in a parent directory. +// +// RUN: rm -rf %t +// RUN: mkdir %t +// RUN: echo 'framework module * {}' > %t/module.modulemap +// RUN: mkdir -p %t/WithSubframework.framework/Headers +// RUN: echo '#include <Foo/Foo.h>' > %t/WithSubframework.framework/Headers/WithSubframework.h +// RUN: cp -R %S/Inputs/Foo.framework %t +// RUN: mkdir -p %t/WithSubframework.framework/Frameworks +// RUN: ln -s %t/Foo.framework %t/WithSubframework.framework/Frameworks +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t/cache1 -F %t -fsyntax-only %s + +// Adding VFS overlay shouldn't change this behavior. +// +// RUN: sed -e "s:INPUT_DIR:/InvalidPath:g" -e "s:OUT_DIR:/InvalidPath:g" %S/Inputs/vfsoverlay.yaml > %t/overlay.yaml +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t/cache2 -F %t -fsyntax-only %s -ivfsoverlay %t/overlay.yaml + +#import <WithSubframework/WithSubframework.h> diff --git a/test/VFS/umbrella-framework-import-skipnonexist.m b/test/VFS/umbrella-framework-import-skipnonexist.m index 129f475fe7743..2f148cee7e2d3 100644 --- a/test/VFS/umbrella-framework-import-skipnonexist.m +++ b/test/VFS/umbrella-framework-import-skipnonexist.m @@ -1,7 +1,7 @@ // REQUIRES: crash-recovery, shell // FIXME: This XFAIL is cargo-culted from crash-report.c. Do we need it? -// XFAIL: mingw32 +// XFAIL: windows-gnu // RUN: rm -rf %t // RUN: mkdir -p %t/vdir %t/outdir %t/cache diff --git a/test/VFS/vfsroot-include.c b/test/VFS/vfsroot-include.c new file mode 100644 index 0000000000000..7ccd9d705ec32 --- /dev/null +++ b/test/VFS/vfsroot-include.c @@ -0,0 +1,17 @@ +// REQUIRES: shell +// RUN: rm -rf %t +// RUN: mkdir -p %t +// RUN: sed -e "s:TEST_DIR:%S:g" -e "s:OUT_DIR:%t:g" %S/Inputs/vfsroot.yaml > %t.yaml +// RUN: not %clang_cc1 -Werror -ivfsoverlay %t.yaml -I %S/Inputs -I /direct-vfs-root-files -fsyntax-only /tests/vfsroot-include.c 2>&1 | FileCheck %s +// The line above tests that the compiler input file is looked up through VFS. + +// Test successful include through the VFS. +#include "not_real.h" + +// Test that a file missing from the VFS root is not found, even if it is +// discoverable through the real file system. Fatal error should be the last +// in the file as it hides other errors. +#include "actual_header.h" +// CHECK: fatal error: 'actual_header.h' file not found +// CHECK: 1 error generated. +// CHECK-NOT: error diff --git a/test/VFS/vfsroot-module.m b/test/VFS/vfsroot-module.m new file mode 100644 index 0000000000000..22822cf5a5e66 --- /dev/null +++ b/test/VFS/vfsroot-module.m @@ -0,0 +1,10 @@ +// REQUIRES: shell +// RUN: rm -rf %t +// RUN: mkdir -p %t +// RUN: sed -e "s:TEST_DIR:%S:g" -e "s:OUT_DIR:%t:g" %S/Inputs/vfsroot.yaml > %t.yaml +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fdisable-module-hash -fmodules-cache-path=%t/cache -ivfsoverlay %t.yaml -F %S/Inputs -fsyntax-only /tests/vfsroot-module.m + +// Test that a file missing from the VFS root is not found, even if it is +// discoverable through the real file system at location that is a part of +// the framework. +@import Broken; diff --git a/test/VFS/vfsroot-with-overlay.c b/test/VFS/vfsroot-with-overlay.c new file mode 100644 index 0000000000000..6becb6abce1ec --- /dev/null +++ b/test/VFS/vfsroot-with-overlay.c @@ -0,0 +1,12 @@ +// REQUIRES: shell +// RUN: rm -rf %t +// RUN: mkdir -p %t +// RUN: sed -e "s:TEST_DIR:%S:g" -e "s:OUT_DIR:%t:g" %S/Inputs/vfsroot.yaml > %t.yaml +// RUN: sed -e "s:INPUT_DIR:/indirect-vfs-root-files:g" -e "s:OUT_DIR:/overlay-dir:g" %S/Inputs/vfsoverlay.yaml > %t/vfsoverlay.yaml +// RUN: %clang_cc1 -Werror -ivfsoverlay %t.yaml -ivfsoverlay /direct-vfs-root-files/vfsoverlay.yaml -I /overlay-dir -fsyntax-only /tests/vfsroot-with-overlay.c + +#include "not_real.h" + +void foo() { + bar(); +} |