diff options
| author | Bruno Cardoso Lopes <bruno.cardoso@gmail.com> | 2016-12-09 02:22:47 +0000 |
|---|---|---|
| committer | Bruno Cardoso Lopes <bruno.cardoso@gmail.com> | 2016-12-09 02:22:47 +0000 |
| commit | e3a0aef2cf93c7dc144c52798aa5546dc5ec304b (patch) | |
| tree | 7556d541434f7d64902f2adcc3b79d7739fc4617 /clang/test | |
| parent | 2aeb4564257e16617d718c91550ee28854fd37ce (diff) | |
| download | bcm5719-llvm-e3a0aef2cf93c7dc144c52798aa5546dc5ec304b.tar.gz bcm5719-llvm-e3a0aef2cf93c7dc144c52798aa5546dc5ec304b.zip | |
[CrashReproducer] Rewrite relative include paths
When -fmodules is on, the reproducer invocation currently leave paths
for include-like flags as is. If the path is relative, the reproducer
doesn't know how to access that file during reproduction time because
the VFS cannot reason about relative paths.
Expand relative paths to absolute ones when creating the reproducer
command line. This allows, for example, the reproducer to work for
crashes while building clang with modules; this wasn't possible before
because building clang requires using relative inc dir from within the
build directory.
rdar://problem/28655070
llvm-svn: 289174
Diffstat (limited to 'clang/test')
| -rw-r--r-- | clang/test/Modules/crash-vfs-relative-incdir.m | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/clang/test/Modules/crash-vfs-relative-incdir.m b/clang/test/Modules/crash-vfs-relative-incdir.m new file mode 100644 index 00000000000..733b79516f2 --- /dev/null +++ b/clang/test/Modules/crash-vfs-relative-incdir.m @@ -0,0 +1,58 @@ +// REQUIRES: crash-recovery, shell, system-darwin + +// RUN: rm -rf %t +// RUN: mkdir -p %t/m +// RUN: cd %S/Inputs/crash-recovery/usr + +// RUN: not env FORCE_CLANG_DIAGNOSTICS_CRASH= TMPDIR=%t TEMP=%t TMP=%t \ +// RUN: %clang -fsyntax-only -nostdinc %s -Iinclude \ +// RUN: -fmodules -fmodules-cache-path=%t/m/ 2>&1 | FileCheck %s + +// RUN: FileCheck --check-prefix=CHECKSRC %s -input-file %t/crash-vfs-*.m +// RUN: FileCheck --check-prefix=CHECKSH %s -input-file %t/crash-vfs-*.sh +// RUN: FileCheck --check-prefix=CHECKYAML %s -input-file \ +// RUN: %t/crash-vfs-*.cache/vfs/vfs.yaml +// RUN: find %t/crash-vfs-*.cache/vfs | \ +// RUN: grep "Inputs/crash-recovery/usr/include/stdio.h" | count 1 + +#include <stdio.h> + +// CHECK: Preprocessed source(s) and associated run script(s) are located at: +// CHECK-NEXT: note: diagnostic msg: {{.*}}.m +// CHECK-NEXT: note: diagnostic msg: {{.*}}.cache + +// CHECKSRC: @import cstd.stdio; + +// CHECKSH: # Crash reproducer +// CHECKSH-NEXT: # Driver args: "-fsyntax-only" +// CHECKSH-NEXT: # Original command: {{.*$}} +// CHECKSH-NEXT: "-cc1" +// CHECKSH: "-resource-dir" +// CHECKSH: "-I" "/[[INCPATH:.*]]/include" +// CHECKSH: "crash-vfs-{{[^ ]*}}.m" +// CHECKSH: "-ivfsoverlay" "crash-vfs-{{[^ ]*}}.cache/vfs/vfs.yaml" +// CHECKSH: "-fmodules-cache-path=crash-vfs-{{[^ ]*}}.cache/modules" + +// CHECKYAML: 'case-sensitive': +// CHECKYAML-NEXT: 'use-external-names': 'false', +// CHECKYAML-NEXT: 'overlay-relative': 'true', +// CHECKYAML-NEXT: 'ignore-non-existent-contents': 'false' +// CHECKYAML: 'type': 'directory' +// CHECKYAML: 'name': "/[[PATH:.*]]/Inputs/crash-recovery/usr/include", +// CHECKYAML-NEXT: 'contents': [ +// CHECKYAML-NEXT: { +// CHECKYAML-NEXT: 'type': 'file', +// CHECKYAML-NEXT: 'name': "module.map", +// CHECKYAML-NOT: 'external-contents': "{{[^ ]*}}.cache +// CHECKYAML-NEXT: 'external-contents': "/[[PATH]]/Inputs/crash-recovery/usr/include/module.map" +// CHECKYAML-NEXT: }, + +// Run the reproducer script - regular exit code is enough to test it works. +// Note that we don't yet support reusing the modules pcm; what we do +// support is re-building the modules relying solely on the header files dumped +// inside .cache/vfs, mapped by .cache/vfs/vfs.yaml. + +// RUN: cd %t +// RUN: rm -rf crash-vfs-relative-incdir-*.cache/modules +// RUN: chmod 755 crash-vfs-*.sh +// RUN: ./crash-vfs-*.sh |

