Bug 1328509 - Check failure patterns in assertSnapshots. r=xidorn draft
authorJ. Ryan Stinnett <jryans@gmail.com>
Mon, 22 May 2017 13:03:57 -0500
changeset 584195 caa46272f77eca41a3aea83e4c71ef56ec3ea7b0
parent 584194 6661059925f1ef6cf0eeb7563ca34beeb81bfae3
child 584196 e9f87408ab54adde4334775fb4c3aa5f00c4b051
push id60646
push userbmo:jryans@gmail.com
push dateThu, 25 May 2017 00:30:26 +0000
reviewersxidorn
bugs1328509
milestone55.0a1
Bug 1328509 - Check failure patterns in assertSnapshots. r=xidorn Several mochitests call `assertSnapshots`, which prints a reftest-like output for use with the reftest analyzer. Update these lines to check failure patterns before printing, like the regular assertion methods do. MozReview-Commit-ID: CfChoar7bp8
testing/mochitest/tests/SimpleTest/WindowSnapshot.js
--- a/testing/mochitest/tests/SimpleTest/WindowSnapshot.js
+++ b/testing/mochitest/tests/SimpleTest/WindowSnapshot.js
@@ -57,20 +57,24 @@ function compareSnapshots(s1, s2, expect
 }
 
 function assertSnapshots(s1, s2, expectEqual, fuzz, s1name, s2name) {
   var [passed, s1DataURI, s2DataURI, numDifferentPixels, maxDifference] =
     compareSnapshots(s1, s2, expectEqual, fuzz);
   var sym = expectEqual ? "==" : "!=";
   ok(passed, "reftest comparison: " + sym + " " + s1name + " " + s2name);
   if (!passed) {
+    let status = "TEST-UNEXPECTED-FAIL";
+    if (usesFailurePatterns() && recordIfMatchesFailurePattern(s1name)) {
+      status = "TEST-KNOWN-FAIL";
+    }
     // The language / format in this message should match the failure messages
     // displayed by reftest.js's "RecordResult()" method so that log output
     // can be parsed by reftest-analyzer.xhtml
-    var report = "REFTEST TEST-UNEXPECTED-FAIL | " + s1name +
+    var report = "REFTEST " + status + " | " + s1name +
                  " | image comparison (" + sym + "), max difference: " +
                  maxDifference + ", number of differing pixels: " +
                  numDifferentPixels + "\n";
     if (expectEqual) {
       report += "REFTEST   IMAGE 1 (TEST): " + s1DataURI + "\n";
       report += "REFTEST   IMAGE 2 (REFERENCE): " + s2DataURI + "\n";
     } else {
       report += "REFTEST   IMAGE: " + s1DataURI + "\n";