Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate issue-37839, track-path-dep-info and track-pgo-dep-info run-make tests to rmake #127378

Merged
merged 3 commits into from
Jul 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/tools/run-make-support/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ pub use llvm::{
LlvmProfdata, LlvmReadobj,
};
pub use run::{cmd, run, run_fail, run_with_args};
pub use rustc::{aux_build, rustc, Rustc};
pub use rustc::{aux_build, bare_rustc, rustc, Rustc};
pub use rustdoc::{bare_rustdoc, rustdoc, Rustdoc};

#[track_caller]
Expand Down
15 changes: 14 additions & 1 deletion src/tools/run-make-support/src/rustc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ pub fn rustc() -> Rustc {
Rustc::new()
}

/// Construct a plain `rustc` invocation with no flags set.
#[track_caller]
pub fn bare_rustc() -> Rustc {
Rustc::bare()
}

/// Construct a new `rustc` aux-build invocation.
#[track_caller]
pub fn aux_build() -> Rustc {
Expand All @@ -30,7 +36,6 @@ fn setup_common() -> Command {
let rustc = env_var("RUSTC");
let mut cmd = Command::new(rustc);
set_host_rpath(&mut cmd);
cmd.arg("-L").arg(cwd());
cmd
}

Expand All @@ -40,6 +45,14 @@ impl Rustc {
/// Construct a new `rustc` invocation.
#[track_caller]
pub fn new() -> Self {
let mut cmd = setup_common();
cmd.arg("-L").arg(cwd());
Self { cmd }
}

/// Construct a bare `rustc` invocation with no flags set.
#[track_caller]
pub fn bare() -> Self {
let cmd = setup_common();
Self { cmd }
}
Expand Down
3 changes: 0 additions & 3 deletions src/tools/tidy/src/allowed_run_make_makefiles.txt
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ run-make/issue-28595/Makefile
run-make/issue-33329/Makefile
run-make/issue-35164/Makefile
run-make/issue-36710/Makefile
run-make/issue-37839/Makefile
run-make/issue-47551/Makefile
run-make/issue-69368/Makefile
run-make/issue-83045/Makefile
Expand Down Expand Up @@ -159,8 +158,6 @@ run-make/target-without-atomic-cas/Makefile
run-make/test-benches/Makefile
run-make/thumb-none-cortex-m/Makefile
run-make/thumb-none-qemu/Makefile
run-make/track-path-dep-info/Makefile
run-make/track-pgo-dep-info/Makefile
run-make/translation/Makefile
run-make/type-mismatch-same-crate-name/Makefile
run-make/unstable-flag-required/Makefile
Expand Down
7 changes: 0 additions & 7 deletions tests/run-make/issue-37839/Makefile

This file was deleted.

20 changes: 20 additions & 0 deletions tests/run-make/proc-macro-three-crates/rmake.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// A compiler bug caused the following issue:
// If a crate A depends on crate B, and crate B
// depends on crate C, and crate C contains a procedural
// macro, compiling crate A would fail.
// This was fixed in #37846, and this test checks
// that this bug does not make a resurgence.

use run_make_support::{bare_rustc, cwd, rust_lib_name, rustc};

fn main() {
rustc().input("a.rs").run();
rustc().input("b.rs").run();
let curr_dir = cwd().display().to_string();
bare_rustc()
.input("c.rs")
.arg(format!("-Ldependency={curr_dir}"))
.extern_("b", cwd().join(rust_lib_name("b")))
.out_dir(cwd())
.run();
}
13 changes: 0 additions & 13 deletions tests/run-make/track-path-dep-info/Makefile

This file was deleted.

13 changes: 13 additions & 0 deletions tests/run-make/track-path-dep-info/rmake.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// This test checks the functionality of `tracked_path::path`, a procedural macro
// feature that adds a dependency to another file inside the procmacro. In this case,
// the text file is added through this method, and the test checks that the compilation
// output successfully added the file as a dependency.
// See https://github.com/rust-lang/rust/pull/84029

use run_make_support::{fs_wrapper, rustc};

fn main() {
rustc().input("macro_def.rs").run();
rustc().env("EXISTING_PROC_MACRO_ENV", "1").emit("dep-info").input("macro_use.rs").run();
assert!(fs_wrapper::read_to_string("macro_use.d").contains("emojis.txt:"));
}
25 changes: 0 additions & 25 deletions tests/run-make/track-pgo-dep-info/Makefile

This file was deleted.

23 changes: 23 additions & 0 deletions tests/run-make/track-pgo-dep-info/rmake.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// Emitting dep-info files used to not have any mention of PGO profiles used
// in compilation, which meant these profiles could be changed without consequence.
// After changing this in #100801, this test checks that the profile data is successfully
// included in dep-info emit files.
// See https://github.com/rust-lang/rust/pull/100801

//@ ignore-cross-compile
// Reason: the binary is executed
//@ needs-profiler-support

use run_make_support::{fs_wrapper, llvm_profdata, run, rustc};

fn main() {
// Generate the profile-guided-optimization (PGO) profiles
rustc().profile_generate("profiles").input("main.rs").run();
// Merge the profiles
run("main");
Comment on lines +16 to +17
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question: does this need //@ ignore-cross-compile? Or is that kinda implied by //@ needs-profiler-support (even if it is, maybe having the ignore is clearer?)?

Copy link
Contributor Author

@Oneirical Oneirical Jul 8, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe that it's indeed getting implied by //@ needs-profiler-support (you can see the ignored, ignored when profiler support is disabled in the test log), but I added the ignore + reason for clarity. @rustbot review

llvm_profdata().merge().output("merged.profdata").input("profiles").run();
// Use the profiles in compilation
rustc().profile_use("merged.profdata").emit("dep-info").input("main.rs").run();
// Check that the profile file is in the dep-info emit file
assert!(fs_wrapper::read_to_string("main.d").contains("merged.profdata"));
}
Loading