Skip to content

Commit

Permalink
improve output on test compilation failure
Browse files Browse the repository at this point in the history
  • Loading branch information
scovich committed Nov 1, 2024
1 parent 8664b9d commit 81a660e
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion tests/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,21 @@ fn compile(

println!("Running: {:?}", command);
let out = command.output().expect("failed to compile");
assert!(out.status.success(), "Output failed to compile: {:?}", out);
if !out.status.success() {
let stdout = match str::from_utf8(&out.stdout) {
Ok(s) => s.to_string(),
Err(_) => format!("{:?}", out.stdout),
};
let stderr = match str::from_utf8(&out.stderr) {
Ok(s) => s.to_string(),
Err(_) => format!("{:?}", out.stderr),
};
println!("Output failed to compile: {:?}", out.status);
println!("=== STDOUT ===\n{}", stdout);
println!("=== STDERR ===\n{}", stderr);
println!("==============");
assert!(out.status.success());
}

if object.exists() {
fs::remove_file(object).unwrap();
Expand Down

0 comments on commit 81a660e

Please sign in to comment.