compiletest: normalize stderr before SVG rendering

Element position is hardcoded in the rendered SVG. This means that any
change in element length (for instance, when substituting the path with
the `rust` checkout with `$DIR`) would not change the position and result
in buggy SVG being generated. Normalizing before SVG rendering allows us
to keep a consistent element placement.
This commit is contained in:
Sasha Pourcelot 2026-02-14 19:52:42 +00:00
parent e823167aa6
commit c259c4048a

View file

@ -2379,15 +2379,22 @@ impl<'test> TestCx<'test> {
_ => {}
};
let stderr = if self.force_color_svg() {
anstyle_svg::Term::new().render_svg(&proc_res.stderr)
} else if explicit_format {
proc_res.stderr.clone()
} else {
json::extract_rendered(&proc_res.stderr)
};
let stderr;
let normalized_stderr;
if self.force_color_svg() {
let normalized = self.normalize_output(&proc_res.stderr, &self.props.normalize_stderr);
stderr = anstyle_svg::Term::new().render_svg(&normalized);
normalized_stderr = stderr.clone();
} else {
stderr = if explicit_format {
proc_res.stderr.clone()
} else {
json::extract_rendered(&proc_res.stderr)
};
normalized_stderr = self.normalize_output(&stderr, &self.props.normalize_stderr);
}
let normalized_stderr = self.normalize_output(&stderr, &self.props.normalize_stderr);
let mut errors = 0;
match output_kind {
TestOutput::Compile => {