]>
git.proxmox.com Git - rustc.git/blob - src/vendor/gcc/tests/test.rs
10 let test
= Test
::gnu();
12 .file("foo.c").compile("libfoo.a");
14 test
.cmd(0).must_have("-O2")
18 .must_have("-ffunction-sections")
19 .must_have("-fdata-sections");
20 test
.cmd(1).must_have(test
.td
.path().join("foo.o"));
24 fn gnu_opt_level_1() {
25 let test
= Test
::gnu();
28 .file("foo.c").compile("libfoo.a");
30 test
.cmd(0).must_have("-O1")
31 .must_not_have("-O2");
35 fn gnu_opt_level_s() {
36 let test
= Test
::gnu();
39 .file("foo.c").compile("libfoo.a");
41 test
.cmd(0).must_have("-Os")
45 .must_not_have("-Oz");
50 let test
= Test
::gnu();
53 .file("foo.c").compile("libfoo.a");
54 test
.cmd(0).must_have("-g");
59 for vendor
in &["unknown-linux-gnu", "apple-darwin"] {
60 let target
= format
!("x86_64-{}", vendor
);
61 let test
= Test
::gnu();
65 .file("foo.c").compile("libfoo.a");
67 test
.cmd(0).must_have("-fPIC")
73 fn gnu_x86_64_no_pic() {
74 for vendor
in &["unknown-linux-gnu", "apple-darwin"] {
75 let target
= format
!("x86_64-{}", vendor
);
76 let test
= Test
::gnu();
81 .file("foo.c").compile("libfoo.a");
83 test
.cmd(0).must_not_have("-fPIC");
89 for vendor
in &["unknown-linux-gnu", "apple-darwin"] {
90 let target
= format
!("i686-{}", vendor
);
91 let test
= Test
::gnu();
95 .file("foo.c").compile("libfoo.a");
97 test
.cmd(0).must_not_have("-fPIC")
104 for vendor
in &["unknown-linux-gnu", "apple-darwin"] {
105 let target
= format
!("i686-{}", vendor
);
106 let test
= Test
::gnu();
111 .file("foo.c").compile("libfoo.a");
113 test
.cmd(0).must_have("-fPIC");
118 fn gnu_set_stdlib() {
119 let test
= Test
::gnu();
121 .cpp_set_stdlib(Some("foo"))
122 .file("foo.c").compile("libfoo.a");
124 test
.cmd(0).must_not_have("-stdlib=foo");
129 let test
= Test
::gnu();
132 .file("foo.c").compile("libfoo.a");
134 test
.cmd(0).must_have("-I").must_have("foo/bar");
139 let test
= Test
::gnu();
141 .define("FOO", Some("bar"))
143 .file("foo.c").compile("libfoo.a");
145 test
.cmd(0).must_have("-DFOO=bar").must_have("-DBAR");
149 fn gnu_compile_assembly() {
150 let test
= Test
::gnu();
152 .file("foo.S").compile("libfoo.a");
153 test
.cmd(0).must_have("foo.S");
158 let test
= Test
::msvc();
160 .file("foo.c").compile("libfoo.a");
162 test
.cmd(0).must_have("/O2")
164 .must_not_have("/Z7")
166 test
.cmd(1).must_have(test
.td
.path().join("foo.o"));
170 fn msvc_opt_level_0() {
171 let test
= Test
::msvc();
174 .file("foo.c").compile("libfoo.a");
176 test
.cmd(0).must_not_have("/O2");
181 let test
= Test
::msvc();
184 .file("foo.c").compile("libfoo.a");
185 test
.cmd(0).must_have("/Z7");
190 let test
= Test
::msvc();
193 .file("foo.c").compile("libfoo.a");
195 test
.cmd(0).must_have("/I").must_have("foo/bar");
200 let test
= Test
::msvc();
202 .define("FOO", Some("bar"))
204 .file("foo.c").compile("libfoo.a");
206 test
.cmd(0).must_have("/DFOO=bar").must_have("/DBAR");