blob: 636ef96f60da73c46cc50d12dcc9a05fd93dea8d [file] [log] [blame]
Hans Wennborgf3cf49f2013-08-12 22:19:13 +00001// Don't attempt slash switches on msys bash.
2// REQUIRES: shell-preserves-root
3
4// Note: %s must be preceded by --, otherwise it may be interpreted as a
5// command-line option, e.g. on Mac where %s is commonly under /Users.
6
Hans Wennborg0a096a02013-09-05 17:05:56 +00007// RUN: %clang_cl /c -### -- %s 2>&1 | FileCheck -check-prefix=DEFAULT %s
8// DEFAULT: "-o" "cl-outputs.obj"
9
Hans Wennborgf3cf49f2013-08-12 22:19:13 +000010// RUN: %clang_cl /Foa -### -- %s 2>&1 | FileCheck -check-prefix=FoNAME %s
11// FoNAME: "-o" "a.obj"
12
13// RUN: %clang_cl /Foa.ext /Fob.ext -### -- %s 2>&1 | FileCheck -check-prefix=FoNAMEEXT %s
14// FoNAMEEXT: warning: overriding '/Foa.ext' option with '/Fob.ext'
15// FoNAMEEXT: "-o" "b.ext"
16
17// RUN: %clang_cl /Fofoo.dir/ -### -- %s 2>&1 | FileCheck -check-prefix=FoDIR %s
18// FoDIR: "-o" "foo.dir{{[/\\]+}}cl-outputs.obj"
19
20// RUN: %clang_cl /Fofoo.dir/a -### -- %s 2>&1 | FileCheck -check-prefix=FoDIRNAME %s
21// FoDIRNAME: "-o" "foo.dir{{[/\\]+}}a.obj"
22
23// RUN: %clang_cl /Fofoo.dir/a.ext -### -- %s 2>&1 | FileCheck -check-prefix=FoDIRNAMEEXT %s
24// FoDIRNAMEEXT: "-o" "foo.dir{{[/\\]+}}a.ext"
25
26// RUN: %clang_cl /Fo.. -### -- %s 2>&1 | FileCheck -check-prefix=FoCRAZY %s
27// FoCRAZY: "-o" "..obj"
28
29// RUN: %clang_cl /Fo -### 2>&1 | FileCheck -check-prefix=FoMISSINGARG %s
30// FoMISSINGARG: error: argument to '/Fo' is missing (expected 1 value)
31
32// RUN: %clang_cl /Foa.obj -### -- %s %s 2>&1 | FileCheck -check-prefix=CHECK-MULTIPLESOURCEERROR %s
33// CHECK-MULTIPLESOURCEERROR: error: cannot specify '/Foa.obj' when compiling multiple source files
34
35// RUN: %clang_cl /Fomydir/ -### -- %s %s 2>&1 | FileCheck -check-prefix=CHECK-MULTIPLESOURCEOK %s
36// CHECK-MULTIPLESOURCEOK: "-o" "mydir{{[/\\]+}}cl-outputs.obj"
37
38
39// RUN: %clang_cl -### -- %s 2>&1 | FileCheck -check-prefix=DEFAULTEXE %s
40// DEFAULTEXE: cl-outputs.exe
41
Hans Wennborgf1a74252013-09-10 20:18:04 +000042// RUN: %clang_cl /LD -### -- %s 2>&1 | FileCheck -check-prefix=DEFAULTDLL %s
43// RUN: %clang_cl /LDd -### -- %s 2>&1 | FileCheck -check-prefix=DEFAULTDLL %s
44// DEFAULTDLL: "-out:cl-outputs.dll"
45// DEFAULTDLL: "-implib:cl-outputs.lib"
46
Hans Wennborgf3cf49f2013-08-12 22:19:13 +000047// RUN: %clang_cl /Fefoo -### -- %s 2>&1 | FileCheck -check-prefix=FeNOEXT %s
Hans Wennborgf1a74252013-09-10 20:18:04 +000048// FeNOEXT: "-out:foo.exe"
49
50// RUN: %clang_cl /Fefoo /LD -### -- %s 2>&1 | FileCheck -check-prefix=FeNOEXTDLL %s
51// RUN: %clang_cl /Fefoo /LDd -### -- %s 2>&1 | FileCheck -check-prefix=FeNOEXTDLL %s
52// FeNOEXTDLL: "-out:foo.dll"
53// FeNOEXTDLL: "-implib:foo.lib"
Hans Wennborgf3cf49f2013-08-12 22:19:13 +000054
55// RUN: %clang_cl /Fefoo.ext -### -- %s 2>&1 | FileCheck -check-prefix=FeEXT %s
Hans Wennborgf1a74252013-09-10 20:18:04 +000056// FeEXT: "-out:foo.ext"
57
58// RUN: %clang_cl /LD /Fefoo.ext -### -- %s 2>&1 | FileCheck -check-prefix=FeEXTDLL %s
59// RUN: %clang_cl /LDd /Fefoo.ext -### -- %s 2>&1 | FileCheck -check-prefix=FeEXTDLL %s
60// FeEXTDLL: "-out:foo.ext"
61// FeEXTDLL: "-implib:foo.lib"
Hans Wennborgf3cf49f2013-08-12 22:19:13 +000062
63// RUN: %clang_cl /Fefoo.dir/ -### -- %s 2>&1 | FileCheck -check-prefix=FeDIR %s
Hans Wennborgf1a74252013-09-10 20:18:04 +000064// FeDIR: "-out:foo.dir{{[/\\]+}}cl-outputs.exe"
65
66// RUN: %clang_cl /LD /Fefoo.dir/ -### -- %s 2>&1 | FileCheck -check-prefix=FeDIRDLL %s
67// RUN: %clang_cl /LDd /Fefoo.dir/ -### -- %s 2>&1 | FileCheck -check-prefix=FeDIRDLL %s
68// FeDIRDLL: "-out:foo.dir{{[/\\]+}}cl-outputs.dll"
69// FeDIRDLL: "-implib:foo.dir{{[/\\]+}}cl-outputs.lib"
Hans Wennborgf3cf49f2013-08-12 22:19:13 +000070
71// RUN: %clang_cl /Fefoo.dir/a -### -- %s 2>&1 | FileCheck -check-prefix=FeDIRNAME %s
Hans Wennborgf1a74252013-09-10 20:18:04 +000072// FeDIRNAME: "-out:foo.dir{{[/\\]+}}a.exe"
73
74// RUN: %clang_cl /LD /Fefoo.dir/a -### -- %s 2>&1 | FileCheck -check-prefix=FeDIRNAMEDLL %s
75// RUN: %clang_cl /LDd /Fefoo.dir/a -### -- %s 2>&1 | FileCheck -check-prefix=FeDIRNAMEDLL %s
76// FeDIRNAMEDLL: "-out:foo.dir{{[/\\]+}}a.dll"
77// FeDIRNAMEDLL: "-implib:foo.dir{{[/\\]+}}a.lib"
Hans Wennborgf3cf49f2013-08-12 22:19:13 +000078
79// RUN: %clang_cl /Fefoo.dir/a.ext -### -- %s 2>&1 | FileCheck -check-prefix=FeDIRNAMEEXT %s
Hans Wennborgf1a74252013-09-10 20:18:04 +000080// FeDIRNAMEEXT: "-out:foo.dir{{[/\\]+}}a.ext"
81
82// RUN: %clang_cl /LD /Fefoo.dir/a.ext -### -- %s 2>&1 | FileCheck -check-prefix=FeDIRNAMEEXTDLL %s
83// RUN: %clang_cl /LDd /Fefoo.dir/a.ext -### -- %s 2>&1 | FileCheck -check-prefix=FeDIRNAMEEXTDLL %s
84// FeDIRNAMEEXTDLL: "-out:foo.dir{{[/\\]+}}a.ext"
85// FeDIRNAMEEXTDLL: "-implib:foo.dir{{[/\\]+}}a.lib"
Hans Wennborgf3cf49f2013-08-12 22:19:13 +000086
87// RUN: %clang_cl /Fe -### 2>&1 | FileCheck -check-prefix=FeMISSINGARG %s
88// FeMISSINGARG: error: argument to '/Fe' is missing (expected 1 value)
89
90// RUN: %clang_cl /Fefoo /Febar -### -- %s 2>&1 | FileCheck -check-prefix=FeOVERRIDE %s
91// FeOVERRIDE: warning: overriding '/Fefoo' option with '/Febar'
Hans Wennborgf1a74252013-09-10 20:18:04 +000092// FeOVERRIDE: "-out:bar.exe"