Skip to content

Commit bf64bce

Browse files
committed
ctest: Better error propagation after macro expansion
1 parent 37638a6 commit bf64bce

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

ctest-next/src/macro_expansion.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ pub fn expand<P: AsRef<Path>>(crate_path: P, cfg: &[(String, Option<String>)]) -
2828

2929
if !output.status.success() {
3030
let error = std::str::from_utf8(&output.stderr)?;
31-
return Err(error.into());
31+
return Err(format!("process failed with {}: {}", output.status, error).into());
3232
}
3333

3434
let expanded = std::str::from_utf8(&output.stdout)?.to_string();

ctest-next/src/runner.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,8 @@ pub fn __compile_test(
146146

147147
let output = cmd.output()?;
148148
if !output.status.success() {
149-
return Err(std::str::from_utf8(&output.stderr)?.into());
149+
let stderr = std::str::from_utf8(&output.stderr)?
150+
return Err(format!("compile test failed with {}: {}", output.status, stderr).into());
150151
}
151152

152153
Ok(binary_path)
@@ -171,7 +172,8 @@ pub fn __run_test<P: AsRef<Path>>(test_binary: P) -> Result<String> {
171172
let output = cmd.output()?;
172173

173174
if !output.status.success() {
174-
return Err(std::str::from_utf8(&output.stderr)?.into());
175+
let stderr = std::str::from_utf8(&output.stderr)?
176+
return Err(format!("run test failed with {}: {}", output.status, stderr).into());
175177
}
176178

177179
Ok(std::str::from_utf8(&output.stdout)?.to_string())

0 commit comments

Comments
 (0)