Stephen Hines | 86277eb | 2015-03-23 12:06:32 -0700 | [diff] [blame] | 1 | // RUN: %clangxx -O0 %s -o %t |
Pirama Arumuga Nainar | 799172d | 2016-03-03 15:50:30 -0800 | [diff] [blame^] | 2 | |
| 3 | // Recursive include: options1 includes options2 |
Stephen Hines | 86277eb | 2015-03-23 12:06:32 -0700 | [diff] [blame] | 4 | // RUN: echo -e "symbolize=1\ninclude='%t.options2.txt'" >%t.options1.txt |
| 5 | // RUN: echo -e "help=1\n" >%t.options2.txt |
Pirama Arumuga Nainar | 799172d | 2016-03-03 15:50:30 -0800 | [diff] [blame^] | 6 | // RUN: echo -e "help=1\n" >%t.options.options-include.cc.tmp |
Stephen Hines | 86277eb | 2015-03-23 12:06:32 -0700 | [diff] [blame] | 7 | // RUN: cat %t.options1.txt |
| 8 | // RUN: cat %t.options2.txt |
Pirama Arumuga Nainar | 799172d | 2016-03-03 15:50:30 -0800 | [diff] [blame^] | 9 | |
| 10 | // RUN: %env_tool_opts=help=0:include='"%t.options1.txt"' %run %t 2>&1 | tee %t.out |
| 11 | // RUN: FileCheck %s --check-prefix=CHECK-WITH-HELP --check-prefix=CHECK-FOUND <%t.out |
| 12 | |
| 13 | // RUN: %env_tool_opts=include='"%t.options1.txt"',help=0 %run %t 2>&1 | tee %t.out |
| 14 | // RUN: FileCheck %s --check-prefix=CHECK-WITHOUT-HELP --check-prefix=CHECK-FOUND <%t.out |
| 15 | |
| 16 | // RUN: %env_tool_opts=include='"%t.options-not-found.txt"',help=1 not %run %t 2>&1 | tee %t.out |
Stephen Hines | 86277eb | 2015-03-23 12:06:32 -0700 | [diff] [blame] | 17 | // RUN: FileCheck %s --check-prefix=CHECK-NOT-FOUND < %t.out |
| 18 | |
Pirama Arumuga Nainar | 799172d | 2016-03-03 15:50:30 -0800 | [diff] [blame^] | 19 | // include_if_exists does not fail when the file is missing |
| 20 | // RUN: %env_tool_opts=include_if_exists='"%t.options-not-found.txt"',help=1 %run %t 2>&1 | tee %t.out |
| 21 | // RUN: FileCheck %s --check-prefix=CHECK-WITH-HELP --check-prefix=CHECK-FOUND < %t.out |
| 22 | |
| 23 | // %b (binary basename substitution) |
| 24 | // RUN: %env_tool_opts=include='"%t.options.%b"' %run %t 2>&1 | tee %t.out |
| 25 | // RUN: FileCheck %s --check-prefix=CHECK-WITH-HELP --check-prefix=CHECK-FOUND < %t.out |
| 26 | |
| 27 | // RUN: %env_tool_opts=include='"%t.options-not-found.%b"' not %run %t 2>&1 | tee %t.out |
| 28 | // RUN: FileCheck %s --check-prefix=CHECK-WITHOUT-HELP --check-prefix=CHECK-NOT-FOUND < %t.out |
| 29 | |
| 30 | // RUN: %env_tool_opts=include_if_exists='"%t.options.%b"' %run %t 2>&1 | tee %t.out |
| 31 | // RUN: FileCheck %s --check-prefix=CHECK-WITH-HELP --check-prefix=CHECK-FOUND < %t.out |
| 32 | |
| 33 | // RUN: %env_tool_opts=include_if_exists='"%t.options-not-found.%b"' %run %t 2>&1 | tee %t.out |
| 34 | // RUN: FileCheck %s --check-prefix=CHECK-WITHOUT-HELP --check-prefix=CHECK-FOUND < %t.out |
| 35 | |
| 36 | |
Stephen Hines | 86277eb | 2015-03-23 12:06:32 -0700 | [diff] [blame] | 37 | #include <stdio.h> |
| 38 | |
| 39 | int main() { |
| 40 | fprintf(stderr, "done\n"); |
| 41 | } |
| 42 | |
Pirama Arumuga Nainar | 799172d | 2016-03-03 15:50:30 -0800 | [diff] [blame^] | 43 | // CHECK-WITH-HELP: Available flags for |
| 44 | // CHECK-WITHOUT-HELP-NOT: Available flags for |
| 45 | // CHECK-FOUND-NOT: Failed to read options from |
Stephen Hines | 86277eb | 2015-03-23 12:06:32 -0700 | [diff] [blame] | 46 | // CHECK-NOT-FOUND: Failed to read options from |