Backed out changeset 1c0b0e3074c3 (bug 1119952) for frequent Linux debug mochitest failures.
authorRyan VanderMeulen <ryanvm@gmail.com>
Tue, 13 Jan 2015 14:43:34 -0500
changeset 236752 5bb6d798f5b76f73c1bfdcdc220e0e6e270146a5
parent 236751 66150e000a62027ec82dddf4269eac03a7bd1922
child 236753 544315e9741c7bda04749f002a4eea921b6e1d27
push id411
push usermartin.thomson@gmail.com
push dateWed, 14 Jan 2015 00:17:02 +0000
bugs1119952
milestone38.0a1
backs out1c0b0e3074c356d94d8eb981b1fb930fc7cd2e75
Backed out changeset 1c0b0e3074c3 (bug 1119952) for frequent Linux debug mochitest failures. CLOSED TREE
testing/mochitest/tests/SimpleTest/SimpleTest.js
testing/mochitest/tests/SimpleTest/TestRunner.js
--- a/testing/mochitest/tests/SimpleTest/SimpleTest.js
+++ b/testing/mochitest/tests/SimpleTest/SimpleTest.js
@@ -556,17 +556,16 @@ SimpleTest.showReport = function() {
 /**
  * Tells SimpleTest to don't finish the test when the document is loaded,
  * useful for asynchronous tests.
  *
  * When SimpleTest.waitForExplicitFinish is called,
  * explicit SimpleTest.finish() is required.
 **/
 SimpleTest.waitForExplicitFinish = function () {
-    SimpleTest._finishedCalled = 0;
     SimpleTest._stopOnLoad = false;
 };
 
 /**
  * Multiply the timeout the parent runner uses for this test by the
  * given factor.
  *
  * For example, in a test that may take a long time to complete, using
@@ -624,17 +623,17 @@ window.setTimeout = function SimpleTest_
     // Right now, we only enable these checks for mochitest-plain.
     switch (SimpleTest.harnessParameters.testRoot) {
     case "browser":
     case "chrome":
     case "a11y":
     case "webapprtContent":
         break;
     default:
-        if (SimpleTest._finishedCalled === 0 && arguments.length > 1 && arguments[1] > 0) {
+        if (!SimpleTest._alreadyFinished && arguments.length > 1 && arguments[1] > 0) {
             if (SimpleTest._flakyTimeoutIsOK) {
                 SimpleTest.todo(false, "The author of the test has indicated that flaky timeouts are expected.  Reason: " + SimpleTest._flakyTimeoutReason);
             } else {
                 SimpleTest.ok(false, "Test attempted to use a flaky timeout value " + arguments[1]);
             }
         }
     }
     return SimpleTest._originalSetTimeout.apply(window, arguments);
@@ -955,22 +954,17 @@ SimpleTest.registerCleanupFunction = fun
     SimpleTest._cleanupFunctions.push(aFunc);
 };
 
 /**
  * Finishes the tests. This is automatically called, except when
  * SimpleTest.waitForExplicitFinish() has been invoked.
 **/
 SimpleTest.finish = function() {
-    ++SimpleTest._finishedCalled;
-    if (SimpleTest._finishedCalled > 5) {
-        // We've already failed several times, suppress subsequent attempts
-        return;
-    }
-    if (SimpleTest._finishedCalled > 1) {
+    if (SimpleTest._alreadyFinished) {
         var err = "[SimpleTest.finish()] this test already called finish!";
         if (parentRunner) {
             parentRunner.structuredLogger.error(err);
         } else {
             dump(err + '\n');
         }
     }
 
@@ -981,16 +975,18 @@ SimpleTest.finish = function() {
         var failureInfo = {status:"PASS", expected:"FAIL", message:"TEST-UNEXPECTED-PASS"};
 
         SimpleTest._logResult(test, successInfo, failureInfo);
         SimpleTest._tests.push(test);
     }
 
     SimpleTest.testsLength = SimpleTest._tests.length;
 
+    SimpleTest._alreadyFinished = true;
+
     var afterCleanup = function() {
         if (SpecialPowers.DOMWindowUtils.isTestControllingRefreshes) {
             SimpleTest.ok(false, "test left refresh driver under test control");
             SpecialPowers.DOMWindowUtils.restoreNormalRefresh();
         }
         if (SimpleTest._expectingUncaughtException) {
             SimpleTest.ok(false, "expectUncaughtException was called but no uncaught exception was detected!");
         }
@@ -1469,17 +1465,17 @@ window.onerror = function simpletestOner
     // For now, for tests that self identify as having unintentional uncaught
     // exceptions, just dump it so that the error is visible but doesn't cause
     // a test failure.  See bug 652494.
     var isExpected = !!SimpleTest._expectingUncaughtException;
     var message = (isExpected ? "expected " : "") + "uncaught exception";
     var error = errorMsg + " at " + url + ":" + lineNumber;
     if (!SimpleTest._ignoringAllUncaughtExceptions) {
         // Don't log if SimpleTest.finish() is already called, it would cause failures
-        if (!SimpleTest._finishedCalled)
+        if (!SimpleTest._alreadyFinished)
           SimpleTest.ok(isExpected, message, error);
         SimpleTest._expectingUncaughtException = false;
     } else {
         SimpleTest.todo(false, message + ": " + error);
     }
     // There is no Components.stack.caller to log. (See bug 511888.)
 
     // Call previous handler.
--- a/testing/mochitest/tests/SimpleTest/TestRunner.js
+++ b/testing/mochitest/tests/SimpleTest/TestRunner.js
@@ -906,18 +906,18 @@ TestRunner.updateUI = function(tests) {
     indicator.innerHTML = "Status: Pass";
     indicator.style.backgroundColor = "#0d0";
   } else {
     indicator.innerHTML = "Status: ToDo";
     indicator.style.backgroundColor = "orange";
   }
 
   // Set the table values
-  var testPath = $('current-test-path');
-  var row = !!testPath ? $("tr-" + testPath.innerHTML) : null;
+  var trID = "tr-" + $('current-test-path').innerHTML;
+  var row = $(trID);
 
   // Only update the row if it actually exists (autoUI)
   if (row != null) {
     var tds = row.getElementsByTagName("td");
     tds[0].style.backgroundColor = "#0d0";
     tds[0].innerHTML = parseInt(tds[0].innerHTML) + parseInt(results.OK);
     tds[1].style.backgroundColor = results.notOK > 0 ? "red" : "#0d0";
     tds[1].innerHTML = parseInt(tds[1].innerHTML) + parseInt(results.notOK);