From 7442d6faa2719e4e7d33a7021c406c5a4facd74d Mon Sep 17 00:00:00 2001 From: Dimitry Andric Date: Sun, 16 Apr 2017 16:02:28 +0000 Subject: Vendor import of clang trunk r300422: https://llvm.org/svn/llvm-project/cfe/trunk@300422 --- test/Modules/modules-cache-path-canonicalization.m | 30 ++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 test/Modules/modules-cache-path-canonicalization.m (limited to 'test/Modules/modules-cache-path-canonicalization.m') diff --git a/test/Modules/modules-cache-path-canonicalization.m b/test/Modules/modules-cache-path-canonicalization.m new file mode 100644 index 0000000000000..9d68cb06faf8e --- /dev/null +++ b/test/Modules/modules-cache-path-canonicalization.m @@ -0,0 +1,30 @@ +// RUN: rm -rf %t/cache %T/rel + +// This testcase reproduces a use-after-free after looking up a PCM in +// a non-canonical modules-cache-path. +// +// Prime the module cache (note the '.' in the path). +// RUN: %clang_cc1 -fdisable-module-hash -fmodules-cache-path=%t/./cache \ +// RUN: -fmodules -fimplicit-module-maps -I %S/Inputs/outofdate-rebuild \ +// RUN: %s -fsyntax-only +// +// Force a module to be rebuilt by creating a conflict. +// RUN: echo "@import CoreText;" > %t.m +// RUN: %clang_cc1 -DMISMATCH -Werror -fdisable-module-hash \ +// RUN: -fmodules-cache-path=%t/./cache -fmodules -fimplicit-module-maps \ +// RUN: -I %S/Inputs/outofdate-rebuild %t.m -fsyntax-only +// +// Rebuild. +// RUN: %clang_cc1 -fdisable-module-hash -fmodules-cache-path=%t/./cache \ +// RUN: -fmodules -fimplicit-module-maps -I %S/Inputs/outofdate-rebuild \ +// RUN: %s -fsyntax-only + + +// Unrelated to the above: Check that a relative path is resolved correctly. +// +// RUN: %clang_cc1 -working-directory %T/rel -fmodules-cache-path=./cache \ +// RUN: -fmodules -fimplicit-module-maps -I %S/Inputs/outofdate-rebuild \ +// RUN: -fdisable-module-hash %t.m -fsyntax-only -Rmodule-build 2>&1 \ +// RUN: | FileCheck %s +// CHECK: {{/|\\}}rel{{/|\\}}cache{{/|\\}}CoreText.pcm +@import Cocoa; -- cgit v1.2.3