blob: 1528b15b9e9af5bd4a00fbe33041c26fd6506424 [file] [log] [blame]
Stephen Hines86277eb2015-03-23 12:06:32 -07001// RUN: %clangxx -O0 %s -o %t
Pirama Arumuga Nainar799172d2016-03-03 15:50:30 -08002
3// Recursive include: options1 includes options2
Stephen Hines86277eb2015-03-23 12:06:32 -07004// RUN: echo -e "symbolize=1\ninclude='%t.options2.txt'" >%t.options1.txt
5// RUN: echo -e "help=1\n" >%t.options2.txt
Pirama Arumuga Nainar799172d2016-03-03 15:50:30 -08006// RUN: echo -e "help=1\n" >%t.options.options-include.cc.tmp
Stephen Hines86277eb2015-03-23 12:06:32 -07007// RUN: cat %t.options1.txt
8// RUN: cat %t.options2.txt
Pirama Arumuga Nainar799172d2016-03-03 15:50:30 -08009
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 Hines86277eb2015-03-23 12:06:32 -070017// RUN: FileCheck %s --check-prefix=CHECK-NOT-FOUND < %t.out
18
Pirama Arumuga Nainar799172d2016-03-03 15:50:30 -080019// 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 Hines86277eb2015-03-23 12:06:32 -070037#include <stdio.h>
38
39int main() {
40 fprintf(stderr, "done\n");
41}
42
Pirama Arumuga Nainar799172d2016-03-03 15:50:30 -080043// CHECK-WITH-HELP: Available flags for
44// CHECK-WITHOUT-HELP-NOT: Available flags for
45// CHECK-FOUND-NOT: Failed to read options from
Stephen Hines86277eb2015-03-23 12:06:32 -070046// CHECK-NOT-FOUND: Failed to read options from