blob: 60e73d4fb909dd71ed46a63de5e44afd7a1f9617 [file] [log] [blame]
Bruno Cardoso Lopesb76c0272016-03-17 02:20:43 +00001// 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 Kramerf8bff1c2016-03-17 16:19:51 +000012// RUN: %clang -fsyntax-only %s -I %S/Inputs/crash-recovery -isysroot %/t/i/ \
Bruno Cardoso Lopesb76c0272016-03-17 02:20:43 +000013// 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 Kramerf8bff1c2016-03-17 16:19:51 +000020// RUN: grep "Inputs/crash-recovery/usr/include/stdio.h" | count 1
Bruno Cardoso Lopesb76c0272016-03-17 02:20:43 +000021
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 Lopesd878e282016-03-20 02:08:48 +000039// CHECKYAML: 'type': 'directory'
40// CHECKYAML: 'name': "/[[PATH:.*]]/Inputs/crash-recovery/usr/include",
Bruno Cardoso Lopesb76c0272016-03-17 02:20:43 +000041// CHECKYAML-NEXT: 'contents': [
42// CHECKYAML-NEXT: {
43// CHECKYAML-NEXT: 'type': 'file',
44// CHECKYAML-NEXT: 'name': "module.map",
Bruno Cardoso Lopesd878e282016-03-20 02:08:48 +000045// CHECKYAML-NEXT: 'external-contents': "/[[PATH]]/Inputs/crash-recovery/usr/include/module.map"
Bruno Cardoso Lopesb76c0272016-03-17 02:20:43 +000046// 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 Lopesd878e282016-03-20 02:08:48 +000054// RUN: cp %t/vfs.yaml %t/crash-vfs-*.cache/vfs/vfs.yaml
Bruno Cardoso Lopesb76c0272016-03-17 02:20:43 +000055// RUN: unset FORCE_CLANG_DIAGNOSTICS_CRASH
Bruno Cardoso Lopes9e2f9d82016-03-17 21:30:55 +000056// RUN: %clang -E %s -I %S/Inputs/crash-recovery -isysroot %/t/i/ \
Bruno Cardoso Lopesd878e282016-03-20 02:08:48 +000057// RUN: -ivfsoverlay %t/crash-vfs-*.cache/vfs/vfs.yaml -fmodules \
Bruno Cardoso Lopesb76c0272016-03-17 02:20:43 +000058// 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"