Add RustcPerf bootstrap tool

So that it is easier to use `rustc-perf` with `rustc` directly.
This commit is contained in:
Jakub Beránek 2024-06-12 09:54:08 +02:00 committed by Jakub Beránek
parent 9ec178df0b
commit 9e0b76201b
2 changed files with 46 additions and 1 deletions

View file

@ -358,6 +358,50 @@ impl Step for OptimizedDist {
}
}
/// The [rustc-perf](https://github.com/rust-lang/rustc-perf) benchmark suite, which is added
/// as a submodule at `src/tools/rustc-perf`.
#[derive(Debug, Clone, Hash, PartialEq, Eq)]
pub struct RustcPerf {
pub compiler: Compiler,
pub target: TargetSelection,
}
impl Step for RustcPerf {
/// Path to the built `collector` binary.
type Output = PathBuf;
fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
run.path("src/tools/rustc-perf")
}
fn make_run(run: RunConfig<'_>) {
run.builder.ensure(RustcPerf {
compiler: run.builder.compiler(0, run.builder.config.build),
target: run.target,
});
}
fn run(self, builder: &Builder<'_>) -> PathBuf {
// We need to ensure the rustc-perf submodule is initialized.
builder.update_submodule(Path::new("src/tools/rustc-perf"));
let target = builder.ensure(ToolBuild {
compiler: self.compiler,
target: self.target,
tool: "collector",
mode: Mode::ToolBootstrap,
path: "src/tools/rustc-perf",
source_type: SourceType::Submodule,
extra_features: Vec::new(),
allow_features: "",
// Only build the collector package, which is used for benchmarking through
// a CLI.
cargo_args: vec!["-p".to_string(), "collector".to_string()],
});
target
}
}
#[derive(Debug, Clone, Hash, PartialEq, Eq, Ord, PartialOrd)]
pub struct ErrorIndex {
pub compiler: Compiler,

View file

@ -750,7 +750,8 @@ impl<'a> Builder<'a> {
tool::RustdocGUITest,
tool::OptimizedDist,
tool::CoverageDump,
tool::LlvmBitcodeLinker
tool::LlvmBitcodeLinker,
tool::RustcPerf,
),
Kind::Clippy => describe!(
clippy::Std,