| 1 |
// RUN: export LSAN_OPTIONS=detect_leaks=0 |
| 2 |
// RUN: rm -rf %t && mkdir %t |
| 3 |
|
| 4 |
// RUN: echo "%s -fcrash-diagnostics-dir=%t -fsyntax-only" | sed -e 's/\\/\\\\/g' > %t.rsp |
| 5 |
|
| 6 |
// RUN: not %clang -DFATAL @%t.rsp -gen-reproducer=off 2>&1 | FileCheck %s --check-prefix=NOT |
| 7 |
// RUN: not %clang -DFATAL @%t.rsp -fno-crash-diagnostics 2>&1 | FileCheck %s --check-prefix=NOT |
| 8 |
// RUN: not %clang -DFATAL @%t.rsp 2>&1 | FileCheck %s |
| 9 |
// RUN: not %clang -DFATAL @%t.rsp -gen-reproducer=crash 2>&1 | FileCheck %s |
| 10 |
// RUN: not %clang -DFATAL @%t.rsp -gen-reproducer=error 2>&1 | FileCheck %s |
| 11 |
// RUN: not %clang -DFATAL @%t.rsp -gen-reproducer=always 2>&1 | FileCheck %s |
| 12 |
// RUN: not %clang -DFATAL @%t.rsp -gen-reproducer 2>&1 | FileCheck %s |
| 13 |
|
| 14 |
// RUN: not %clang -DERROR @%t.rsp -gen-reproducer=off 2>&1 | FileCheck %s --check-prefix=NOT |
| 15 |
// RUN: not %clang -DERROR @%t.rsp -fno-crash-diagnostics 2>&1 | FileCheck %s --check-prefix=NOT |
| 16 |
// RUN: not %clang -DERROR @%t.rsp 2>&1 | FileCheck %s --check-prefix=NOT |
| 17 |
// RUN: not %clang -DERROR @%t.rsp -gen-reproducer=crash 2>&1 | FileCheck %s --check-prefix=NOT |
| 18 |
// RUN: not %clang -DERROR @%t.rsp -gen-reproducer=error 2>&1 | FileCheck %s |
| 19 |
// RUN: not %clang -DERROR @%t.rsp -gen-reproducer=always 2>&1 | FileCheck %s |
| 20 |
// RUN: not %clang -DERROR @%t.rsp -gen-reproducer 2>&1 | FileCheck %s |
| 21 |
|
| 22 |
// RUN: %clang @%t.rsp -gen-reproducer=off 2>&1 | FileCheck %s --check-prefix=NOT --allow-empty |
| 23 |
// RUN: %clang @%t.rsp -fno-crash-diagnostics 2>&1 | FileCheck %s --check-prefix=NOT --allow-empty |
| 24 |
// RUN: %clang @%t.rsp 2>&1 | FileCheck %s --check-prefix=NOT --allow-empty |
| 25 |
// RUN: %clang @%t.rsp -gen-reproducer=crash 2>&1 | FileCheck %s --check-prefix=NOT --allow-empty |
| 26 |
// RUN: %clang @%t.rsp -gen-reproducer=error 2>&1 | FileCheck %s --check-prefix=NOT --allow-empty |
| 27 |
// RUN: not %clang @%t.rsp -gen-reproducer=always 2>&1 | FileCheck %s |
| 28 |
// RUN: not %clang @%t.rsp -gen-reproducer 2>&1 | FileCheck %s |
| 29 |
|
| 30 |
// RUN: not %clang -gen-reproducer=badvalue 2>&1 | FileCheck %s --check-prefix=BAD-VALUE |
| 31 |
// BAD-VALUE: Unknown value for -gen-reproducer=: 'badvalue' |
| 32 |
|
| 33 |
// CHECK: note: diagnostic msg: {{.*}}emit-reproducer-{{.*}}.c |
| 34 |
// NOT-NOT: note: diagnostic msg: {{.*}}emit-reproducer-{{.*}}.c |
| 35 |
|
| 36 |
#ifdef FATAL |
| 37 |
#pragma clang __debug crash |
| 38 |
#elif ERROR |
| 39 |
int main |
| 40 |
#else |
| 41 |
int main() {} |
| 42 |
#endif |