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