1*74989affSNico Weber // RUN: %clangxx -O0 %s -o %t
2*74989affSNico Weber 
3*74989affSNico Weber // Recursive include: options1 includes options2
4*74989affSNico Weber // RUN: echo "symbolize=1" > %t.options1.txt
5*74989affSNico Weber // RUN: echo "include='%t.options2.txt'" >>%t.options1.txt
6*74989affSNico Weber // RUN: echo "help=1" >%t.options2.txt
7*74989affSNico Weber // RUN: echo "help=1" >%t.options.options-include.cpp.tmp
8*74989affSNico Weber // RUN: cat %t.options1.txt
9*74989affSNico Weber // RUN: cat %t.options2.txt
10*74989affSNico Weber 
11*74989affSNico Weber // RUN: %env_tool_opts=help=0:include='"%t.options1.txt"' %run %t 2>&1 | tee %t.out
12*74989affSNico Weber // RUN: FileCheck %s --check-prefix=CHECK-WITH-HELP --check-prefix=CHECK-FOUND <%t.out
13*74989affSNico Weber 
14*74989affSNico Weber // RUN: %env_tool_opts=include='"%t.options1.txt"',help=0 %run %t 2>&1 | tee %t.out
15*74989affSNico Weber // RUN: FileCheck %s --check-prefix=CHECK-WITHOUT-HELP --check-prefix=CHECK-FOUND <%t.out
16*74989affSNico Weber 
17*74989affSNico Weber // RUN: %env_tool_opts=include='"%t.options-not-found.txt"',help=1 not %run %t 2>&1 | tee %t.out
18*74989affSNico Weber // RUN: FileCheck %s --check-prefix=CHECK-NOT-FOUND < %t.out
19*74989affSNico Weber 
20*74989affSNico Weber // include_if_exists does not fail when the file is missing
21*74989affSNico Weber // RUN: %env_tool_opts=include_if_exists='"%t.options-not-found.txt"',help=1 %run %t 2>&1 | tee %t.out
22*74989affSNico Weber // RUN: FileCheck %s --check-prefix=CHECK-WITH-HELP --check-prefix=CHECK-FOUND < %t.out
23*74989affSNico Weber 
24*74989affSNico Weber // %b (binary basename substitution)
25*74989affSNico Weber // RUN: %env_tool_opts=include='"%t.options.%b"' %run %t 2>&1 | tee %t.out
26*74989affSNico Weber // RUN: FileCheck %s --check-prefix=CHECK-WITH-HELP --check-prefix=CHECK-FOUND < %t.out
27*74989affSNico Weber 
28*74989affSNico Weber // RUN: %env_tool_opts=include='"%t.options-not-found.%b"' not %run %t 2>&1 | tee %t.out
29*74989affSNico Weber // RUN: FileCheck %s --check-prefix=CHECK-WITHOUT-HELP --check-prefix=CHECK-NOT-FOUND < %t.out
30*74989affSNico Weber 
31*74989affSNico Weber // RUN: %env_tool_opts=include_if_exists='"%t.options.%b"' %run %t 2>&1 | tee %t.out
32*74989affSNico Weber // RUN: FileCheck %s --check-prefix=CHECK-WITH-HELP --check-prefix=CHECK-FOUND < %t.out
33*74989affSNico Weber 
34*74989affSNico Weber // RUN: %env_tool_opts=include_if_exists='"%t.options-not-found.%b"' %run %t 2>&1 | tee %t.out
35*74989affSNico Weber // RUN: FileCheck %s --check-prefix=CHECK-WITHOUT-HELP --check-prefix=CHECK-FOUND < %t.out
36*74989affSNico Weber 
37*74989affSNico Weber // Android tests run on remote device so includes will not work.
38*74989affSNico Weber // UNSUPPORTED: android
39*74989affSNico Weber 
40*74989affSNico Weber #include <stdio.h>
41*74989affSNico Weber 
main()42*74989affSNico Weber int main() {
43*74989affSNico Weber   fprintf(stderr, "done\n");
44*74989affSNico Weber }
45*74989affSNico Weber 
46*74989affSNico Weber // CHECK-WITH-HELP: Available flags for
47*74989affSNico Weber // CHECK-WITHOUT-HELP-NOT: Available flags for
48*74989affSNico Weber // CHECK-FOUND-NOT: Failed to read options from
49*74989affSNico Weber // CHECK-NOT-FOUND: Failed to read options from
50