Skip to content

Commit 21d9855

Browse files
committed
rewrite env-dep-info to rmake
1 parent c5167c3 commit 21d9855

File tree

3 files changed

+29
-20
lines changed

3 files changed

+29
-20
lines changed

src/tools/tidy/src/allowed_run_make_makefiles.txt

-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ run-make/dump-mono-stats/Makefile
2626
run-make/emit-path-unhashed/Makefile
2727
run-make/emit-shared-files/Makefile
2828
run-make/emit-to-stdout/Makefile
29-
run-make/env-dep-info/Makefile
3029
run-make/export-executable-symbols/Makefile
3130
run-make/extern-diff-internal-name/Makefile
3231
run-make/extern-flag-disambiguates/Makefile

tests/run-make/env-dep-info/Makefile

-19
This file was deleted.

tests/run-make/env-dep-info/rmake.rs

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
// Inside dep-info emit files, #71858 made it so all accessed environment
2+
// variables are usefully printed. This test checks that this feature works
3+
// as intended by checking if the environment variables used in compilation
4+
// appear in the output dep-info files.
5+
// See https://github.com/rust-lang/rust/issues/40364
6+
7+
use run_make_support::{fs_wrapper, rustc};
8+
9+
// FIXME(Oneirical): try on musl
10+
11+
fn main() {
12+
rustc()
13+
.env("EXISTING_ENV", "1")
14+
.env("EXISTING_OPT_ENV", "1")
15+
.emit("dep-info")
16+
.input("main.rs")
17+
.run();
18+
let dep_info = fs_wrapper::read_to_string("main.d");
19+
assert!(&dep_info.contains("# env-dep:EXISTING_ENV=1"));
20+
assert!(&dep_info.contains("# env-dep:EXISTING_OPT_ENV=1"));
21+
assert!(&dep_info.contains("# env-dep:NONEXISTENT_OPT_ENV"));
22+
assert!(dep_info.contains(r#"# env-dep:ESCAPE\nESCAPE\\"#));
23+
// Procedural macro
24+
rustc().input("macro_def.rs").run();
25+
rustc().env("EXISTING_PROC_MACRO_ENV", "1").emit("dep-info").input("macro_use.rs").run();
26+
let dep_info = fs_wrapper::read_to_string("macro_use.d");
27+
assert!(&dep_info.contains("# env-dep:EXISTING_PROC_MACRO_ENV=1"));
28+
assert!(dep_info.contains("# env-dep:NONEXISTENT_PROC_MACEO_ENV"));
29+
}

0 commit comments

Comments
 (0)