Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 25 additions & 3 deletions src/tools/compiletest/src/runtest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2299,6 +2299,24 @@ impl<'test> TestCx<'test> {
self.props.compile_flags.iter().any(|s| s.contains("--color=always"))
}

/// Strip the SVG `y` offset and header line so a reordering of rows
/// under the parallel front-end is not seen as a difference. Non-SVG output
/// is returned unchanged.
fn normalize_svg_for_line_comparison<'a>(&self, output: &'a str) -> Cow<'a, str> {
if !self.force_color_svg() {
return Cow::Borrowed(output);
}
let strip_y = static_regex!(r#"y="\d+px""#);
Cow::Owned(
output
.lines()
.skip(1)
.map(|line| strip_y.replace_all(line, r#"y="0px""#))
.collect::<Vec<_>>()
.join("\n"),
)
}

fn load_compare_outputs(
&self,
proc_res: &ProcRes,
Expand Down Expand Up @@ -2714,8 +2732,10 @@ impl<'test> TestCx<'test> {
(&tmp.0, &tmp.1)
}
} else if compare_output_by_lines {
let mut actual_lines: Vec<&str> = actual.lines().collect();
let mut expected_lines: Vec<&str> = expected.lines().collect();
let actual_norm = self.normalize_svg_for_line_comparison(actual);
let expected_norm = self.normalize_svg_for_line_comparison(expected);
let mut actual_lines: Vec<&str> = actual_norm.lines().collect();
let mut expected_lines: Vec<&str> = expected_norm.lines().collect();
actual_lines.sort_unstable();
expected_lines.sort_unstable();
if actual_lines == expected_lines {
Expand Down Expand Up @@ -2859,7 +2879,9 @@ impl<'test> TestCx<'test> {
}

if show_diff_by_lines {
write!(self.stderr, "{}", diff_by_lines(expected, actual));
let expected_norm = self.normalize_svg_for_line_comparison(expected);
let actual_norm = self.normalize_svg_for_line_comparison(actual);
write!(self.stderr, "{}", diff_by_lines(&expected_norm, &actual_norm));
}
}

Expand Down
1 change: 0 additions & 1 deletion tests/ui/error-emitter/multiline-removal-suggestion.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,3 @@ fn bay() -> Vec<(bool, HashSet<u8>)> {
.collect()
}
fn main() {}
//@ ignore-parallel-frontend invalid svg(multiple threads trying to write to the same file)
Loading