Browse Source

test-distro: enable rust backtrace

Tamir Duberstein 4 days ago
parent
commit
f08772ec2f
2 changed files with 15 additions and 6 deletions
  1. 10 5
      test-distro/src/init.rs
  2. 5 1
      xtask/src/run.rs

+ 10 - 5
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| {

+ 5 - 1
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:?}");