Bug 873149 - Report the slowest test in mochitest. r=ted
☠☠ backed out by b7dbf40666b1 ☠ ☠
authorMartijn Wargers <mwargers@mozilla.com>
Fri, 14 Jun 2013 02:03:48 +0200
changeset 146507 b06b9c8b19a3d0865ff97e20a0ee34bdc655a20e
parent 146506 2501f979d6293fd6271e814a0112943b43096d37
child 146508 5e5abccab73ed1fb1e93a3ee53d95d91a7b3b68e
push id2697
push userbbajaj@mozilla.com
push dateMon, 05 Aug 2013 18:49:53 +0000
treeherdermozilla-beta@dfec938c7b63 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersted
bugs873149
milestone24.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 873149 - Report the slowest test in mochitest. r=ted
testing/mochitest/tests/SimpleTest/TestRunner.js
--- a/testing/mochitest/tests/SimpleTest/TestRunner.js
+++ b/testing/mochitest/tests/SimpleTest/TestRunner.js
@@ -79,16 +79,18 @@ TestRunner.originalTestURL = "";
 TestRunner._urls = [];
 TestRunner._lastAssertionCount = 0;
 TestRunner._expectedMinAsserts = 0;
 TestRunner._expectedMaxAsserts = 0;
 
 TestRunner.timeout = 5 * 60 * 1000; // 5 minutes.
 TestRunner.maxTimeouts = 4; // halt testing after too many timeouts
 TestRunner.runSlower = false;
+TestRunner.slowestTestTime = 0;
+TestRunner.slowestTestURL = "";
 
 TestRunner._expectingProcessCrash = false;
 
 /**
  * Make sure the tests don't hang indefinitely.
 **/
 TestRunner._numTimeouts = 0;
 TestRunner._currentTestStartTime = new Date().valueOf();
@@ -340,19 +342,20 @@ TestRunner.runNextTest = function() {
           var indicator = $("indicator");
           indicator.innerHTML = "Status: Fail (No checks actually run)";
           indicator.style.backgroundColor = "red";
         }
 
         SpecialPowers.unregisterProcessCrashObservers();
 
         TestRunner.log("TEST-START | Shutdown"); // used by automation.py
-        TestRunner.log("Passed: " + $("pass-count").innerHTML);
-        TestRunner.log("Failed: " + $("fail-count").innerHTML);
-        TestRunner.log("Todo:   " + $("todo-count").innerHTML);
+        TestRunner.log("Passed:  " + $("pass-count").innerHTML);
+        TestRunner.log("Failed:  " + $("fail-count").innerHTML);
+        TestRunner.log("Todo:    " + $("todo-count").innerHTML);
+        TestRunner.log("Slowest: " + TestRunner.slowestTestTime + 'ms - ' + TestRunner.slowestTestURL);
         // If we are looping, don't send this cause it closes the log file
         if (TestRunner.repeat == 0) {
           TestRunner.log("SimpleTest FINISHED");
         }
 
         if (TestRunner.repeat == 0 && TestRunner.onComplete) {
              TestRunner.onComplete();
          }
@@ -431,16 +434,20 @@ TestRunner.testFinished = function(tests
                              " because it didn't call SimpleTest.finish()");
             tests.push({ result: false });
         }
 
         var runtime = new Date().valueOf() - TestRunner._currentTestStartTime;
         TestRunner.log("TEST-END | " +
                        TestRunner.currentTestURL +
                        " | finished in " + runtime + "ms");
+        if (TestRunner.slowestTestTime < runtime && TestRunner._timeoutFactor == 1) {
+          TestRunner.slowestTestTime = runtime;
+          TestRunner.slowestTestURL = TestRunner.currentTestURL;
+        }
 
         TestRunner.updateUI(tests);
 
         var interstitialURL;
         if ($('testframe').contentWindow.location.protocol == "chrome:") {
             interstitialURL = "tests/SimpleTest/iframe-between-tests.html";
         } else {
             interstitialURL = "/tests/SimpleTest/iframe-between-tests.html";