Home | History | Annotate | Download | only in Modules
      1 // REQUIRES: crash-recovery, shell
      2 
      3 // FIXME: This XFAIL is cargo-culted from crash-report.c. Do we need it?
      4 // XFAIL: mingw32
      5 
      6 // Test clang can collect symbolic link headers used in modules.
      7 // crash reproducer if there's a symbolic link header file used in a module.
      8 
      9 // RUN: rm -rf %t
     10 // RUN: mkdir -p %t/i %t/m %t %t/sysroot
     11 // RUN: cp -a %S/Inputs/crash-recovery/usr %t/i/
     12 
     13 // RUN: not env FORCE_CLANG_DIAGNOSTICS_CRASH= TMPDIR=%t TEMP=%t TMP=%t \
     14 // RUN: %clang -fsyntax-only %s -I %/t/i -isysroot %/t/sysroot/ \
     15 // RUN:     -fmodules -fmodules-cache-path=%t/m/ 2>&1 | FileCheck %s
     16 
     17 // RUN: FileCheck --check-prefix=CHECKSRC %s -input-file %t/crash-vfs-*.m
     18 // RUN: FileCheck --check-prefix=CHECKSH %s -input-file %t/crash-vfs-*.sh
     19 // RUN: FileCheck --check-prefix=CHECKYAML %s -input-file \
     20 // RUN: %t/crash-vfs-*.cache/vfs/vfs.yaml
     21 // RUN: find %t/crash-vfs-*.cache/vfs | \
     22 // RUN:   grep "usr/include/stdio.h" | count 1
     23 
     24 #include "usr/include/stdio.h"
     25 
     26 // CHECK: Preprocessed source(s) and associated run script(s) are located at:
     27 // CHECK-NEXT: note: diagnostic msg: {{.*}}.m
     28 // CHECK-NEXT: note: diagnostic msg: {{.*}}.cache
     29 
     30 // CHECKSRC: @import cstd.stdio;
     31 
     32 // CHECKSH: # Crash reproducer
     33 // CHECKSH-NEXT: # Driver args: "-fsyntax-only"
     34 // CHECKSH-NEXT: # Original command: {{.*$}}
     35 // CHECKSH-NEXT: "-cc1"
     36 // CHECKSH: "-isysroot" "{{[^"]*}}/sysroot/"
     37 // CHECKSH-NOT: "-fmodules-cache-path="
     38 // CHECKSH: "crash-vfs-{{[^ ]*}}.m"
     39 // CHECKSH: "-ivfsoverlay" "crash-vfs-{{[^ ]*}}.cache/vfs/vfs.yaml"
     40 // CHECKSH: "-fmodules-cache-path=crash-vfs-{{[^ ]*}}.cache/modules"
     41 
     42 // CHECKYAML: 'type': 'directory',
     43 // CHECKYAML: 'name': "",
     44 // CHECKYAML-NEXT: 'contents': [
     45 // CHECKYAML-NEXT:   {
     46 // CHECKYAML-NEXT:     'type': 'file',
     47 // CHECKYAML-NEXT:     'name': "pthread_impl.h",
     48 // CHECKYAML-NEXT:     'external-contents': "/{{.*}}/i/usr/include/pthread_impl.h"
     49 // CHECKYAML-NEXT:   },
     50