Skip to content

Commit 2717db3

Browse files
committed
Update tests to reflect -Zmultitarget stabilization
1 parent 5c6e55f commit 2717db3

File tree

2 files changed

+11
-75
lines changed

2 files changed

+11
-75
lines changed

tests/testsuite/multitarget.rs

Lines changed: 10 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -2,56 +2,6 @@
22
33
use cargo_test_support::{basic_manifest, cross_compile, project, rustc_host};
44

5-
#[cargo_test]
6-
fn double_target_rejected() {
7-
let p = project()
8-
.file("Cargo.toml", &basic_manifest("foo", "1.0.0"))
9-
.file("src/main.rs", "fn main() {}")
10-
.build();
11-
12-
p.cargo("build --target a --target b")
13-
.with_stderr("[ERROR] specifying multiple `--target` flags requires `-Zmultitarget`")
14-
.with_status(101)
15-
.run();
16-
}
17-
18-
#[cargo_test]
19-
fn array_of_target_rejected_with_config() {
20-
let p = project()
21-
.file("Cargo.toml", &basic_manifest("foo", "1.0.0"))
22-
.file("src/main.rs", "fn main() {}")
23-
.file(
24-
".cargo/config.toml",
25-
r#"
26-
[build]
27-
target = ["a", "b"]
28-
"#,
29-
)
30-
.build();
31-
32-
p.cargo("build")
33-
.with_stderr(
34-
"[ERROR] specifying an array in `build.target` config value requires `-Zmultitarget`",
35-
)
36-
.with_status(101)
37-
.run();
38-
39-
p.change_file(
40-
".cargo/config.toml",
41-
r#"
42-
[build]
43-
target = ["a"]
44-
"#,
45-
);
46-
47-
p.cargo("build")
48-
.with_stderr(
49-
"[ERROR] specifying an array in `build.target` config value requires `-Zmultitarget`",
50-
)
51-
.with_status(101)
52-
.run();
53-
}
54-
555
#[cargo_test]
566
fn simple_build() {
577
if cross_compile::disabled() {
@@ -64,12 +14,11 @@ fn simple_build() {
6414
.file("src/main.rs", "fn main() {}")
6515
.build();
6616

67-
p.cargo("build -Z multitarget")
17+
p.cargo("build")
6818
.arg("--target")
6919
.arg(&t1)
7020
.arg("--target")
7121
.arg(&t2)
72-
.masquerade_as_nightly_cargo()
7322
.run();
7423

7524
assert!(p.target_bin(t1, "foo").is_file());
@@ -90,16 +39,14 @@ fn simple_build_with_config() {
9039
".cargo/config.toml",
9140
&format!(
9241
r#"
93-
[unstable]
94-
multitarget = true
9542
[build]
9643
target = ["{t1}", "{t2}"]
9744
"#
9845
),
9946
)
10047
.build();
10148

102-
p.cargo("build").masquerade_as_nightly_cargo().run();
49+
p.cargo("build").run();
10350

10451
assert!(p.target_bin(t1, "foo").is_file());
10552
assert!(p.target_bin(t2, "foo").is_file());
@@ -117,12 +64,11 @@ fn simple_test() {
11764
.file("src/lib.rs", "fn main() {}")
11865
.build();
11966

120-
p.cargo("test -Z multitarget")
67+
p.cargo("test")
12168
.arg("--target")
12269
.arg(&t1)
12370
.arg("--target")
12471
.arg(&t2)
125-
.masquerade_as_nightly_cargo()
12672
.with_stderr_contains(&format!("[RUNNING] [..]{}[..]", t1))
12773
.with_stderr_contains(&format!("[RUNNING] [..]{}[..]", t2))
12874
.run();
@@ -135,10 +81,9 @@ fn simple_run() {
13581
.file("src/main.rs", "fn main() {}")
13682
.build();
13783

138-
p.cargo("run -Z multitarget --target a --target b")
84+
p.cargo("run --target a --target b")
13985
.with_stderr("[ERROR] only one `--target` argument is supported")
14086
.with_status(101)
141-
.masquerade_as_nightly_cargo()
14287
.run();
14388
}
14489

@@ -154,12 +99,11 @@ fn simple_doc() {
15499
.file("src/lib.rs", "//! empty lib")
155100
.build();
156101

157-
p.cargo("doc -Z multitarget")
102+
p.cargo("doc")
158103
.arg("--target")
159104
.arg(&t1)
160105
.arg("--target")
161106
.arg(&t2)
162-
.masquerade_as_nightly_cargo()
163107
.run();
164108

165109
assert!(p.build_dir().join(&t1).join("doc/foo/index.html").is_file());
@@ -178,12 +122,11 @@ fn simple_check() {
178122
.file("src/main.rs", "fn main() {}")
179123
.build();
180124

181-
p.cargo("check -Z multitarget")
125+
p.cargo("check")
182126
.arg("--target")
183127
.arg(&t1)
184128
.arg("--target")
185129
.arg(&t2)
186-
.masquerade_as_nightly_cargo()
187130
.run();
188131
}
189132

@@ -198,12 +141,11 @@ fn same_value_twice() {
198141
.file("src/main.rs", "fn main() {}")
199142
.build();
200143

201-
p.cargo("build -Z multitarget")
144+
p.cargo("build")
202145
.arg("--target")
203146
.arg(&t)
204147
.arg("--target")
205148
.arg(&t)
206-
.masquerade_as_nightly_cargo()
207149
.run();
208150

209151
assert!(p.target_bin(t, "foo").is_file());
@@ -222,16 +164,14 @@ fn same_value_twice_with_config() {
222164
".cargo/config.toml",
223165
&format!(
224166
r#"
225-
[unstable]
226-
multitarget = true
227167
[build]
228168
target = ["{t}", "{t}"]
229169
"#
230170
),
231171
)
232172
.build();
233173

234-
p.cargo("build").masquerade_as_nightly_cargo().run();
174+
p.cargo("build").run();
235175

236176
assert!(p.target_bin(t, "foo").is_file());
237177
}
@@ -249,16 +189,14 @@ fn works_with_config_in_both_string_or_list() {
249189
".cargo/config.toml",
250190
&format!(
251191
r#"
252-
[unstable]
253-
multitarget = true
254192
[build]
255193
target = "{t}"
256194
"#
257195
),
258196
)
259197
.build();
260198

261-
p.cargo("build").masquerade_as_nightly_cargo().run();
199+
p.cargo("build").run();
262200

263201
assert!(p.target_bin(t, "foo").is_file());
264202

@@ -268,15 +206,13 @@ fn works_with_config_in_both_string_or_list() {
268206
".cargo/config.toml",
269207
&format!(
270208
r#"
271-
[unstable]
272-
multitarget = true
273209
[build]
274210
target = ["{t}"]
275211
"#
276212
),
277213
);
278214

279-
p.cargo("build").masquerade_as_nightly_cargo().run();
215+
p.cargo("build").run();
280216

281217
assert!(p.target_bin(t, "foo").is_file());
282218
}

tests/testsuite/rustc.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -743,7 +743,7 @@ fn rustc_with_print_cfg_multiple_targets() {
743743
.file("src/main.rs", r#"fn main() {} "#)
744744
.build();
745745

746-
p.cargo("rustc -Z unstable-options -Z multitarget --target x86_64-pc-windows-msvc --target i686-unknown-linux-gnu --print cfg")
746+
p.cargo("rustc -Z unstable-options --target x86_64-pc-windows-msvc --target i686-unknown-linux-gnu --print cfg")
747747
.masquerade_as_nightly_cargo()
748748
.with_stdout_contains("debug_assertions")
749749
.with_stdout_contains("target_arch=\"x86_64\"")

0 commit comments

Comments
 (0)