Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 8685a17

Browse files
committedJul 6, 2024
Auto merge of #127378 - Oneirical:cetestial-meteorite, r=<try>
Migrate `issue-37839`, `track-path-dep-info` and `track-pgo-dep-info` `run-make` tests to rmake Part of #121876 and the associated [Google Summer of Code project](https://blog.rust-lang.org/2024/05/01/gsoc-2024-selected-projects.html). Please try: try-job: test-various try-job: dist-x86_64-musl
2 parents 51917e2 + ba1539c commit 8685a17

File tree

12 files changed

+74
-50
lines changed

12 files changed

+74
-50
lines changed
 

‎src/tools/run-make-support/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ pub use llvm::{
3535
LlvmProfdata, LlvmReadobj,
3636
};
3737
pub use run::{cmd, run, run_fail, run_with_args};
38-
pub use rustc::{aux_build, rustc, Rustc};
38+
pub use rustc::{aux_build, bare_rustc, rustc, Rustc};
3939
pub use rustdoc::{bare_rustdoc, rustdoc, Rustdoc};
4040

4141
#[track_caller]

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

+14-1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,12 @@ pub fn rustc() -> Rustc {
1010
Rustc::new()
1111
}
1212

13+
/// Construct a plain `rustc` invocation with no flags set.
14+
#[track_caller]
15+
pub fn bare_rustc() -> Rustc {
16+
Rustc::bare()
17+
}
18+
1319
/// Construct a new `rustc` aux-build invocation.
1420
#[track_caller]
1521
pub fn aux_build() -> Rustc {
@@ -30,7 +36,6 @@ fn setup_common() -> Command {
3036
let rustc = env_var("RUSTC");
3137
let mut cmd = Command::new(rustc);
3238
set_host_rpath(&mut cmd);
33-
cmd.arg("-L").arg(cwd());
3439
cmd
3540
}
3641

@@ -40,6 +45,14 @@ impl Rustc {
4045
/// Construct a new `rustc` invocation.
4146
#[track_caller]
4247
pub fn new() -> Self {
48+
let mut cmd = setup_common();
49+
cmd.arg("-L").arg(cwd());
50+
Self { cmd }
51+
}
52+
53+
/// Construct a bare `rustc` invocation with no flags set.
54+
#[track_caller]
55+
pub fn bare() -> Self {
4356
let cmd = setup_common();
4457
Self { cmd }
4558
}

‎src/tools/tidy/src/allowed_run_make_makefiles.txt

-3
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@ run-make/issue-28595/Makefile
6262
run-make/issue-33329/Makefile
6363
run-make/issue-35164/Makefile
6464
run-make/issue-36710/Makefile
65-
run-make/issue-37839/Makefile
6665
run-make/issue-47551/Makefile
6766
run-make/issue-69368/Makefile
6867
run-make/issue-83045/Makefile
@@ -156,8 +155,6 @@ run-make/target-without-atomic-cas/Makefile
156155
run-make/test-benches/Makefile
157156
run-make/thumb-none-cortex-m/Makefile
158157
run-make/thumb-none-qemu/Makefile
159-
run-make/track-path-dep-info/Makefile
160-
run-make/track-pgo-dep-info/Makefile
161158
run-make/translation/Makefile
162159
run-make/type-mismatch-same-crate-name/Makefile
163160
run-make/unstable-flag-required/Makefile

‎tests/run-make/issue-37839/Makefile

-7
This file was deleted.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// A compiler bug caused the following issue:
2+
// If a crate A depends on crate B, and crate B
3+
// depends on crate C, and crate C contains a procedural
4+
// macro, compiling crate A would fail.
5+
// This was fixed in #37846, and this test checks
6+
// that this bug does not make a resurgence.
7+
8+
//FIXME(Oneirical): ignore-cross-compile
9+
10+
use run_make_support::{bare_rustc, cwd, rust_lib_name, rustc};
11+
12+
fn main() {
13+
rustc().input("a.rs").run();
14+
rustc().input("b.rs").run();
15+
let curr_dir = cwd().display().to_string();
16+
bare_rustc()
17+
.input("c.rs")
18+
.arg(format!("-Ldependency={curr_dir}"))
19+
.extern_("b", cwd().join(rust_lib_name("b")))
20+
.out_dir(cwd())
21+
.run();
22+
}

‎tests/run-make/track-path-dep-info/Makefile

-13
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// This test checks the functionality of `tracked_path::path`, a procedural macro
2+
// feature that adds a dependency to another file inside the procmacro. In this case,
3+
// the text file is added through this method, and the test checks that the compilation
4+
// output successfully added the file as a dependency.
5+
// See https://github.com/rust-lang/rust/pull/84029
6+
7+
//FIXME(Oneirical): Try it on musl
8+
9+
use run_make_support::{fs_wrapper, rustc};
10+
11+
fn main() {
12+
rustc().input("macro_def.rs").run();
13+
rustc().env("EXISTING_PROC_MACRO_ENV", "1").emit("dep-info").input("macro_use.rs").run();
14+
assert!(fs_wrapper::read_to_string("macro_use.d").contains("emojis.txt:"));
15+
}

‎tests/run-make/track-pgo-dep-info/Makefile

-25
This file was deleted.
+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// Emitting dep-info files used to not have any mention of PGO profiles used
2+
// in compilation, which meant these profiles could be changed without consequence.
3+
// After changing this in #100801, this test checks that the profile data is successfully
4+
// included in dep-info emit files.
5+
// See https://github.com/rust-lang/rust/pull/100801
6+
7+
//FIXME(Oneirical): try it on musl
8+
//@ needs-profiler-support
9+
10+
use run_make_support::{fs_wrapper, llvm_profdata, run, rustc};
11+
12+
fn main() {
13+
// Generate the profile-guided-optimization (PGO) profiles
14+
rustc().profile_generate("profiles").input("main.rs").run();
15+
// Merge the profiles
16+
run("main");
17+
llvm_profdata().merge().output("merged.profdata").input("profiles").run();
18+
// Use the profiles in compilation
19+
rustc().profile_use("merged.profdata").emit("dep-info").input("main.rs").run();
20+
// Check that the profile file is in the dep-info emit file
21+
assert!(fs_wrapper::read_to_string("main.d").contains("merged.profdata"));
22+
}

0 commit comments

Comments
 (0)
Failed to load comments.