From f08772ec2f17a073571a93ea9584b4d9176e0947 Mon Sep 17 00:00:00 2001 From: Tamir Duberstein Date: Sat, 5 Jul 2025 15:41:28 -0400 Subject: [PATCH] test-distro: enable rust backtrace --- test-distro/src/init.rs | 15 ++++++++++----- xtask/src/run.rs | 6 +++++- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/test-distro/src/init.rs b/test-distro/src/init.rs index 2b78ceff..e9030bc7 100644 --- a/test-distro/src/init.rs +++ b/test-distro/src/init.rs @@ -134,16 +134,21 @@ fn run() -> anyhow::Result<()> { .map(|entry| { let entry = entry.context("read_dir(/bin) failed")?; let path = entry.path(); - let status = std::process::Command::new(&path) - .args(&args) - .env("RUST_LOG", "debug") + let mut cmd = std::process::Command::new(&path); + cmd.args(&args) + .env("RUST_BACKTRACE", "1") + .env("RUST_LOG", "debug"); + + println!("running {cmd:?}"); + + let status = cmd .status() - .with_context(|| format!("failed to execute {}", path.display()))?; + .with_context(|| format!("failed to run {cmd:?}"))?; if status.code() == Some(0) { Ok(()) } else { - Err(anyhow::anyhow!("{} failed: {status:?}", path.display())) + Err(anyhow::anyhow!("{cmd:?} failed: {status:?}")) } }) .filter_map(|result| { diff --git a/xtask/src/run.rs b/xtask/src/run.rs index 218642c1..8902d37a 100644 --- a/xtask/src/run.rs +++ b/xtask/src/run.rs @@ -184,7 +184,11 @@ pub fn run(opts: Options) -> Result<()> { for (profile, binaries) in binaries { for (name, binary) in binaries { let mut cmd = Command::new(runner); - let cmd = cmd.args(args.iter()).arg(binary).args(run_args.clone()); + cmd.args(args.iter()) + .arg(binary) + .args(run_args.clone()) + .env("RUST_BACKTRACE", "1") + .env("RUST_LOG", "debug"); println!("{profile}:{name} running {cmd:?}");