Home | History | Annotate | Download | only in Modules
      1 // REQUIRES: crash-recovery, shell, system-darwin
      2 
      3 // RUN: rm -rf %t
      4 // RUN: mkdir -p %t/i %t/m %t
      5 
      6 // RUN: not env FORCE_CLANG_DIAGNOSTICS_CRASH= TMPDIR=%t TEMP=%t TMP=%t \
      7 // RUN: %clang -fsyntax-only -nostdinc %s \
      8 // RUN:     -I %S/Inputs/crash-recovery/usr/include -isysroot %/t/i/ \
      9 // RUN:     -fmodules -fmodules-cache-path=%t/m/ 2>&1 | FileCheck %s
     10 
     11 // RUN: FileCheck --check-prefix=CHECKSRC %s -input-file %t/crash-vfs-*.m
     12 // RUN: FileCheck --check-prefix=CHECKSH %s -input-file %t/crash-vfs-*.sh
     13 // RUN: FileCheck --check-prefix=CHECKYAML %s -input-file \
     14 // RUN: %t/crash-vfs-*.cache/vfs/vfs.yaml
     15 // RUN: find %t/crash-vfs-*.cache/vfs | \
     16 // RUN:   grep "Inputs/crash-recovery/usr/include/stdio.h" | count 1
     17 
     18 #include <stdio.h>
     19 
     20 // CHECK: Preprocessed source(s) and associated run script(s) are located at:
     21 // CHECK-NEXT: note: diagnostic msg: {{.*}}.m
     22 // CHECK-NEXT: note: diagnostic msg: {{.*}}.cache
     23 
     24 // CHECKSRC: @import cstd.stdio;
     25 
     26 // CHECKSH: # Crash reproducer
     27 // CHECKSH-NEXT: # Driver args: "-fsyntax-only"
     28 // CHECKSH-NEXT: # Original command: {{.*$}}
     29 // CHECKSH-NEXT: "-cc1"
     30 // CHECKSH: "-resource-dir"
     31 // CHECKSH: "-isysroot" "{{[^"]*}}/i/"
     32 // CHECKSH: "crash-vfs-{{[^ ]*}}.m"
     33 // CHECKSH: "-ivfsoverlay" "crash-vfs-{{[^ ]*}}.cache/vfs/vfs.yaml"
     34 // CHECKSH: "-fmodules-cache-path=crash-vfs-{{[^ ]*}}.cache/modules"
     35 
     36 // CHECKYAML: 'case-sensitive':
     37 // CHECKYAML-NEXT: 'use-external-names': 'false',
     38 // CHECKYAML-NEXT: 'overlay-relative': 'true',
     39 // CHECKYAML: 'type': 'directory'
     40 // CHECKYAML: 'name': "/[[PATH:.*]]/Inputs/crash-recovery/usr/include",
     41 // CHECKYAML-NEXT: 'contents': [
     42 // CHECKYAML-NEXT:   {
     43 // CHECKYAML-NEXT:     'type': 'file',
     44 // CHECKYAML-NEXT:     'name': "module.map",
     45 // CHECKYAML-NOT:      'external-contents': "{{[^ ]*}}.cache
     46 // CHECKYAML-NEXT:     'external-contents': "/[[PATH]]/Inputs/crash-recovery/usr/include/module.map"
     47 // CHECKYAML-NEXT:   },
     48 
     49 // Run the reproducer script - regular exit code is enough to test it works.
     50 // Note that we don't yet support reusing the modules pcm; what we do
     51 // support is re-building the modules relying solely on the header files dumped
     52 // inside .cache/vfs, mapped by .cache/vfs/vfs.yaml.
     53 
     54 // RUN: cd %t
     55 // RUN: rm -rf crash-vfs-run-reproducer-*.cache/modules/*
     56 // RUN: chmod 755 crash-vfs-*.sh
     57 // RUN: ./crash-vfs-*.sh
     58