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 // RUN: rm -f %t/i/usr/include/pthread_impl.h
     13 // RUN: ln -s pthread/pthread_impl.h %t/i/usr/include/pthread_impl.h
     14 
     15 // RUN: not env FORCE_CLANG_DIAGNOSTICS_CRASH= TMPDIR=%t TEMP=%t TMP=%t \
     16 // RUN: %clang -fsyntax-only %s -I %/t/i -isysroot %/t/sysroot/ \
     17 // RUN:     -fmodules -fmodules-cache-path=%t/m/ 2>&1 | FileCheck %s
     18 
     19 // RUN: FileCheck --check-prefix=CHECKSRC %s -input-file %t/crash-vfs-*.m
     20 // RUN: FileCheck --check-prefix=CHECKSH %s -input-file %t/crash-vfs-*.sh
     21 // RUN: FileCheck --check-prefix=CHECKYAML %s -input-file \
     22 // RUN: %t/crash-vfs-*.cache/vfs/vfs.yaml
     23 // RUN: find %t/crash-vfs-*.cache/vfs | \
     24 // RUN:   grep "usr/include/pthread_impl.h" | count 1
     25 
     26 #include "usr/include/stdio.h"
     27 
     28 // CHECK: Preprocessed source(s) and associated run script(s) are located at:
     29 // CHECK-NEXT: note: diagnostic msg: {{.*}}.m
     30 // CHECK-NEXT: note: diagnostic msg: {{.*}}.cache
     31 
     32 // CHECKSRC: @import cstd.stdio;
     33 
     34 // CHECKSH: # Crash reproducer
     35 // CHECKSH-NEXT: # Driver args: "-fsyntax-only"
     36 // CHECKSH-NEXT: # Original command: {{.*$}}
     37 // CHECKSH-NEXT: "-cc1"
     38 // CHECKSH: "-isysroot" "{{[^"]*}}/sysroot/"
     39 // CHECKSH-NOT: "-fmodules-cache-path="
     40 // CHECKSH: "crash-vfs-{{[^ ]*}}.m"
     41 // CHECKSH: "-ivfsoverlay" "crash-vfs-{{[^ ]*}}.cache/vfs/vfs.yaml"
     42 // CHECKSH: "-fmodules-cache-path=crash-vfs-{{[^ ]*}}.cache/modules"
     43 
     44 // CHECKYAML: 'type': 'directory',
     45 // CHECKYAML: 'name': "",
     46 // CHECKYAML-NEXT: 'contents': [
     47 // CHECKYAML-NEXT:   {
     48 // CHECKYAML-NEXT:     'type': 'file',
     49 // CHECKYAML-NEXT:     'name': "pthread_impl.h",
     50 // CHECKYAML-NEXT:     'external-contents': "/{{.*}}/i/usr/include/pthread_impl.h"
     51 // CHECKYAML-NEXT:   },
     52