Bug 1265582 - Add a copy of reftest analyzer for working with structured log files, r=dbaron
This allows reftests from web-platform-tests to be analyzed using the
wpt_raw.log link on treeherder, and also supports the existing reftest harness.
MozReview-Commit-ID: I6TdGKQXpf8
copy from layout/tools/reftest/reftest-analyzer.xhtml
copy to layout/tools/reftest/reftest-analyzer-structured.xhtml
--- a/layout/tools/reftest/reftest-analyzer.xhtml
+++ b/layout/tools/reftest/reftest-analyzer-structured.xhtml
@@ -215,50 +215,52 @@ function log_pasted() {
var gTestItems;
function process_log(contents) {
var lines = contents.split(/[\r\n]+/);
gTestItems = [];
for (var j in lines) {
var line = lines[j];
- // Ignore duplicated output in logcat.
- if (line.match(/I\/Gecko.*?REFTEST/))
- continue;
- var match = line.match(/^.*?REFTEST (.*)$/);
- if (!match)
+ try {
+ var data = JSON.parse(line);
+ } catch(e) {
continue;
- line = match[1];
- match = line.match(/^(TEST-PASS|TEST-UNEXPECTED-PASS|TEST-KNOWN-FAIL|TEST-UNEXPECTED-FAIL|TEST-DEBUG-INFO)(\(EXPECTED RANDOM\)|) \| ([^\|]+) \|(.*)/);
- if (match) {
- var state = match[1];
- var random = match[2];
- var url = match[3];
- var extra = match[4];
- gTestItems.push(
- {
- pass: !state.match(/DEBUG-INFO$|FAIL$/),
- // only one of the following three should ever be true
- unexpected: !!state.match(/^TEST-UNEXPECTED/),
- random: (random == "(EXPECTED RANDOM)"),
- skip: (extra == " (SKIP)"),
- url: url,
- images: [],
- imageLabels: []
- });
+ }
+ // Ignore duplicated output in logcat.
+ if (!data.action == "test_end" && data.status != "FAIL")
+ continue;
+
+ if (!data.hasOwnProperty("extra") ||
+ !data.extra.hasOwnProperty("reftest_screenshots")) {
continue;
}
- match = line.match(/IMAGE([^:]*): (data:.*)$/);
- if (match) {
- var item = gTestItems[gTestItems.length - 1];
- item.images.push(match[2]);
- item.imageLabels.push(match[1]);
+
+ var url = data.test;
+ var screenshots = data.extra.reftest_screenshots;
+ gTestItems.push(
+ {
+ pass: data.status === "PASS",
+ // only one of the following three should ever be true
+ unexpected: data.hasOwnProperty("expected"),
+ random: false,
+ skip: data.status == "SKIP",
+ url: url,
+ images: [],
+ imageLabels: []
+ });
+
+ var item = gTestItems[gTestItems.length - 1];
+ item.images.push("data:image/png;base64," + screenshots[0].screenshot);
+ item.imageLabels.push(screenshots[0].url);
+ if (screenshots.length > 1) {
+ item.images.push("data:image/png;base64," + screenshots[2].screenshot);
+ item.imageLabels.push(screenshots[2].url);
}
}
-
build_viewer();
}
function build_viewer() {
if (gTestItems.length == 0) {
show_phase("entry");
return;
}
@@ -521,17 +523,17 @@ function show_pixelinfo(x, y, pix1rgb, p
]]></script>
</head>
<body onload="load()">
<div id="entry">
-<h1>Reftest analyzer: load reftest log</h1>
+<h1>Reftest analyzer: load raw structured log</h1>
<p>Either paste your log into this textarea:<br />
<textarea cols="80" rows="10" id="logentry"/><br/>
<input type="button" value="Process pasted log" onclick="log_pasted()" /></p>
<p>... or load it from a file:<br/>
<input type="file" id="fileentry" onchange="fileentry_changed()" />
</p>