Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improve compiletest output for errors from mir-opt tests #45722

Merged
merged 1 commit into from
Nov 4, 2017
Merged
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
19 changes: 16 additions & 3 deletions src/tools/compiletest/src/runtest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2286,6 +2286,10 @@ actual:\n\
output_file.push(test_name);
debug!("comparing the contests of: {:?}", output_file);
debug!("with: {:?}", expected_content);
if !output_file.exists() {
panic!("Output file `{}` from test does not exist",
output_file.into_os_string().to_string_lossy());
}
self.check_mir_test_timestamp(test_name, &output_file);

let mut dumped_file = fs::File::open(output_file.clone()).unwrap();
Expand Down Expand Up @@ -2334,13 +2338,22 @@ actual:\n\

// We expect each non-empty line to appear consecutively, non-consecutive lines
// must be separated by at least one Elision
let mut start_block_line = None;
while let Some(dumped_line) = dumped_lines.next() {
match expected_lines.next() {
Some(&ExpectedLine::Text(expected_line)) =>
Some(&ExpectedLine::Text(expected_line)) => {
let normalized_expected_line = normalize_mir_line(expected_line);
if normalized_expected_line.contains(":{") {
start_block_line = Some(expected_line);
}

if !compare(expected_line, dumped_line) {
error!("{:?}", start_block_line);
error(expected_line,
format!("Mismatch in lines\nExpected Line: {:?}", dumped_line));
},
format!("Mismatch in lines\nCurrnt block: {}\nExpected Line: {:?}",
start_block_line.unwrap_or("None"), dumped_line));
}
},
Some(&ExpectedLine::Elision) => {
// skip any number of elisions in a row.
while let Some(&&ExpectedLine::Elision) = expected_lines.peek() {
Expand Down