Skip to content

Commit 1d3c426

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

File tree

9 files changed

+49
-28
lines changed

9 files changed

+49
-28
lines changed

src/tools/run-make-support/src/rustc.rs

+8-4
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,22 @@ use std::path::Path;
44

55
use crate::{command, cwd, env_var, set_host_rpath};
66

7-
/// Construct a new `rustc` invocation.
7+
/// Construct a new `rustc` invocation. This will automatically set the library
8+
/// search path as `-L cwd()`. Use [`bare_rustc`] to avoid this.
89
#[track_caller]
910
pub fn rustc() -> Rustc {
1011
Rustc::new()
1112
}
1213

13-
/// Construct a plain `rustc` invocation with no flags set.
14+
/// Construct a plain `rustc` invocation with no flags set. Note that compiletest
15+
/// still presets the environment variables `HOST_RPATH_DIR` and `TARGET_RPATH_DIR`
16+
/// by default.
1417
#[track_caller]
1518
pub fn bare_rustc() -> Rustc {
1619
Rustc::bare()
1720
}
1821

19-
// Construct a new `rustc` aux-build invocation.
22+
/// Construct a new `rustc` aux-build invocation.
2023
#[track_caller]
2124
pub fn aux_build() -> Rustc {
2225
Rustc::new_aux_build()
@@ -42,7 +45,8 @@ fn setup_common() -> Command {
4245
impl Rustc {
4346
// `rustc` invocation constructor methods
4447

45-
/// Construct a new `rustc` invocation.
48+
/// Construct a new `rustc` invocation. This will automatically set the library
49+
/// search path as `-L cwd()`. Use [`bare_rustc`] to avoid this.
4650
#[track_caller]
4751
pub fn new() -> Self {
4852
let mut cmd = setup_common();

src/tools/tidy/src/allowed_run_make_makefiles.txt

-2
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
@@ -65,7 +64,6 @@ run-make/issue-36710/Makefile
6564
run-make/issue-37839/Makefile
6665
run-make/issue-47551/Makefile
6766
run-make/issue-69368/Makefile
68-
run-make/issue-83045/Makefile
6967
run-make/issue-83112-incr-test-moved-file/Makefile
7068
run-make/issue-84395-lto-embed-bitcode/Makefile
7169
run-make/issue-85019-moved-src-dir/Makefile

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

-19
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
macro_use.d: macro_use.rs
2+
3+
macro_use.rs:
4+
5+
# env-dep:EXISTING_PROC_MACRO_ENV=1
6+
# env-dep:NONEXISTENT_PROC_MACEO_ENV
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
main.d: main.rs
2+
3+
main.rs:
4+
5+
# env-dep:ESCAPE\nESCAPE\\
6+
# env-dep:EXISTING_ENV=1
7+
# env-dep:EXISTING_OPT_ENV=1
8+
# env-dep:NONEXISTENT_OPT_ENV

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

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
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::{diff, rustc};
8+
9+
fn main() {
10+
rustc()
11+
.env("EXISTING_ENV", "1")
12+
.env("EXISTING_OPT_ENV", "1")
13+
.emit("dep-info")
14+
.input("main.rs")
15+
.run();
16+
diff().expected_file("correct_main.d").actual_file("main.d").run();
17+
// Procedural macro
18+
rustc().input("macro_def.rs").run();
19+
rustc().env("EXISTING_PROC_MACRO_ENV", "1").emit("dep-info").input("macro_use.rs").run();
20+
diff().expected_file("correct_macro.d").actual_file("macro_use.d").run();
21+
}

tests/run-make/ice-dep-cannot-find-dep/rmake.rs

-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ fn main() {
2727
.input("b.rs")
2828
.arg("--verbose")
2929
.run();
30-
fs_wrapper::create_dir("wrong_directory");
3130
bare_rustc()
3231
.extern_("b", rust_lib_name("b"))
3332
.crate_type("rlib")
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
bar.d: bar.rs
2+
3+
bar.rs:

tests/run-make/rustc-macro-dep-files/rmake.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,11 @@
44
// that macro code is not falsely seen as coming from a different file in dep-info.
55
// See https://github.com/rust-lang/rust/issues/36625
66

7-
use run_make_support::{fs_wrapper, rustc, target};
7+
use run_make_support::{diff, rustc, target};
88

99
fn main() {
1010
rustc().input("foo.rs").run();
1111
rustc().input("bar.rs").target(target()).emit("dep-info").run();
12-
assert!(!fs_wrapper::read_to_string("bar.d").contains("proc-macro source"));
12+
// The emitted file should not contain "proc-macro source".
13+
diff().expected_file("correct.d").actual_file("bar.d").run();
1314
}

0 commit comments

Comments
 (0)