Skip to content

Commit 0844e46

Browse files
committed
Auto merge of #2391 - RalfJung:stderr, r=oli-obk
on an error, always print the unnormalized stderr Currently we skip this if a stderr diff was printed, but the stderr diff is normalized, so e.g. one cannot learn line numbers from it. Is there a way to get the diff to only print the parts the differ, like a usual `diff -u`? Currently it always seems to print the full output, so with a long stderr we now get doubly long test results even if the diff is actually rather small.
2 parents 90fbdad + 9f9aa00 commit 0844e46

File tree

1 file changed

+6
-13
lines changed

1 file changed

+6
-13
lines changed

ui_test/src/lib.rs

+6-13
Original file line numberDiff line numberDiff line change
@@ -164,15 +164,14 @@ pub fn run_tests(config: Config) -> Result<()> {
164164
if !failures.is_empty() {
165165
for (path, miri, revision, errors, stderr) in &failures {
166166
eprintln!();
167-
eprint!("{}", path.display().to_string().underline());
167+
eprint!("{}", path.display().to_string().underline().bold());
168168
if !revision.is_empty() {
169169
eprint!(" (revision `{}`)", revision);
170170
}
171-
eprint!(" {}", "FAILED".red());
171+
eprint!(" {}", "FAILED:".red().bold());
172172
eprintln!();
173173
eprintln!("command: {:?}", miri);
174174
eprintln!();
175-
let mut dump_stderr = true;
176175
for error in errors {
177176
match error {
178177
Error::ExitStatus(mode, exit_status) => eprintln!("{mode:?} got {exit_status}"),
@@ -194,9 +193,6 @@ pub fn run_tests(config: Config) -> Result<()> {
194193
Error::PatternFoundInPassTest =>
195194
eprintln!("{}", "error pattern found in success test".red()),
196195
Error::OutputDiffers { path, actual, expected } => {
197-
if path.extension().unwrap() == "stderr" {
198-
dump_stderr = false;
199-
}
200196
eprintln!("actual output differed from expected {}", path.display());
201197
eprintln!("{}", pretty_assertions::StrComparison::new(expected, actual));
202198
eprintln!()
@@ -223,14 +219,11 @@ pub fn run_tests(config: Config) -> Result<()> {
223219
}
224220
eprintln!();
225221
}
226-
// Unless we already dumped the stderr via an OutputDiffers diff, let's dump it here.
227-
if dump_stderr {
228-
eprintln!("actual stderr:");
229-
eprintln!("{}", stderr);
230-
eprintln!();
231-
}
222+
eprintln!("full stderr:");
223+
eprintln!("{}", stderr);
224+
eprintln!();
232225
}
233-
eprintln!("{}", "failures:".red().underline());
226+
eprintln!("{}", "FAILURES:".red().underline().bold());
234227
for (path, _miri, _revision, _errors, _stderr) in &failures {
235228
eprintln!(" {}", path.display());
236229
}

0 commit comments

Comments
 (0)