Bug 1267020 - Dump reftest assertion count mismatches to log file on Android. r=jmaher, a=test-only
authorGeoff Brown <gbrown@mozilla.com>
Wed, 27 Apr 2016 14:56:09 -0600
changeset 333074 e26804b910e1b0bb93623b25bacee6c9ec2668ae
parent 333073 9d87d3a279a08ac507dda94c36d5a12185fea4a6
child 333075 7c087a34c6e341d300b33455ec441bc86dcf35a0
push id6048
push userkmoir@mozilla.com
push dateMon, 06 Jun 2016 19:02:08 +0000
treeherdermozilla-beta@46d72a56c57d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjmaher, test-only
bugs1267020
milestone48.0a2
Bug 1267020 - Dump reftest assertion count mismatches to log file on Android. r=jmaher, a=test-only
layout/tools/reftest/reftest.jsm
--- a/layout/tools/reftest/reftest.jsm
+++ b/layout/tools/reftest/reftest.jsm
@@ -173,16 +173,22 @@ function HasUnexpectedResult()
            gTestResults.UnexpectedFail > 0 ||
            gTestResults.UnexpectedPass > 0 ||
            gTestResults.AssertionUnexpected > 0 ||
            gTestResults.AssertionUnexpectedFixed > 0;
 }
 
 // By default we just log to stdout
 var gLogFile = null;
+var gDumpFn = function(line) {
+  dump(line);
+  if (gLogFile) {
+    gLogFile.write(line, line.length);
+  }
+}
 var gDumpRawLog = function(record) {
   // Dump JSON representation of data on a single line
   var line = "\n" + JSON.stringify(record) + "\n";
   dump(line);
 
   if (gLogFile) {
     gLogFile.write(line, line.length);
   }
@@ -1360,18 +1366,18 @@ function StartCurrentURI(aState)
         gURLs[0].maxAsserts == 0) {
         // Pretend the document loaded --- RecordResult will notice
         // there's already a canvas for this URL
         gContainingWindow.setTimeout(RecordResult, 0);
     } else {
         var currentTest = gTotalTests - gURLs.length;
         // Log this to preserve the same overall log format,
         // should be removed if the format is updated
-        dump("REFTEST TEST-LOAD | " + gCurrentURL + " | " + currentTest + " / " + gTotalTests +
-             " (" + Math.floor(100 * (currentTest / gTotalTests)) + "%)\n");
+        gDumpFn("REFTEST TEST-LOAD | " + gCurrentURL + " | " + currentTest + " / " + gTotalTests +
+                " (" + Math.floor(100 * (currentTest / gTotalTests)) + "%)\n");
         TestBuffer("START " + gCurrentURL);
         var type = gURLs[0].type
         if (TYPE_SCRIPT == type) {
             SendLoadScriptTest(gCurrentURL, gLoadTimeout);
         } else {
             SendLoadTest(type, gCurrentURL, gLoadTimeout);
         }
     }
@@ -1813,29 +1819,29 @@ function DoAssertionCheck(numAsserts)
         var expectedAssertions = "expected " + minAsserts;
         if (minAsserts != maxAsserts) {
             expectedAssertions += " to " + maxAsserts;
         }
         expectedAssertions += " assertions";
 
         if (numAsserts < minAsserts) {
             ++gTestResults.AssertionUnexpectedFixed;
-            dump("REFTEST TEST-UNEXPECTED-PASS | " + gURLs[0].prettyPath +
-                 " | assertion count" + numAsserts + " is less than " +
-                    expectedAssertions + "\n");
+            gDumpFn("REFTEST TEST-UNEXPECTED-PASS | " + gURLs[0].prettyPath +
+                    " | assertion count" + numAsserts + " is less than " +
+                       expectedAssertions + "\n");
         } else if (numAsserts > maxAsserts) {
             ++gTestResults.AssertionUnexpected;
-            dump("REFTEST TEST-UNEXPECTED-FAIL | " + gURLs[0].prettyPath +
-                 " | assertion count " + numAsserts + " is more than " +
-                    expectedAssertions + "\n");
+            gDumpFn("REFTEST TEST-UNEXPECTED-FAIL | " + gURLs[0].prettyPath +
+                    " | assertion count " + numAsserts + " is more than " +
+                       expectedAssertions + "\n");
         } else if (numAsserts != 0) {
             ++gTestResults.AssertionKnown;
-            dump("REFTEST TEST-KNOWN-FAIL | " + gURLs[0].prettyPath +
-                 "assertion count " + numAsserts + " matches " +
-                 expectedAssertions + "\n");
+            gDumpFn("REFTEST TEST-KNOWN-FAIL | " + gURLs[0].prettyPath +
+                    "assertion count " + numAsserts + " matches " +
+                    expectedAssertions + "\n");
         }
     }
 
     if (gURLs[0].chaosMode) {
         gWindowUtils.leaveChaosMode();
     }
 
     // And start the next test.