1 // RUN: %clangxx -O0 %s -o %t
2
3 // Recursive include: options1 includes options2
4 // RUN: echo -e "symbolize=1\ninclude='%t.options2.txt'" >%t.options1.txt
5 // RUN: echo -e "help=1\n" >%t.options2.txt
6 // RUN: echo -e "help=1\n" >%t.options.options-include.cc.tmp
7 // RUN: cat %t.options1.txt
8 // RUN: cat %t.options2.txt
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
17 // RUN: FileCheck %s --check-prefix=CHECK-NOT-FOUND < %t.out
18
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
37 #include <stdio.h>
38
main()39 int main() {
40 fprintf(stderr, "done\n");
41 }
42
43 // CHECK-WITH-HELP: Available flags for
44 // CHECK-WITHOUT-HELP-NOT: Available flags for
45 // CHECK-FOUND-NOT: Failed to read options from
46 // CHECK-NOT-FOUND: Failed to read options from
47