Skip to content

Commit 2e1f2a8

Browse files
authored
chore: add more error messaging for bencher (#383)
1 parent 28bfc4e commit 2e1f2a8

File tree

1 file changed

+26
-4
lines changed

1 file changed

+26
-4
lines changed

crates/xtask/src/main.rs

+26-4
Original file line numberDiff line numberDiff line change
@@ -1217,10 +1217,10 @@ impl Xtasks {
12171217
fn bench(app_settings: GlobalArgs) -> Result<()> {
12181218
// first of all figure out which branch we're on
12191219
// run // git rev-parse --abbrev-ref HEAD
1220-
1220+
let workspace_dir = Self::workspace_dir(&app_settings).unwrap();
12211221
let command = Command::new("git")
12221222
.args(["rev-parse", "--abbrev-ref", "HEAD"])
1223-
.current_dir(Self::workspace_dir(&app_settings).unwrap())
1223+
.current_dir(workspace_dir.clone())
12241224
.output()
12251225
.with_context(|| "Trying to figure out which branch we're on in benchmarking")?;
12261226
let branch = String::from_utf8(command.stdout)?;
@@ -1251,7 +1251,6 @@ impl Xtasks {
12511251
bencher_cmd
12521252
.stdout(std::process::Stdio::inherit())
12531253
.stderr(std::process::Stdio::inherit())
1254-
.current_dir(Self::workspace_dir(&app_settings).unwrap())
12551254
.arg("run")
12561255
.args(["--project", "bms"])
12571256
.args(["--branch", &format!("\"{branch}\"")])
@@ -1277,7 +1276,11 @@ impl Xtasks {
12771276
.args(["--adapter", "rust_criterion"])
12781277
.arg("cargo bench --features=lua54");
12791278

1280-
let out = bencher_cmd.output()?;
1279+
log::info!("Running bencher command: {:?}", bencher_cmd);
1280+
1281+
let out = bencher_cmd
1282+
.output()
1283+
.with_context(|| "Could not trigger bencher command")?;
12811284
if !out.status.success() {
12821285
bail!("Failed to run bencher: {:?}", out);
12831286
}
@@ -1495,6 +1498,25 @@ impl Xtasks {
14951498
)?;
14961499
}
14971500

1501+
// install bencher
1502+
// linux curl --proto '=https' --tlsv1.2 -sSfL https://bencher.dev/download/install-cli.sh | sh
1503+
// windows irm https://bencher.dev/download/install-cli.ps1 | iex
1504+
Self::run_system_command(
1505+
&app_settings,
1506+
"cargo",
1507+
"Failed to install bencher",
1508+
vec![
1509+
"install",
1510+
"--git",
1511+
"https://github.com/bencherdev/bencher",
1512+
"--branch",
1513+
"main",
1514+
"--locked",
1515+
"--force",
1516+
"bencher_cli",
1517+
],
1518+
None,
1519+
)?;
14981520
// install cargo mdbook
14991521
Self::run_system_command(
15001522
&app_settings,

0 commit comments

Comments
 (0)