Bug 1340434 - Request complete log and mark suppressed unexpecteds. r?jmaher draft
authorXidorn Quan <me@upsuper.org>
Fri, 17 Feb 2017 17:21:00 +1100
changeset 486846 121e0f4344016ce68630138d2f871d7ae1d03a8d
parent 486845 7f54104697eb82814088efe1acf42ce1d6341a7c
child 486847 9ade22f734104a9f8aeaec84605e95ae395f3e6b
push id46076
push userxquan@mozilla.com
push dateMon, 20 Feb 2017 03:59:33 +0000
reviewersjmaher
bugs1340434
milestone54.0a1
Bug 1340434 - Request complete log and mark suppressed unexpecteds. r?jmaher MozReview-Commit-ID: FFP7UfmJ1xs
testing/mochitest/tests/SimpleTest/SimpleTest.js
--- a/testing/mochitest/tests/SimpleTest/SimpleTest.js
+++ b/testing/mochitest/tests/SimpleTest/SimpleTest.js
@@ -254,16 +254,18 @@ SimpleTest.setExpected = function () {
   if (parent.TestRunner) {
     if (!Array.isArray(parent.TestRunner.expected)) {
       SimpleTest.expected = parent.TestRunner.expected;
     } else {
       // Assertions are checked by the runner.
       SimpleTest.expected = parent.TestRunner.expected.filter(([pat]) => pat != "ASSERTION");
       SimpleTest.num_failed = new Array(SimpleTest.expected.length);
       SimpleTest.num_failed.fill(0);
+      // Request complete log so that failure info from infra can be useful.
+      SimpleTest.requestCompleteLog();
     }
   }
 }
 SimpleTest.setExpected();
 
 /**
  * Something like assert.
 **/
@@ -275,16 +277,18 @@ SimpleTest.ok = function (condition, nam
         SimpleTest.num_failed++;
         test.result = !test.result;
       }
       var successInfo = {status:"FAIL", expected:"FAIL", message:"TEST-KNOWN-FAIL"};
       var failureInfo = {status:"PASS", expected:"FAIL", message:"TEST-UNEXPECTED-PASS"};
     } else if (!test.result && usesFailurePatterns()) {
       if (recordIfMatchesFailurePattern(name, diag)) {
         test.result = true;
+        // Add a mark for unexpected failures suppressed by failure pattern.
+        name = '[suppressed] ' + name;
       }
       var successInfo = {status:"FAIL", expected:"FAIL", message:"TEST-KNOWN-FAIL"};
       var failureInfo = {status:"FAIL", expected:"PASS", message:"TEST-UNEXPECTED-FAIL"};
     } else {
       var successInfo = {status:"PASS", expected:"PASS", message:"TEST-PASS"};
       var failureInfo = {status:"FAIL", expected:"PASS", message:"TEST-UNEXPECTED-FAIL"};
     }
 
@@ -339,16 +343,18 @@ SimpleTest.todo = function(condition, na
     var test = {'result': !!condition, 'name': name, 'diag': diag, todo: true};
     if (test.result && usesFailurePatterns() &&
         recordIfMatchesFailurePattern(name, diag)) {
       // Flipping the result to false so we don't get unexpected result. There
       // is no perfect way here. A known failure can trigger unexpected pass,
       // in which case, tagging it as KNOWN-FAIL probably makes more sense than
       // marking it PASS.
       test.result = false;
+      // Add a mark for unexpected failures suppressed by failure pattern.
+      name = '[suppressed] ' + name;
     }
     var successInfo = {status:"PASS", expected:"FAIL", message:"TEST-UNEXPECTED-PASS"};
     var failureInfo = {status:"FAIL", expected:"FAIL", message:"TEST-KNOWN-FAIL"};
     SimpleTest._logResult(test, successInfo, failureInfo);
     SimpleTest._tests.push(test);
 };
 
 /*