Skip to content

Commit 566f362

Browse files
authored
Merge pull request #2398 from the8472/pre-run-command
env var to run a command before every benchmark run
2 parents 8ee2ffb + 18a9bcb commit 566f362

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

collector/src/bin/collector.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1531,6 +1531,20 @@ async fn run_benchmark_job(
15311531
)));
15321532
}
15331533

1534+
// Command launched before a benchmark suite. Useful to run an external root helper
1535+
// that brings the system in a consistent state.
1536+
if let Ok(pre_run) = std::env::var("RUSTC_PERF_PRE_RUN_COMMAND") {
1537+
// split by ascii unit separator
1538+
let commandline = pre_run.split('\x1f').collect::<Vec<_>>();
1539+
let mut cmd = tokio::process::Command::new(commandline[0]);
1540+
cmd.args(&commandline[1..]);
1541+
cmd.status().await.map_err(|error| {
1542+
BenchmarkJobError::Permanent(anyhow::anyhow!(
1543+
"Failed to execute RUSTC_PERF_PRE_RUN_COMMAND `{pre_run}`: {error:?}"
1544+
))
1545+
})?;
1546+
}
1547+
15341548
log::info!("Downloading sysroot");
15351549
let toolchain = match &artifact_id {
15361550
ArtifactId::Commit(commit) => {

0 commit comments

Comments
 (0)