summaryrefslogtreecommitdiffstats
path: root/clang/test/Modules/crash-vfs-path-traversal.m
diff options
context:
space:
mode:
authorBruno Cardoso Lopes <bruno.cardoso@gmail.com>2016-02-22 18:41:09 +0000
committerBruno Cardoso Lopes <bruno.cardoso@gmail.com>2016-02-22 18:41:09 +0000
commit8c03c542002258ccf0197908904d5cb9767f2394 (patch)
tree3dba08bf7342f41f27b99c853223a3eb96e543f3 /clang/test/Modules/crash-vfs-path-traversal.m
parent956e6a0dc6146d9625fe58a20bdf16515b036505 (diff)
downloadbcm5719-llvm-8c03c542002258ccf0197908904d5cb9767f2394.tar.gz
bcm5719-llvm-8c03c542002258ccf0197908904d5cb9767f2394.zip
[VFS] Add 'overlay-relative' field to YAML files
The VFS overlay mapping between virtual paths and real paths is done through the 'external-contents' entries in YAML files, which contains hardcoded paths to the real files. When a module compilation crashes, headers are dumped into <name>.cache/vfs directory and are mapped via the <name>.cache/vfs/vfs.yaml. The script generated for reproduction uses -ivfsoverlay pointing to file to gather the mapping between virtual paths and files inside <name>.cache/vfs. Currently, we are only capable of reproducing such crashes in the same machine as they happen, because of the hardcoded paths in 'external-contents'. To be able to reproduce a crash in another machine, this patch introduces a new option in the VFS yaml file called 'overlay-relative'. When it's equal to 'true' it means that the provided path to the YAML file through the -ivfsoverlay option should also be used to prefix the final path for every 'external-contents'. Example, given the invocation snippet "... -ivfsoverlay <name>.cache/vfs/vfs.yaml" and the following entry in the yaml file: "overlay-relative": "true", "roots": [ ... "type": "directory", "name": "/usr/include", "contents": [ { "type": "file", "name": "stdio.h", "external-contents": "/usr/include/stdio.h" }, ... Here, a file manager request for virtual "/usr/include/stdio.h", that will map into real path "/<absolute_path_to>/<name>.cache/vfs/usr/include/stdio.h. This is a useful feature for debugging module crashes in machines other than the one where the error happened. Differential Revision: http://reviews.llvm.org/D17457 rdar://problem/24499339 llvm-svn: 261552
Diffstat (limited to 'clang/test/Modules/crash-vfs-path-traversal.m')
-rw-r--r--clang/test/Modules/crash-vfs-path-traversal.m7
1 files changed, 4 insertions, 3 deletions
diff --git a/clang/test/Modules/crash-vfs-path-traversal.m b/clang/test/Modules/crash-vfs-path-traversal.m
index 8acd2172265..75e484eda06 100644
--- a/clang/test/Modules/crash-vfs-path-traversal.m
+++ b/clang/test/Modules/crash-vfs-path-traversal.m
@@ -35,12 +35,12 @@
// CHECKSH: "-ivfsoverlay" "crash-vfs-{{[^ ]*}}.cache/vfs/vfs.yaml"
// CHECKYAML: 'type': 'directory'
-// CHECKYAML: 'name': "{{[^ ]*}}/Inputs/System/usr/include",
+// CHECKYAML: 'name': "/[[PATH:.*]]/Inputs/System/usr/include",
// CHECKYAML-NEXT: 'contents': [
// CHECKYAML-NEXT: {
// CHECKYAML-NEXT: 'type': 'file',
// CHECKYAML-NEXT: 'name': "module.map",
-// CHECKYAML-NEXT: 'external-contents': "{{[^ ]*}}/Inputs/System/usr/include/module.map"
+// CHECKYAML-NEXT: 'external-contents': "/[[PATH]]/Inputs/System/usr/include/module.map"
// CHECKYAML-NEXT: },
// Replace the paths in the YAML files with relative ".." traversals
@@ -49,9 +49,10 @@
// RUN: sed -e "s@usr/include@usr/include/../include@g" \
// RUN: %t/crash-vfs-*.cache/vfs/vfs.yaml > %t/vfs.yaml
+// RUN: cp %t/vfs.yaml %t/crash-vfs-*.cache/vfs/vfs.yaml
// RUN: unset FORCE_CLANG_DIAGNOSTICS_CRASH
// RUN: %clang -E %s -I %S/Inputs/System -isysroot %/t/i/ \
-// RUN: -ivfsoverlay %t/vfs.yaml -fmodules \
+// RUN: -ivfsoverlay %t/crash-vfs-*.cache/vfs/vfs.yaml -fmodules \
// RUN: -fmodules-cache-path=%t/m/ 2>&1 \
// RUN: | FileCheck %s --check-prefix=CHECKOVERLAY
OpenPOWER on IntegriCloud