Richard Smith | b35fc3d | 2017-05-01 21:49:54 +0000 | [diff] [blame^] | 1 | // REQUIRES: crash-recovery, shell, system-darwin |
Bruno Cardoso Lopes | 50688be | 2016-04-13 19:28:24 +0000 | [diff] [blame] | 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 | |
Richard Smith | d3935ae | 2017-04-29 01:29:44 +0000 | [diff] [blame] | 24 | // CHECKSRC: #pragma clang module import cstd.stdio |
Bruno Cardoso Lopes | 50688be | 2016-04-13 19:28:24 +0000 | [diff] [blame] | 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" |
Bruno Cardoso Lopes | 1c10872 | 2016-12-09 03:11:48 +0000 | [diff] [blame] | 34 | // CHECKSH: "-fmodules-cache-path=crash-vfs-{{[^ ]*}}.cache/repro-modules" |
Bruno Cardoso Lopes | 50688be | 2016-04-13 19:28:24 +0000 | [diff] [blame] | 35 | |
| 36 | // CHECKYAML: 'case-sensitive': |
| 37 | // CHECKYAML-NEXT: 'use-external-names': 'false', |
| 38 | // CHECKYAML-NEXT: 'overlay-relative': 'true', |
Bruno Cardoso Lopes | b40d8ad | 2016-08-12 01:50:53 +0000 | [diff] [blame] | 39 | // CHECKYAML-NEXT: 'ignore-non-existent-contents': 'false' |
Bruno Cardoso Lopes | 50688be | 2016-04-13 19:28:24 +0000 | [diff] [blame] | 40 | // CHECKYAML: 'type': 'directory' |
| 41 | // CHECKYAML: 'name': "/[[PATH:.*]]/Inputs/crash-recovery/usr/include", |
| 42 | // CHECKYAML-NEXT: 'contents': [ |
| 43 | // CHECKYAML-NEXT: { |
| 44 | // CHECKYAML-NEXT: 'type': 'file', |
| 45 | // CHECKYAML-NEXT: 'name': "module.map", |
| 46 | // CHECKYAML-NOT: 'external-contents': "{{[^ ]*}}.cache |
| 47 | // CHECKYAML-NEXT: 'external-contents': "/[[PATH]]/Inputs/crash-recovery/usr/include/module.map" |
| 48 | // CHECKYAML-NEXT: }, |
| 49 | |
| 50 | // Run the reproducer script - regular exit code is enough to test it works. |
| 51 | // Note that we don't yet support reusing the modules pcm; what we do |
| 52 | // support is re-building the modules relying solely on the header files dumped |
| 53 | // inside .cache/vfs, mapped by .cache/vfs/vfs.yaml. |
| 54 | |
| 55 | // RUN: cd %t |
Bruno Cardoso Lopes | 50688be | 2016-04-13 19:28:24 +0000 | [diff] [blame] | 56 | // RUN: chmod 755 crash-vfs-*.sh |
| 57 | // RUN: ./crash-vfs-*.sh |