Bug 1610626 - Fix wrench reftest mode incorrectly printing unexpected in some cases. r=Bert

The semantics of the inaccuracy reftest mode are that the overall
test succeeds as long as one of the multiple test images mismatches
the reference image.

However, the previous implementation would print an unexpected result
if any of the comparisons were equal (even though the overall test
result would be reported correctly).

This patch changes wrench so that it only reports an unexpected
failure for the overall test, not each individual reference.

Differential Revision: https://phabricator.services.mozilla.com/D60564

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Glenn Watson 2020-01-22 02:22:42 +00:00
Родитель 5473cc01bb
Коммит 4c7cd7138b
1 изменённых файлов: 22 добавлений и 21 удалений

Просмотреть файл

@ -149,21 +149,10 @@ impl Reftest {
} }
} }
/// Check the negative case (expecting inequality) and report details if same /// Report details of the negative case
fn check_and_report_inequality_failure( fn report_unexpected_equality(&self) {
&self,
comparison: ReftestImageComparison,
) -> bool {
match comparison {
ReftestImageComparison::Equal => {
println!("REFTEST TEST-UNEXPECTED-FAIL | {} | image comparison", self); println!("REFTEST TEST-UNEXPECTED-FAIL | {} | image comparison", self);
println!("REFTEST TEST-END | {}", self); println!("REFTEST TEST-END | {}", self);
false
}
ReftestImageComparison::NotEqual { .. } => {
true
}
}
} }
} }
@ -704,7 +693,15 @@ impl<'a> ReftestHarness<'a> {
// Ensure that the final image *doesn't* match the reference // Ensure that the final image *doesn't* match the reference
let test = images.pop().unwrap(); let test = images.pop().unwrap();
let comparison = test.compare(&reference); let comparison = test.compare(&reference);
t.check_and_report_inequality_failure(comparison) match comparison {
ReftestImageComparison::Equal => {
t.report_unexpected_equality();
false
}
ReftestImageComparison::NotEqual { .. } => {
true
}
}
} }
ReftestOp::Accurate => { ReftestOp::Accurate => {
// Ensure that *all* images match the reference // Ensure that *all* images match the reference
@ -724,14 +721,18 @@ impl<'a> ReftestHarness<'a> {
} }
ReftestOp::Inaccurate => { ReftestOp::Inaccurate => {
// Ensure that at least one of the images doesn't match the reference // Ensure that at least one of the images doesn't match the reference
let mut found_mismatch = false; let all_same = images.iter().all(|image| {
match image.compare(&reference) {
ReftestImageComparison::Equal => true,
ReftestImageComparison::NotEqual { .. } => false,
}
});
for test in images.drain(..) { if all_same {
let comparison = test.compare(&reference); t.report_unexpected_equality();
found_mismatch |= t.check_and_report_inequality_failure(comparison);
} }
found_mismatch !all_same
} }
} }
} }