Clang Project

clang_source_code/test/Driver/config-file-errs.c
1//--- No more than one '--config' may be specified.
2//
3// RUN: not %clang --config 1.cfg --config 2.cfg 2>&1 | FileCheck %s -check-prefix CHECK-DUPLICATE
4// CHECK-DUPLICATE: no more than one option '--config' is allowed
5
6
7//--- '--config' must be followed by config file name.
8//
9// RUN: not %clang --config 2>&1 | FileCheck %s -check-prefix CHECK-MISSING-FILE
10// CHECK-MISSING-FILE: argument to '--config' is missing (expected 1 value)
11
12
13//--- '--config' must not be found in config files.
14//
15// RUN: not %clang --config %S/Inputs/config-6.cfg 2>&1 | FileCheck %s -check-prefix CHECK-NESTED
16// CHECK-NESTED: option '--config' is not allowed inside configuration file
17
18
19//--- Argument of '--config' must be existing file, if it is specified by path.
20//
21// RUN: not %clang --config somewhere/nonexistent-config-file 2>&1 | FileCheck %s -check-prefix CHECK-NONEXISTENT
22// CHECK-NONEXISTENT: configuration file '{{.*}}somewhere/nonexistent-config-file' does not exist
23
24
25//--- Argument of '--config' must exist somewhere in well-known directories, if it is specified by bare name.
26//
27// RUN: not %clang --config-system-dir= --config-user-dir= --config nonexistent-config-file 2>&1 | FileCheck %s -check-prefix CHECK-NOTFOUND0
28// CHECK-NOTFOUND0: configuration file 'nonexistent-config-file.cfg' cannot be found
29// CHECK-NOTFOUND0-NEXT: was searched for in the directory:
30// CHECK-NOTFOUND0-NOT: was searched for in the directory:
31//
32// RUN: not %clang --config-system-dir= --config-user-dir=%S/Inputs/config2 --config nonexistent-config-file 2>&1 | FileCheck %s -check-prefix CHECK-NOTFOUND1
33// CHECK-NOTFOUND1: configuration file 'nonexistent-config-file.cfg' cannot be found
34// CHECK-NOTFOUND1-NEXT: was searched for in the directory: {{.*}}/Inputs/config2
35// CHECK-NOTFOUND1-NEXT: was searched for in the directory:
36// CHECK-NOTFOUND1-NOT: was searched for in the directory:
37//
38// RUN: not %clang --config-system-dir=%S/Inputs/config --config-user-dir= --config nonexistent-config-file 2>&1 | FileCheck %s -check-prefix CHECK-NOTFOUND2
39// CHECK-NOTFOUND2: configuration file 'nonexistent-config-file.cfg' cannot be found
40// CHECK-NOTFOUND2-NEXT: was searched for in the directory: {{.*}}/Inputs/config
41// CHECK-NOTFOUND2-NEXT: was searched for in the directory:
42// CHECK-NOTFOUND2-NOT: was searched for in the directory:
43//
44// RUN: not %clang --config-system-dir=%S/Inputs/config --config-user-dir=%S/Inputs/config2 --config nonexistent-config-file 2>&1 | FileCheck %s -check-prefix CHECK-NOTFOUND3
45// CHECK-NOTFOUND3: configuration file 'nonexistent-config-file.cfg' cannot be found
46// CHECK-NOTFOUND3-NEXT: was searched for in the directory: {{.*}}/Inputs/config2
47// CHECK-NOTFOUND3-NEXT: was searched for in the directory: {{.*}}/Inputs/config
48// CHECK-NOTFOUND3-NEXT: was searched for in the directory:
49
50
51//--- Argument in config file cannot cross the file boundary
52//
53// RUN: not %clang --config %S/Inputs/config-5.cfg x86_64-unknown-linux-gnu -c %s 2>&1 | FileCheck %s -check-prefix CHECK-CROSS
54// CHECK-CROSS: error: argument to '-target' is missing
55