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