Skip to content

Commit ed9dc44

Browse files
committed
Update other tests to use cargo:: syntax
Signed-off-by: hi-rustin <[email protected]>
1 parent 9eeffbf commit ed9dc44

12 files changed

+73
-67
lines changed

tests/testsuite/build.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4161,7 +4161,7 @@ fn compiler_json_error_format() {
41614161
)
41624162
.file(
41634163
"build.rs",
4164-
"fn main() { println!(\"cargo:rustc-cfg=xyz\") }",
4164+
"fn main() { println!(\"cargo::rustc-cfg=xyz\") }",
41654165
)
41664166
.file("src/main.rs", "fn main() { let unused = 92; }")
41674167
.file("bar/Cargo.toml", &basic_manifest("bar", "0.5.0"))
@@ -5314,11 +5314,11 @@ fn deterministic_cfg_flags() {
53145314
"build.rs",
53155315
r#"
53165316
fn main() {
5317-
println!("cargo:rustc-cfg=cfg_a");
5318-
println!("cargo:rustc-cfg=cfg_b");
5319-
println!("cargo:rustc-cfg=cfg_c");
5320-
println!("cargo:rustc-cfg=cfg_d");
5321-
println!("cargo:rustc-cfg=cfg_e");
5317+
println!("cargo::rustc-cfg=cfg_a");
5318+
println!("cargo::rustc-cfg=cfg_b");
5319+
println!("cargo::rustc-cfg=cfg_c");
5320+
println!("cargo::rustc-cfg=cfg_d");
5321+
println!("cargo::rustc-cfg=cfg_e");
53225322
}
53235323
"#,
53245324
)

tests/testsuite/build_script_env.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ fn rerun_if_env_changes() {
1212
"build.rs",
1313
r#"
1414
fn main() {
15-
println!("cargo:rerun-if-env-changed=FOO");
15+
println!("cargo::rerun-if-env-changed=FOO");
1616
}
1717
"#,
1818
)
@@ -66,8 +66,8 @@ fn rerun_if_env_or_file_changes() {
6666
"build.rs",
6767
r#"
6868
fn main() {
69-
println!("cargo:rerun-if-env-changed=FOO");
70-
println!("cargo:rerun-if-changed=foo");
69+
println!("cargo::rerun-if-env-changed=FOO");
70+
println!("cargo::rerun-if-changed=foo");
7171
}
7272
"#,
7373
)
@@ -112,7 +112,7 @@ fn rerun_if_env_or_file_changes() {
112112
fn rustc_bootstrap() {
113113
let build_rs = r#"
114114
fn main() {
115-
println!("cargo:rustc-env=RUSTC_BOOTSTRAP=1");
115+
println!("cargo::rustc-env=RUSTC_BOOTSTRAP=1");
116116
}
117117
"#;
118118
let p = project()

tests/testsuite/build_script_extra_link_arg.rs

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ fn build_script_extra_link_arg_bin() {
1616
"build.rs",
1717
r#"
1818
fn main() {
19-
println!("cargo:rustc-link-arg-bins=--this-is-a-bogus-flag");
19+
println!("cargo::rustc-link-arg-bins=--this-is-a-bogus-flag");
2020
}
2121
"#,
2222
)
@@ -53,9 +53,9 @@ fn build_script_extra_link_arg_bin_single() {
5353
"build.rs",
5454
r#"
5555
fn main() {
56-
println!("cargo:rustc-link-arg-bins=--bogus-flag-all");
57-
println!("cargo:rustc-link-arg-bin=foo=--bogus-flag-foo");
58-
println!("cargo:rustc-link-arg-bin=bar=--bogus-flag-bar");
56+
println!("cargo::rustc-link-arg-bins=--bogus-flag-all");
57+
println!("cargo::rustc-link-arg-bin=foo=--bogus-flag-foo");
58+
println!("cargo::rustc-link-arg-bin=bar=--bogus-flag-bar");
5959
}
6060
"#,
6161
)
@@ -81,7 +81,7 @@ fn build_script_extra_link_arg() {
8181
"build.rs",
8282
r#"
8383
fn main() {
84-
println!("cargo:rustc-link-arg=--this-is-a-bogus-flag");
84+
println!("cargo::rustc-link-arg=--this-is-a-bogus-flag");
8585
}
8686
"#,
8787
)
@@ -102,7 +102,7 @@ fn link_arg_missing_target() {
102102
.file("src/lib.rs", "")
103103
.file(
104104
"build.rs",
105-
r#"fn main() { println!("cargo:rustc-link-arg-cdylib=--bogus"); }"#,
105+
r#"fn main() { println!("cargo::rustc-link-arg-cdylib=--bogus"); }"#,
106106
)
107107
.build();
108108

@@ -112,53 +112,53 @@ fn link_arg_missing_target() {
112112
// .with_status(101)
113113
// .with_stderr("\
114114
// [COMPILING] foo [..]
115-
// error: invalid instruction `cargo:rustc-link-arg-cdylib` from build script of `foo v0.0.1 ([ROOT]/foo)`
115+
// error: invalid instruction `cargo::rustc-link-arg-cdylib` from build script of `foo v0.0.1 ([ROOT]/foo)`
116116
// The package foo v0.0.1 ([ROOT]/foo) does not have a cdylib target.
117117
// ")
118118
// .run();
119119

120120
p.change_file(
121121
"build.rs",
122-
r#"fn main() { println!("cargo:rustc-link-arg-bins=--bogus"); }"#,
122+
r#"fn main() { println!("cargo::rustc-link-arg-bins=--bogus"); }"#,
123123
);
124124

125125
p.cargo("check")
126126
.with_status(101)
127127
.with_stderr("\
128128
[COMPILING] foo [..]
129-
error: invalid instruction `cargo:rustc-link-arg-bins` from build script of `foo v0.0.1 ([ROOT]/foo)`
129+
error: invalid instruction `cargo::rustc-link-arg-bins` from build script of `foo v0.0.1 ([ROOT]/foo)`
130130
The package foo v0.0.1 ([ROOT]/foo) does not have a bin target.
131131
")
132132
.run();
133133

134134
p.change_file(
135135
"build.rs",
136-
r#"fn main() { println!("cargo:rustc-link-arg-bin=abc=--bogus"); }"#,
136+
r#"fn main() { println!("cargo::rustc-link-arg-bin=abc=--bogus"); }"#,
137137
);
138138

139139
p.cargo("check")
140140
.with_status(101)
141141
.with_stderr(
142142
"\
143143
[COMPILING] foo [..]
144-
error: invalid instruction `cargo:rustc-link-arg-bin` from build script of `foo v0.0.1 ([ROOT]/foo)`
144+
error: invalid instruction `cargo::rustc-link-arg-bin` from build script of `foo v0.0.1 ([ROOT]/foo)`
145145
The package foo v0.0.1 ([ROOT]/foo) does not have a bin target with the name `abc`.
146146
",
147147
)
148148
.run();
149149

150150
p.change_file(
151151
"build.rs",
152-
r#"fn main() { println!("cargo:rustc-link-arg-bin=abc"); }"#,
152+
r#"fn main() { println!("cargo::rustc-link-arg-bin=abc"); }"#,
153153
);
154154

155155
p.cargo("check")
156156
.with_status(101)
157157
.with_stderr(
158158
"\
159159
[COMPILING] foo [..]
160-
error: invalid instruction `cargo:rustc-link-arg-bin=abc` from build script of `foo v0.0.1 ([ROOT]/foo)`
161-
The instruction should have the form cargo:rustc-link-arg-bin=BIN=ARG
160+
error: invalid instruction `cargo::rustc-link-arg-bin=abc` from build script of `foo v0.0.1 ([ROOT]/foo)`
161+
The instruction should have the form cargo::rustc-link-arg-bin=BIN=ARG
162162
",
163163
)
164164
.run();
@@ -192,7 +192,7 @@ fn cdylib_link_arg_transitive() {
192192
"bar/build.rs",
193193
r#"
194194
fn main() {
195-
println!("cargo:rustc-link-arg-cdylib=--bogus");
195+
println!("cargo::rustc-link-arg-cdylib=--bogus");
196196
}
197197
"#,
198198
)
@@ -204,7 +204,7 @@ fn cdylib_link_arg_transitive() {
204204
[COMPILING] bar v1.0.0 [..]
205205
[RUNNING] `rustc --crate-name build_script_build bar/build.rs [..]
206206
[RUNNING] `[..]build-script-build[..]
207-
warning: [email protected]: cargo:rustc-link-arg-cdylib was specified in the build script of bar v1.0.0 \
207+
warning: [email protected]: cargo::rustc-link-arg-cdylib was specified in the build script of bar v1.0.0 \
208208
([ROOT]/foo/bar), but that package does not contain a cdylib target
209209
210210
Allowing this was an unintended change in the 1.50 release, and may become an error in \
@@ -230,7 +230,7 @@ fn link_arg_transitive_not_allowed() {
230230
"build.rs",
231231
r#"
232232
fn main() {
233-
println!("cargo:rustc-link-arg=--bogus");
233+
println!("cargo::rustc-link-arg=--bogus");
234234
}
235235
"#,
236236
)
@@ -289,7 +289,7 @@ fn link_arg_with_doctest() {
289289
"build.rs",
290290
r#"
291291
fn main() {
292-
println!("cargo:rustc-link-arg=--this-is-a-bogus-flag");
292+
println!("cargo::rustc-link-arg=--this-is-a-bogus-flag");
293293
}
294294
"#,
295295
)
@@ -313,7 +313,7 @@ fn build_script_extra_link_arg_tests() {
313313
"build.rs",
314314
r#"
315315
fn main() {
316-
println!("cargo:rustc-link-arg-tests=--this-is-a-bogus-flag");
316+
println!("cargo::rustc-link-arg-tests=--this-is-a-bogus-flag");
317317
}
318318
"#,
319319
)
@@ -337,7 +337,7 @@ fn build_script_extra_link_arg_benches() {
337337
"build.rs",
338338
r#"
339339
fn main() {
340-
println!("cargo:rustc-link-arg-benches=--this-is-a-bogus-flag");
340+
println!("cargo::rustc-link-arg-benches=--this-is-a-bogus-flag");
341341
}
342342
"#,
343343
)
@@ -361,7 +361,7 @@ fn build_script_extra_link_arg_examples() {
361361
"build.rs",
362362
r#"
363363
fn main() {
364-
println!("cargo:rustc-link-arg-examples=--this-is-a-bogus-flag");
364+
println!("cargo::rustc-link-arg-examples=--this-is-a-bogus-flag");
365365
}
366366
"#,
367367
)

tests/testsuite/check_cfg.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,7 @@ fn build_script_feedback() {
343343
.file("src/main.rs", "fn main() {}")
344344
.file(
345345
"build.rs",
346-
r#"fn main() { println!("cargo:rustc-check-cfg=cfg(foo)"); }"#,
346+
r#"fn main() { println!("cargo::rustc-check-cfg=cfg(foo)"); }"#,
347347
)
348348
.build();
349349

@@ -369,7 +369,7 @@ fn build_script_doc() {
369369
.file("src/main.rs", "fn main() {}")
370370
.file(
371371
"build.rs",
372-
r#"fn main() { println!("cargo:rustc-check-cfg=cfg(foo)"); }"#,
372+
r#"fn main() { println!("cargo::rustc-check-cfg=cfg(foo)"); }"#,
373373
)
374374
.build();
375375

@@ -478,8 +478,8 @@ fn build_script_test() {
478478
.file(
479479
"build.rs",
480480
r#"fn main() {
481-
println!("cargo:rustc-check-cfg=cfg(foo)");
482-
println!("cargo:rustc-cfg=foo");
481+
println!("cargo::rustc-check-cfg=cfg(foo)");
482+
println!("cargo::rustc-cfg=foo");
483483
}"#,
484484
)
485485
.file(

tests/testsuite/cross_compile.rs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -721,7 +721,7 @@ fn build_script_needed_for_host_and_target() {
721721
use std::env;
722722
fn main() {
723723
let target = env::var("TARGET").unwrap();
724-
println!("cargo:rustc-flags=-L /path/to/{}", target);
724+
println!("cargo::rustc-flags=-L /path/to/{}", target);
725725
}
726726
"#,
727727
)
@@ -1098,7 +1098,10 @@ fn platform_specific_variables_reflected_in_build_scripts() {
10981098
build = "build.rs"
10991099
"#,
11001100
)
1101-
.file("d1/build.rs", r#"fn main() { println!("cargo:val=1") }"#)
1101+
.file(
1102+
"d1/build.rs",
1103+
r#"fn main() { println!("cargo::metadata=val=1") }"#,
1104+
)
11021105
.file("d1/src/lib.rs", "")
11031106
.file(
11041107
"d2/Cargo.toml",
@@ -1111,7 +1114,10 @@ fn platform_specific_variables_reflected_in_build_scripts() {
11111114
build = "build.rs"
11121115
"#,
11131116
)
1114-
.file("d2/build.rs", r#"fn main() { println!("cargo:val=1") }"#)
1117+
.file(
1118+
"d2/build.rs",
1119+
r#"fn main() { println!("cargo::metadata=val=1") }"#,
1120+
)
11151121
.file("d2/src/lib.rs", "")
11161122
.build();
11171123

tests/testsuite/dep_info.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -570,7 +570,7 @@ fn non_local_build_script() {
570570
"build.rs",
571571
r#"
572572
fn main() {
573-
println!("cargo:rerun-if-changed=build.rs");
573+
println!("cargo::rerun-if-changed=build.rs");
574574
}
575575
"#,
576576
)

tests/testsuite/doc.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1021,7 +1021,7 @@ fn features() {
10211021
"bar/build.rs",
10221022
r#"
10231023
fn main() {
1024-
println!("cargo:rustc-cfg=bar");
1024+
println!("cargo::rustc-cfg=bar");
10251025
}
10261026
"#,
10271027
)

tests/testsuite/features2.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -494,7 +494,7 @@ fn build_script_runtime_features() {
494494
if is_set("CARGO_FEATURE_BUILD") {
495495
res |= 4;
496496
}
497-
println!("cargo:rustc-cfg=RunCustomBuild=\"{}\"", res);
497+
println!("cargo::rustc-cfg=RunCustomBuild=\"{}\"", res);
498498
499499
let mut res = 0;
500500
if cfg!(feature = "normal") {
@@ -506,7 +506,7 @@ fn build_script_runtime_features() {
506506
if cfg!(feature = "build") {
507507
res |= 4;
508508
}
509-
println!("cargo:rustc-cfg=CustomBuild=\"{}\"", res);
509+
println!("cargo::rustc-cfg=CustomBuild=\"{}\"", res);
510510
}
511511
"#,
512512
)
@@ -562,7 +562,7 @@ fn build_script_runtime_features() {
562562
r#"
563563
fn main() {
564564
assert_eq!(common::foo(), common::build_time());
565-
println!("cargo:rustc-cfg=from_build=\"{}\"", common::foo());
565+
println!("cargo::rustc-cfg=from_build=\"{}\"", common::foo());
566566
}
567567
"#,
568568
)
@@ -1792,8 +1792,8 @@ fn shared_dep_same_but_dependencies() {
17921792
"subdep/src/lib.rs",
17931793
r#"
17941794
pub fn feat_func() {
1795-
#[cfg(feature = "feat")] println!("cargo:warning=feat: enabled");
1796-
#[cfg(not(feature = "feat"))] println!("cargo:warning=feat: not enabled");
1795+
#[cfg(feature = "feat")] println!("cargo::warning=feat: enabled");
1796+
#[cfg(not(feature = "feat"))] println!("cargo::warning=feat: not enabled");
17971797
}
17981798
"#,
17991799
)
@@ -1813,7 +1813,7 @@ warning: [email protected]: feat: enabled
18131813
)
18141814
.run();
18151815
p.process(p.bin("bin1"))
1816-
.with_stdout("cargo:warning=feat: not enabled")
1816+
.with_stdout("cargo::warning=feat: not enabled")
18171817
.run();
18181818

18191819
// Make sure everything stays cached.

0 commit comments

Comments
 (0)