blob: 46502f6427d6c64973e8bf5a78047b9871fce94c [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
Hans Wennborgf3cf49f2013-08-12 22:19:13 +000014// FoNAMEEXT: "-o" "b.ext"
15
16// RUN: %clang_cl /Fofoo.dir/ -### -- %s 2>&1 | FileCheck -check-prefix=FoDIR %s
17// FoDIR: "-o" "foo.dir{{[/\\]+}}cl-outputs.obj"
18
19// RUN: %clang_cl /Fofoo.dir/a -### -- %s 2>&1 | FileCheck -check-prefix=FoDIRNAME %s
20// FoDIRNAME: "-o" "foo.dir{{[/\\]+}}a.obj"
21
22// RUN: %clang_cl /Fofoo.dir/a.ext -### -- %s 2>&1 | FileCheck -check-prefix=FoDIRNAMEEXT %s
23// FoDIRNAMEEXT: "-o" "foo.dir{{[/\\]+}}a.ext"
24
25// RUN: %clang_cl /Fo.. -### -- %s 2>&1 | FileCheck -check-prefix=FoCRAZY %s
26// FoCRAZY: "-o" "..obj"
27
28// RUN: %clang_cl /Fo -### 2>&1 | FileCheck -check-prefix=FoMISSINGARG %s
29// FoMISSINGARG: error: argument to '/Fo' is missing (expected 1 value)
30
31// RUN: %clang_cl /Foa.obj -### -- %s %s 2>&1 | FileCheck -check-prefix=CHECK-MULTIPLESOURCEERROR %s
32// CHECK-MULTIPLESOURCEERROR: error: cannot specify '/Foa.obj' when compiling multiple source files
33
34// RUN: %clang_cl /Fomydir/ -### -- %s %s 2>&1 | FileCheck -check-prefix=CHECK-MULTIPLESOURCEOK %s
35// CHECK-MULTIPLESOURCEOK: "-o" "mydir{{[/\\]+}}cl-outputs.obj"
36
37
38// RUN: %clang_cl -### -- %s 2>&1 | FileCheck -check-prefix=DEFAULTEXE %s
39// DEFAULTEXE: cl-outputs.exe
40
Hans Wennborgf1a74252013-09-10 20:18:04 +000041// RUN: %clang_cl /LD -### -- %s 2>&1 | FileCheck -check-prefix=DEFAULTDLL %s
42// RUN: %clang_cl /LDd -### -- %s 2>&1 | FileCheck -check-prefix=DEFAULTDLL %s
43// DEFAULTDLL: "-out:cl-outputs.dll"
44// DEFAULTDLL: "-implib:cl-outputs.lib"
45
Hans Wennborgf3cf49f2013-08-12 22:19:13 +000046// RUN: %clang_cl /Fefoo -### -- %s 2>&1 | FileCheck -check-prefix=FeNOEXT %s
Hans Wennborgf1a74252013-09-10 20:18:04 +000047// FeNOEXT: "-out:foo.exe"
48
49// RUN: %clang_cl /Fefoo /LD -### -- %s 2>&1 | FileCheck -check-prefix=FeNOEXTDLL %s
50// RUN: %clang_cl /Fefoo /LDd -### -- %s 2>&1 | FileCheck -check-prefix=FeNOEXTDLL %s
51// FeNOEXTDLL: "-out:foo.dll"
52// FeNOEXTDLL: "-implib:foo.lib"
Hans Wennborgf3cf49f2013-08-12 22:19:13 +000053
54// RUN: %clang_cl /Fefoo.ext -### -- %s 2>&1 | FileCheck -check-prefix=FeEXT %s
Hans Wennborgf1a74252013-09-10 20:18:04 +000055// FeEXT: "-out:foo.ext"
56
57// RUN: %clang_cl /LD /Fefoo.ext -### -- %s 2>&1 | FileCheck -check-prefix=FeEXTDLL %s
58// RUN: %clang_cl /LDd /Fefoo.ext -### -- %s 2>&1 | FileCheck -check-prefix=FeEXTDLL %s
59// FeEXTDLL: "-out:foo.ext"
60// FeEXTDLL: "-implib:foo.lib"
Hans Wennborgf3cf49f2013-08-12 22:19:13 +000061
62// RUN: %clang_cl /Fefoo.dir/ -### -- %s 2>&1 | FileCheck -check-prefix=FeDIR %s
Hans Wennborgf1a74252013-09-10 20:18:04 +000063// FeDIR: "-out:foo.dir{{[/\\]+}}cl-outputs.exe"
64
65// RUN: %clang_cl /LD /Fefoo.dir/ -### -- %s 2>&1 | FileCheck -check-prefix=FeDIRDLL %s
66// RUN: %clang_cl /LDd /Fefoo.dir/ -### -- %s 2>&1 | FileCheck -check-prefix=FeDIRDLL %s
67// FeDIRDLL: "-out:foo.dir{{[/\\]+}}cl-outputs.dll"
68// FeDIRDLL: "-implib:foo.dir{{[/\\]+}}cl-outputs.lib"
Hans Wennborgf3cf49f2013-08-12 22:19:13 +000069
70// RUN: %clang_cl /Fefoo.dir/a -### -- %s 2>&1 | FileCheck -check-prefix=FeDIRNAME %s
Hans Wennborgf1a74252013-09-10 20:18:04 +000071// FeDIRNAME: "-out:foo.dir{{[/\\]+}}a.exe"
72
73// RUN: %clang_cl /LD /Fefoo.dir/a -### -- %s 2>&1 | FileCheck -check-prefix=FeDIRNAMEDLL %s
74// RUN: %clang_cl /LDd /Fefoo.dir/a -### -- %s 2>&1 | FileCheck -check-prefix=FeDIRNAMEDLL %s
75// FeDIRNAMEDLL: "-out:foo.dir{{[/\\]+}}a.dll"
76// FeDIRNAMEDLL: "-implib:foo.dir{{[/\\]+}}a.lib"
Hans Wennborgf3cf49f2013-08-12 22:19:13 +000077
78// RUN: %clang_cl /Fefoo.dir/a.ext -### -- %s 2>&1 | FileCheck -check-prefix=FeDIRNAMEEXT %s
Hans Wennborgf1a74252013-09-10 20:18:04 +000079// FeDIRNAMEEXT: "-out:foo.dir{{[/\\]+}}a.ext"
80
81// RUN: %clang_cl /LD /Fefoo.dir/a.ext -### -- %s 2>&1 | FileCheck -check-prefix=FeDIRNAMEEXTDLL %s
82// RUN: %clang_cl /LDd /Fefoo.dir/a.ext -### -- %s 2>&1 | FileCheck -check-prefix=FeDIRNAMEEXTDLL %s
83// FeDIRNAMEEXTDLL: "-out:foo.dir{{[/\\]+}}a.ext"
84// FeDIRNAMEEXTDLL: "-implib:foo.dir{{[/\\]+}}a.lib"
Hans Wennborgf3cf49f2013-08-12 22:19:13 +000085
86// RUN: %clang_cl /Fe -### 2>&1 | FileCheck -check-prefix=FeMISSINGARG %s
87// FeMISSINGARG: error: argument to '/Fe' is missing (expected 1 value)
88
89// RUN: %clang_cl /Fefoo /Febar -### -- %s 2>&1 | FileCheck -check-prefix=FeOVERRIDE %s
Hans Wennborgf1a74252013-09-10 20:18:04 +000090// FeOVERRIDE: "-out:bar.exe"
Hans Wennborg2c21f742013-10-17 16:16:23 +000091
92
93// RUN: %clang_cl /FA -### -- %s 2>&1 | FileCheck -check-prefix=FA %s
94// FA: "-o" "cl-outputs.asm"
95// RUN: %clang_cl /FA /Fafoo -### -- %s 2>&1 | FileCheck -check-prefix=FaNAME %s
96// RUN: %clang_cl /Fafoo -### -- %s 2>&1 | FileCheck -check-prefix=FaNAME %s
97// FaNAME: "-o" "foo.asm"
98// RUN: %clang_cl /FA /Faa.ext /Fab.ext -### -- %s 2>&1 | FileCheck -check-prefix=FaNAMEEXT %s
99// FaNAMEEXT: "-o" "b.ext"
100// RUN: %clang_cl /FA /Fafoo.dir/ -### -- %s 2>&1 | FileCheck -check-prefix=FaDIR %s
101// FaDIR: "-o" "foo.dir{{[/\\]+}}cl-outputs.asm"
102// RUN: %clang_cl /FA /Fafoo.dir/a -### -- %s 2>&1 | FileCheck -check-prefix=FaDIRNAME %s
103// FaDIRNAME: "-o" "foo.dir{{[/\\]+}}a.asm"
104// RUN: %clang_cl /FA /Fafoo.dir/a.ext -### -- %s 2>&1 | FileCheck -check-prefix=FaDIRNAMEEXT %s
105// FaDIRNAMEEXT: "-o" "foo.dir{{[/\\]+}}a.ext"
Hans Wennborg9c1659b2013-10-18 22:49:04 +0000106// RUN: %clang_cl /Faa.asm -### -- %s %s 2>&1 | FileCheck -check-prefix=FaMULTIPLESOURCE %s
107// FaMULTIPLESOURCE: error: cannot specify '/Faa.asm' when compiling multiple source files
Hans Wennborge0053472013-12-20 18:40:46 +0000108
109// RUN: %clang_cl /P -### -- %s 2>&1 | FileCheck -check-prefix=P %s
110// P: "-E"
111// P: "-o" "cl-outputs.i"
Hans Wennborg04c764f2014-06-17 00:19:12 +0000112
113// RUN: %clang_cl /P /Fifoo -### -- %s 2>&1 | FileCheck -check-prefix=Fi1 %s
114// Fi1: "-E"
115// Fi1: "-o" "foo.i"
116
117// RUN: %clang_cl /P /Fifoo.x -### -- %s 2>&1 | FileCheck -check-prefix=Fi2 %s
118// Fi2: "-E"
119// Fi2: "-o" "foo.x"