Bug 1278577 - Use simple strings as reftest test ids, r=ahal
The idea of mozlog ids being tuples unfortunately didn't work so well
with external systems that found the tuple|string datatype difficult to
work with. Convert reftests to use simple ids of the form "<test url>
<comparison> <refurl>" e.g. "about:blank == data:text/html," instead of
tuples.
MozReview-Commit-ID: 18jufbssn4A
--- a/layout/tools/reftest/runreftest.py
+++ b/layout/tools/reftest/runreftest.py
@@ -562,18 +562,18 @@ class RefTest(object):
debug_args = None
if debuggerInfo:
interactive = debuggerInfo.interactive
debug_args = [debuggerInfo.path] + debuggerInfo.args
def record_last_test(message):
"""Records the last test seen by this harness for the benefit of crash logging."""
if message['action'] == 'test_start':
- if isinstance(message['test'], tuple):
- self.lastTestSeen = message['test'][0]
+ if " " in message['test']:
+ self.lastTestSeen = message['test'].split(" ")[0]
else:
self.lastTestSeen = message['test']
self.log.add_handler(record_last_test)
outputHandler = OutputHandler(self.log, options.utilityPath, symbolsPath=symbolsPath)
kp_kwargs = {
--- a/testing/modules/StructuredLog.jsm
+++ b/testing/modules/StructuredLog.jsm
@@ -29,30 +29,30 @@ this.StructuredLogger = function(name, d
this._mutatorFuns = mutators;
}
/**
* Log functions producing messages in the format specified by mozlog
*/
StructuredLogger.prototype = {
testStart: function (test) {
- var data = {test: test};
+ var data = {test: this._testId(test)};
this._logData("test_start", data);
},
testStatus: function (test, subtest, status, expected="PASS",
message=null, stack=null, extra=null) {
if (subtest === null || subtest === undefined) {
// Fix for assertions that don't pass in a name
subtest = "undefined assertion name";
}
var data = {
- test: test,
+ test: this._testId(test),
subtest: subtest,
status: status,
};
if (expected != status && status != "SKIP") {
data.expected = expected;
}
if (message !== null) {
@@ -64,17 +64,17 @@ StructuredLogger.prototype = {
if (extra !== null) {
data.extra = extra;
}
this._logData("test_status", data);
},
testEnd: function (test, status, expected="OK", message=null, stack=null, extra=null) {
- var data = {test: test, status: status};
+ var data = {test: this._testId(test), status: status};
if (expected != status && status != "SKIP") {
data.expected = expected;
}
if (message !== null) {
data.message = String(message);
}
if (stack !== null) {
@@ -83,17 +83,17 @@ StructuredLogger.prototype = {
if (extra !== null) {
data.extra = extra;
}
this._logData("test_end", data);
},
suiteStart: function (tests, runinfo=null, versioninfo=null, deviceinfo=null, extra=null) {
- var data = {tests: tests};
+ var data = {tests: tests.map(x => this._testId(x))};
if (runinfo !== null) {
data.runinfo = runinfo;
}
if (versioninfo !== null) {
data.versioninfo = versioninfo;
}
@@ -181,17 +181,24 @@ StructuredLogger.prototype = {
allData[field] = data[field];
}
for (var fun of this._mutatorFuns) {
fun(allData);
}
this._dumpFun(allData);
- }
+ },
+
+ _testId: function(test) {
+ if (Array.isArray(test)) {
+ return test.join(" ");
+ }
+ return test;
+ },
};
/**
* StructuredFormatter: Formatter class turning structured messages
* into human-readable messages.
*/
this.StructuredFormatter = function() {