Bruno Cardoso Lopes | b76c027 | 2016-03-17 02:20:43 +0000 | [diff] [blame] | 1 | // REQUIRES: crash-recovery, shell, non-ms-sdk, non-ps4-sdk |
| 2 | |
| 3 | // FIXME: Canonicalizing paths to remove relative traversal components |
| 4 | // currenty fails a unittest on windows and is disable by default. |
| 5 | // FIXME: This XFAIL is cargo-culted from crash-report.c. Do we need it? |
| 6 | // XFAIL: mingw32 |
| 7 | |
| 8 | // RUN: rm -rf %t |
| 9 | // RUN: mkdir -p %t/i %t/m %t |
| 10 | |
| 11 | // RUN: not env FORCE_CLANG_DIAGNOSTICS_CRASH= TMPDIR=%t TEMP=%t TMP=%t \ |
Benjamin Kramer | f8bff1c | 2016-03-17 16:19:51 +0000 | [diff] [blame] | 12 | // RUN: %clang -fsyntax-only %s -I %S/Inputs/crash-recovery -isysroot %/t/i/ \ |
Bruno Cardoso Lopes | b76c027 | 2016-03-17 02:20:43 +0000 | [diff] [blame] | 13 | // RUN: -fmodules -fmodules-cache-path=%t/m/ 2>&1 | FileCheck %s |
| 14 | |
| 15 | // RUN: FileCheck --check-prefix=CHECKSRC %s -input-file %t/crash-vfs-*.m |
| 16 | // RUN: FileCheck --check-prefix=CHECKSH %s -input-file %t/crash-vfs-*.sh |
| 17 | // RUN: FileCheck --check-prefix=CHECKYAML %s -input-file \ |
| 18 | // RUN: %t/crash-vfs-*.cache/vfs/vfs.yaml |
| 19 | // RUN: find %t/crash-vfs-*.cache/vfs | \ |
Benjamin Kramer | f8bff1c | 2016-03-17 16:19:51 +0000 | [diff] [blame] | 20 | // RUN: grep "Inputs/crash-recovery/usr/include/stdio.h" | count 1 |
Bruno Cardoso Lopes | b76c027 | 2016-03-17 02:20:43 +0000 | [diff] [blame] | 21 | |
| 22 | #include "usr/././//////include/../include/./././../include/stdio.h" |
| 23 | |
| 24 | // CHECK: Preprocessed source(s) and associated run script(s) are located at: |
| 25 | // CHECK-NEXT: note: diagnostic msg: {{.*}}.m |
| 26 | // CHECK-NEXT: note: diagnostic msg: {{.*}}.cache |
| 27 | |
| 28 | // CHECKSRC: @import cstd.stdio; |
| 29 | |
| 30 | // CHECKSH: # Crash reproducer |
| 31 | // CHECKSH-NEXT: # Driver args: "-fsyntax-only" |
| 32 | // CHECKSH-NEXT: # Original command: {{.*$}} |
| 33 | // CHECKSH-NEXT: "-cc1" |
| 34 | // CHECKSH: "-isysroot" "{{[^"]*}}/i/" |
| 35 | // CHECKSH-NOT: "-fmodules-cache-path=" |
| 36 | // CHECKSH: "crash-vfs-{{[^ ]*}}.m" |
| 37 | // CHECKSH: "-ivfsoverlay" "crash-vfs-{{[^ ]*}}.cache/vfs/vfs.yaml" |
| 38 | |
Bruno Cardoso Lopes | d878e28 | 2016-03-20 02:08:48 +0000 | [diff] [blame^] | 39 | // CHECKYAML: 'type': 'directory' |
| 40 | // CHECKYAML: 'name': "/[[PATH:.*]]/Inputs/crash-recovery/usr/include", |
Bruno Cardoso Lopes | b76c027 | 2016-03-17 02:20:43 +0000 | [diff] [blame] | 41 | // CHECKYAML-NEXT: 'contents': [ |
| 42 | // CHECKYAML-NEXT: { |
| 43 | // CHECKYAML-NEXT: 'type': 'file', |
| 44 | // CHECKYAML-NEXT: 'name': "module.map", |
Bruno Cardoso Lopes | d878e28 | 2016-03-20 02:08:48 +0000 | [diff] [blame^] | 45 | // CHECKYAML-NEXT: 'external-contents': "/[[PATH]]/Inputs/crash-recovery/usr/include/module.map" |
Bruno Cardoso Lopes | b76c027 | 2016-03-17 02:20:43 +0000 | [diff] [blame] | 46 | // CHECKYAML-NEXT: }, |
| 47 | |
| 48 | // Replace the paths in the YAML files with relative ".." traversals |
| 49 | // and fed into clang to test whether we're correctly representing them |
| 50 | // in the VFS overlay. |
| 51 | |
| 52 | // RUN: sed -e "s@usr/include@usr/include/../include@g" \ |
| 53 | // RUN: %t/crash-vfs-*.cache/vfs/vfs.yaml > %t/vfs.yaml |
Bruno Cardoso Lopes | d878e28 | 2016-03-20 02:08:48 +0000 | [diff] [blame^] | 54 | // RUN: cp %t/vfs.yaml %t/crash-vfs-*.cache/vfs/vfs.yaml |
Bruno Cardoso Lopes | b76c027 | 2016-03-17 02:20:43 +0000 | [diff] [blame] | 55 | // RUN: unset FORCE_CLANG_DIAGNOSTICS_CRASH |
Bruno Cardoso Lopes | 9e2f9d8 | 2016-03-17 21:30:55 +0000 | [diff] [blame] | 56 | // RUN: %clang -E %s -I %S/Inputs/crash-recovery -isysroot %/t/i/ \ |
Bruno Cardoso Lopes | d878e28 | 2016-03-20 02:08:48 +0000 | [diff] [blame^] | 57 | // RUN: -ivfsoverlay %t/crash-vfs-*.cache/vfs/vfs.yaml -fmodules \ |
Bruno Cardoso Lopes | b76c027 | 2016-03-17 02:20:43 +0000 | [diff] [blame] | 58 | // RUN: -fmodules-cache-path=%t/m/ 2>&1 \ |
| 59 | // RUN: | FileCheck %s --check-prefix=CHECKOVERLAY |
| 60 | |
| 61 | // CHECKOVERLAY: @import cstd.stdio; /* clang -E: implicit import for "{{[^ ]*}}.cache/vfs/{{[^ ]*}}/usr/include/stdio.h" |