Skip to content

Commit

Permalink
rewrite track-pgo-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 48a9d4b commit ba1539c
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 28 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 @@ -158,7 +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-pgo-dep-info/Makefile
run-make/translation/Makefile
run-make/type-mismatch-same-crate-name/Makefile
run-make/unstable-flag-required/Makefile
Expand Down
4 changes: 2 additions & 2 deletions tests/run-make/track-path-dep-info/rmake.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@

//FIXME(Oneirical): Try it on musl

use run_make_support::{bare_rustc, fs_wrapper, rustc};
use run_make_support::{fs_wrapper, rustc};

fn main() {
bare_rustc().input("macro_def.rs").run();
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.

22 changes: 22 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,22 @@
// 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

//FIXME(Oneirical): try it on musl
//@ 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");
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"));
}

0 comments on commit ba1539c

Please sign in to comment.