]>
git.proxmox.com Git - rustc.git/blob - src/vendor/cc/tests/test.rs
10 let test
= Test
::gnu();
20 .must_have("-ffunction-sections")
21 .must_have("-fdata-sections");
22 test
.cmd(1).must_have(test
.td
.path().join("foo.o"));
26 fn gnu_opt_level_1() {
27 let test
= Test
::gnu();
35 .must_not_have("-O2");
39 fn gnu_opt_level_s() {
40 let test
= Test
::gnu();
51 .must_not_have("-Oz");
56 let test
= Test
::gnu();
61 test
.cmd(0).must_have("-g");
65 fn gnu_warnings_into_errors() {
66 let test
= Test
::gnu();
68 .warnings_into_errors(true)
72 test
.cmd(0).must_have("-Werror");
77 let test
= Test
::gnu();
83 test
.cmd(0).must_have("-Wall")
84 .must_have("-Wextra");
89 for vendor
in &["unknown-linux-gnu", "apple-darwin"] {
90 let target
= format
!("x86_64-{}", vendor
);
91 let test
= Test
::gnu();
105 fn gnu_x86_64_no_pic() {
106 for vendor
in &["unknown-linux-gnu", "apple-darwin"] {
107 let target
= format
!("x86_64-{}", vendor
);
108 let test
= Test
::gnu();
116 test
.cmd(0).must_not_have("-fPIC");
122 for vendor
in &["unknown-linux-gnu", "apple-darwin"] {
123 let target
= format
!("i686-{}", vendor
);
124 let test
= Test
::gnu();
138 for vendor
in &["unknown-linux-gnu", "apple-darwin"] {
139 let target
= format
!("i686-{}", vendor
);
140 let test
= Test
::gnu();
148 test
.cmd(0).must_have("-fPIC");
153 fn gnu_set_stdlib() {
154 let test
= Test
::gnu();
156 .cpp_set_stdlib(Some("foo"))
160 test
.cmd(0).must_not_have("-stdlib=foo");
165 let test
= Test
::gnu();
171 test
.cmd(0).must_have("-I").must_have("foo/bar");
176 let test
= Test
::gnu();
178 .define("FOO", "bar")
183 test
.cmd(0).must_have("-DFOO=bar").must_have("-DBAR");
187 fn gnu_compile_assembly() {
188 let test
= Test
::gnu();
192 test
.cmd(0).must_have("foo.S");
197 let test
= Test
::gnu();
205 .must_have("-shared")
206 .must_not_have("-static");
210 fn gnu_flag_if_supported() {
214 let test
= Test
::gnu();
217 .flag_if_supported("-Wall")
218 .flag_if_supported("-Wflag-does-not-exist")
219 .flag_if_supported("-std=c++11")
224 .must_not_have("-Wflag-does-not-exist")
225 .must_not_have("-std=c++11");
229 fn gnu_flag_if_supported_cpp() {
233 let test
= Test
::gnu();
237 .flag_if_supported("-std=c++11")
241 .must_have("-std=c++11");
246 let test
= Test
::gnu();
254 .must_have("-static")
255 .must_not_have("-shared");
260 let test
= Test
::msvc();
268 .must_not_have("/Z7")
271 test
.cmd(1).must_have(test
.td
.path().join("foo.o"));
275 fn msvc_opt_level_0() {
276 let test
= Test
::msvc();
282 test
.cmd(0).must_not_have("/O2");
287 let test
= Test
::msvc();
292 test
.cmd(0).must_have("/Z7");
297 let test
= Test
::msvc();
303 test
.cmd(0).must_have("/I").must_have("foo/bar");
308 let test
= Test
::msvc();
310 .define("FOO", "bar")
315 test
.cmd(0).must_have("/DFOO=bar").must_have("/DBAR");
319 fn msvc_static_crt() {
320 let test
= Test
::msvc();
326 test
.cmd(0).must_have("/MT");
330 fn msvc_no_static_crt() {
331 let test
= Test
::msvc();
337 test
.cmd(0).must_have("/MD");