Skip to content

Commit

Permalink
rewrite env-dep-info to rmake
Browse files Browse the repository at this point in the history
  • Loading branch information
Oneirical committed Jul 5, 2024
1 parent c5167c3 commit 21d9855
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 20 deletions.
1 change: 0 additions & 1 deletion src/tools/tidy/src/allowed_run_make_makefiles.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ run-make/dump-mono-stats/Makefile
run-make/emit-path-unhashed/Makefile
run-make/emit-shared-files/Makefile
run-make/emit-to-stdout/Makefile
run-make/env-dep-info/Makefile
run-make/export-executable-symbols/Makefile
run-make/extern-diff-internal-name/Makefile
run-make/extern-flag-disambiguates/Makefile
Expand Down
19 changes: 0 additions & 19 deletions tests/run-make/env-dep-info/Makefile

This file was deleted.

29 changes: 29 additions & 0 deletions tests/run-make/env-dep-info/rmake.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// Inside dep-info emit files, #71858 made it so all accessed environment
// variables are usefully printed. This test checks that this feature works
// as intended by checking if the environment variables used in compilation
// appear in the output dep-info files.
// See https://github.com/rust-lang/rust/issues/40364

use run_make_support::{fs_wrapper, rustc};

// FIXME(Oneirical): try on musl

fn main() {
rustc()
.env("EXISTING_ENV", "1")
.env("EXISTING_OPT_ENV", "1")
.emit("dep-info")
.input("main.rs")
.run();
let dep_info = fs_wrapper::read_to_string("main.d");
assert!(&dep_info.contains("# env-dep:EXISTING_ENV=1"));
assert!(&dep_info.contains("# env-dep:EXISTING_OPT_ENV=1"));
assert!(&dep_info.contains("# env-dep:NONEXISTENT_OPT_ENV"));
assert!(dep_info.contains(r#"# env-dep:ESCAPE\nESCAPE\\"#));
// Procedural macro
rustc().input("macro_def.rs").run();
rustc().env("EXISTING_PROC_MACRO_ENV", "1").emit("dep-info").input("macro_use.rs").run();
let dep_info = fs_wrapper::read_to_string("macro_use.d");
assert!(&dep_info.contains("# env-dep:EXISTING_PROC_MACRO_ENV=1"));
assert!(dep_info.contains("# env-dep:NONEXISTENT_PROC_MACEO_ENV"));
}

0 comments on commit 21d9855

Please sign in to comment.