Bug 1267020 - Dump reftest assertion count mismatches to log file on Android; r=jmaher
--- 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.