Skip to content

Commit db3b580

Browse files
committed
Update tests to reflect -Zmultitarget stabilization
1 parent 85e89cf commit db3b580

File tree

2 files changed

+12
-84
lines changed

2 files changed

+12
-84
lines changed

tests/testsuite/multitarget.rs

Lines changed: 10 additions & 82 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(&["multitarget"])
7322
.run();
7423

7524
assert!(p.target_bin(t1, "foo").is_file());
@@ -90,18 +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")
103-
.masquerade_as_nightly_cargo(&["multitarget"])
104-
.run();
49+
p.cargo("build").run();
10550

10651
assert!(p.target_bin(t1, "foo").is_file());
10752
assert!(p.target_bin(t2, "foo").is_file());
@@ -119,12 +64,11 @@ fn simple_test() {
11964
.file("src/lib.rs", "fn main() {}")
12065
.build();
12166

122-
p.cargo("test -Z multitarget")
67+
p.cargo("test")
12368
.arg("--target")
12469
.arg(&t1)
12570
.arg("--target")
12671
.arg(&t2)
127-
.masquerade_as_nightly_cargo(&["multitarget"])
12872
.with_stderr_contains(&format!("[RUNNING] [..]{}[..]", t1))
12973
.with_stderr_contains(&format!("[RUNNING] [..]{}[..]", t2))
13074
.run();
@@ -137,10 +81,9 @@ fn simple_run() {
13781
.file("src/main.rs", "fn main() {}")
13882
.build();
13983

140-
p.cargo("run -Z multitarget --target a --target b")
84+
p.cargo("run --target a --target b")
14185
.with_stderr("[ERROR] only one `--target` argument is supported")
14286
.with_status(101)
143-
.masquerade_as_nightly_cargo(&["multitarget"])
14487
.run();
14588
}
14689

@@ -156,12 +99,11 @@ fn simple_doc() {
15699
.file("src/lib.rs", "//! empty lib")
157100
.build();
158101

159-
p.cargo("doc -Z multitarget")
102+
p.cargo("doc")
160103
.arg("--target")
161104
.arg(&t1)
162105
.arg("--target")
163106
.arg(&t2)
164-
.masquerade_as_nightly_cargo(&["multitarget"])
165107
.run();
166108

167109
assert!(p.build_dir().join(&t1).join("doc/foo/index.html").is_file());
@@ -180,12 +122,11 @@ fn simple_check() {
180122
.file("src/main.rs", "fn main() {}")
181123
.build();
182124

183-
p.cargo("check -Z multitarget")
125+
p.cargo("check")
184126
.arg("--target")
185127
.arg(&t1)
186128
.arg("--target")
187129
.arg(&t2)
188-
.masquerade_as_nightly_cargo(&["multitarget"])
189130
.run();
190131
}
191132

@@ -200,12 +141,11 @@ fn same_value_twice() {
200141
.file("src/main.rs", "fn main() {}")
201142
.build();
202143

203-
p.cargo("build -Z multitarget")
144+
p.cargo("build")
204145
.arg("--target")
205146
.arg(&t)
206147
.arg("--target")
207148
.arg(&t)
208-
.masquerade_as_nightly_cargo(&["multitarget"])
209149
.run();
210150

211151
assert!(p.target_bin(t, "foo").is_file());
@@ -224,18 +164,14 @@ fn same_value_twice_with_config() {
224164
".cargo/config.toml",
225165
&format!(
226166
r#"
227-
[unstable]
228-
multitarget = true
229167
[build]
230168
target = ["{t}", "{t}"]
231169
"#
232170
),
233171
)
234172
.build();
235173

236-
p.cargo("build")
237-
.masquerade_as_nightly_cargo(&["multitarget"])
238-
.run();
174+
p.cargo("build").run();
239175

240176
assert!(p.target_bin(t, "foo").is_file());
241177
}
@@ -253,18 +189,14 @@ fn works_with_config_in_both_string_or_list() {
253189
".cargo/config.toml",
254190
&format!(
255191
r#"
256-
[unstable]
257-
multitarget = true
258192
[build]
259193
target = "{t}"
260194
"#
261195
),
262196
)
263197
.build();
264198

265-
p.cargo("build")
266-
.masquerade_as_nightly_cargo(&["multitarget"])
267-
.run();
199+
p.cargo("build").run();
268200

269201
assert!(p.target_bin(t, "foo").is_file());
270202

@@ -274,17 +206,13 @@ fn works_with_config_in_both_string_or_list() {
274206
".cargo/config.toml",
275207
&format!(
276208
r#"
277-
[unstable]
278-
multitarget = true
279209
[build]
280210
target = ["{t}"]
281211
"#
282212
),
283213
);
284214

285-
p.cargo("build")
286-
.masquerade_as_nightly_cargo(&["multitarget"])
287-
.run();
215+
p.cargo("build").run();
288216

289217
assert!(p.target_bin(t, "foo").is_file());
290218
}

tests/testsuite/rustc.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -743,8 +743,8 @@ 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")
747-
.masquerade_as_nightly_cargo(&["print", "multitarget"])
746+
p.cargo("rustc -Z unstable-options --target x86_64-pc-windows-msvc --target i686-unknown-linux-gnu --print cfg")
747+
.masquerade_as_nightly_cargo(&["print"])
748748
.with_stdout_contains("debug_assertions")
749749
.with_stdout_contains("target_arch=\"x86_64\"")
750750
.with_stdout_contains("target_endian=\"little\"")

0 commit comments

Comments
 (0)