Title: [93801] trunk/Tools
Revision
93801
Author
[email protected]
Date
2011-08-25 11:07:02 -0700 (Thu, 25 Aug 2011)

Log Message

garden-o-matic needs a way to report where and how tests are failing in the summary view.
https://bugs.webkit.org/show_bug.cgi?id=66955

Introduce FailureGrid, your one-stop failure-indicating destination.

Reviewed by Adam Barth.

* BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/run-unittests.html: Added new scripts.
* BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/ui/failures.js: Added.
* BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/ui/failures_unittests.js: Added.
* BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/ui/notifications.js: Updated to use FailureGrid.
* BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/ui/notifications_unittests.js: Updated tests.
* BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/summary.html: Added new scripts.

Modified Paths

Added Paths

Diff

Modified: trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/run-unittests.html (93800 => 93801)


--- trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/run-unittests.html	2011-08-25 18:05:40 UTC (rev 93800)
+++ trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/run-unittests.html	2011-08-25 18:07:02 UTC (rev 93801)
@@ -55,6 +55,8 @@
 <script src=""
 <script src=""
 <script src=""
+<script src=""
+<script src=""
 <script src=""
 <script src="" <!-- This script is slightly of order. -->
 <script src=""

Added: trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/ui/failures.js (0 => 93801)


--- trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/ui/failures.js	                        (rev 0)
+++ trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/ui/failures.js	2011-08-25 18:07:02 UTC (rev 93801)
@@ -0,0 +1,108 @@
+/*
+ * Copyright (C) 2011 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+var ui = ui || {};
+ui.failures = ui.failures || {};
+
+(function(){
+
+ui.failures.Configuration = base.extends('div', {
+    init: function(configuration)
+    {
+        if (configuration.is64bit)
+            this._addSpan('build-type', '64-bit');
+        if (configuration.version)
+            this._addSpan('version', configuration.version);
+        this._configuration = configuration;
+    },
+    _addSpan: function(className, text)
+    {
+        var span = this.appendChild(document.createElement('span'));
+        span.className = className;
+        span.textContent = text;
+    },
+    equals: function(configuration)
+    {
+        return this._configuration.is64bit == configuration.is64bit && this._configuration.version == configuration.version; 
+    }
+});
+
+function cellContainsConfiguration(cell, configuration)
+{
+    return Array.prototype.some.call(cell.children, function(configurationElement) {
+        return configurationElement.equals && configurationElement.equals(configuration);
+    });
+}
+
+function cellByBuildType(row, configuration)
+{
+    return row.cells[configuration.debug ? 2 : 1];
+}
+
+ui.failures.FailureGrid = base.extends('table', {
+    init: function()
+    {
+        this.className = 'failures';
+        var titles = this.createTHead().insertRow();
+        titles.insertCell().textContent = 'debug';
+        titles.insertCell().textContent = 'release';
+        titles.insertCell().textContent = 'type';
+        this._body = this.appendChild(document.createElement('tbody'));
+        this._resultRows = {};
+    },
+    _rowByResult: function(result)
+    {
+        var row = this._resultRows[result];
+        if (row)
+            return row;
+
+        row = this._resultRows[result] = this._body.insertRow(-1);
+        row.insertCell();
+        row.insertCell();
+        row.insertCell().textContent = result;
+        return row;
+    },
+    removeResultRows: function()
+    {
+        Object.keys(this._resultRows).forEach(function(result) {
+            var row = this._resultRows[result];
+            row.parentNode.removeChild(row);
+        }, this);
+        this._resultRows = {};
+    },
+    add: function(resultsByBuilder)
+    {
+        Object.keys(resultsByBuilder).forEach(function(builderName) {
+            var configuration = config.kBuilders[builderName];
+            var row = this._rowByResult(resultsByBuilder[builderName].actual);
+            var cell = cellByBuildType(row, configuration);
+            if (cellContainsConfiguration(cell, configuration))
+                return;
+            cell.appendChild(new ui.failures.Configuration(configuration));
+        }, this);
+    }
+});
+
+})();
Property changes on: trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/ui/failures.js
___________________________________________________________________

Added: svn:eol-style

Added: trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/ui/failures_unittests.js (0 => 93801)


--- trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/ui/failures_unittests.js	                        (rev 0)
+++ trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/ui/failures_unittests.js	2011-08-25 18:07:02 UTC (rev 93801)
@@ -0,0 +1,123 @@
+/*
+ * Copyright (C) 2011 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+(function () {
+
+module('ui.failures');
+
+test('Configuration', 8, function() {
+    raises(function() {
+        new ui.failures.Configuration();
+    });
+
+    var configuration;
+    configuration = new ui.failures.Configuration({});
+    deepEqual(Object.getOwnPropertyNames(configuration.__proto__), ['init', 'equals', '_addSpan']);
+    equal(configuration.outerHTML, '<div></div>');
+    configuration = new ui.failures.Configuration({is64bit: true, version: 'lucid'});
+    equal(configuration.outerHTML, '<div><span class="build-type">64-bit</span><span class="version">lucid</span></div>');
+    configuration = new ui.failures.Configuration({version: 'xp'});
+    equal(configuration.outerHTML, '<div><span class="version">xp</span></div>');
+    configuration._addSpan('foo', 'bar');
+    equal(configuration.outerHTML, '<div><span class="version">xp</span><span class="foo">bar</span></div>');
+    ok(configuration.equals({version: 'xp'}));
+    ok(!configuration.equals({version: 'lucid',is64bit: true}));
+});
+
+test('FailureGrid', 9, function() {
+    var grid = new ui.failures.FailureGrid();
+    deepEqual(Object.getOwnPropertyNames(grid.__proto__), ["init", "_rowByResult", "add", "removeResultRows"]);
+    equal(grid.outerHTML, '<table class="failures">' +
+        '<thead><tr><td>type</td><td>release</td><td>debug</td></tr></thead>' +
+        '<tbody></tbody>' +
+    '</table>');
+    var row = grid._rowByResult('TEXT');
+    equal(grid.outerHTML, '<table class="failures">' +
+        '<thead><tr><td>type</td><td>release</td><td>debug</td></tr></thead>' +
+        '<tbody>' +
+            '<tr>' +
+                '<td>TEXT</td><td></td><td></td>' +
+            '</tr>' +
+        '</tbody>' +
+    '</table>');
+    equal(row.outerHTML, '<tr><td>TEXT</td><td></td><td></td></tr>');
+    grid.add({});
+    equal(grid.outerHTML, '<table class="failures">' +
+        '<thead><tr><td>type</td><td>release</td><td>debug</td></tr></thead>' +
+        '<tbody>' +
+            '<tr>' +
+                '<td>TEXT</td><td></td><td></td>' +
+            '</tr>' +
+        '</tbody>' +
+    '</table>');
+    raises(function() {
+        grid.update({'Atari': {}})
+    });
+    grid.add({'Webkit Linux (dbg)(1)': { actual: 'TEXT'}});
+    equal(grid.outerHTML, '<table class="failures">' +
+        '<thead><tr><td>type</td><td>release</td><td>debug</td></tr></thead>' +
+        '<tbody>' +
+            '<tr>' +
+                '<td>TEXT</td>' +
+                '<td></td>' +
+                '<td><div><span class="build-type">64-bit</span><span class="version">lucid</span></div></td>' +
+            '</tr>' +
+        '</tbody>' +
+    '</table>');
+    grid.add({'Webkit Mac10.5 (CG)': { actual: 'IMAGE+TEXT'}});
+    equal(grid.outerHTML, '<table class="failures">' +
+        '<thead><tr><td>type</td><td>release</td><td>debug</td></tr></thead>' +
+        '<tbody>' +
+            '<tr>' +
+                '<td>TEXT</td>' +
+                '<td></td>' +
+                '<td><div><span class="build-type">64-bit</span><span class="version">lucid</span></div></td>' +
+            '</tr>' +
+            '<tr>' +
+                '<td>IMAGE+TEXT</td>' +
+                '<td><div><span class="version">leopard</span></div></td>' +
+                '<td></td>' +
+            '</tr>' +
+        '</tbody>' +
+    '</table>');
+    grid.add({'Webkit Mac10.5 (CG)': { actual: 'IMAGE+TEXT'}});
+    equal(grid.outerHTML, '<table class="failures">' +
+        '<thead><tr><td>type</td><td>release</td><td>debug</td></tr></thead>' +
+        '<tbody>' +
+            '<tr>' +
+                '<td>TEXT</td>' +
+                '<td></td>' +
+                '<td><div><span class="build-type">64-bit</span><span class="version">lucid</span></div></td>' +
+            '</tr>' +
+            '<tr>' +
+                '<td>IMAGE+TEXT</td>' +
+                '<td><div><span class="version">leopard</span></div></td>' +
+                '<td></td>' +
+            '</tr>' +
+        '</tbody>' +
+    '</table>');
+});
+
+}());
Property changes on: trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/ui/failures_unittests.js
___________________________________________________________________

Added: svn:eol-style

Modified: trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/ui/notifications.js (93800 => 93801)


--- trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/ui/notifications.js	2011-08-25 18:05:40 UTC (rev 93800)
+++ trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/ui/notifications.js	2011-08-25 18:07:02 UTC (rev 93801)
@@ -83,12 +83,12 @@
 ui.notifications.FailingTest = base.extends('li', {
     init: function(failureAnalysis)
     {
-        // FIXME: Show type of failure and where it's failing.
+        this._failureAnalysis = failureAnalysis;
         this.textContent = failureAnalysis.testName;
     },
     equals: function(failureAnalysis)
     {
-        return this.textContent == failureAnalysis.testName;
+        return this._failureAnalysis.testName == failureAnalysis.testName;
     }
 })
 
@@ -119,6 +119,7 @@
 ui.notifications.Failure = base.extends(ui.notifications.Notification, {
     init: function()
     {
+        this._where = this.insertBefore(new ui.failures.FailureGrid(), this.firstChild);
         this._time = this.insertBefore(new ui.RelativeTime(), this.firstChild);
         this._problem = this._what.appendChild(document.createElement('div'));
         this._problem.className = 'problem';
@@ -155,6 +156,7 @@
         if (this.containsFailureAnalysis(failureAnalysis))
             return;
         this._testNameList.push(failureAnalysis.testName);
+        this._where.add(failureAnalysis.resultNodesByBuilder);
         return this._effects.appendChild(new ui.notifications.FailingTest(failureAnalysis));
     },
     addCommitData: function(commitData)
@@ -175,6 +177,7 @@
     },
     setFailingBuilders: function(builderNameList)
     {
+        // FIXME: Populate this._where with failing builders.
         $(this._effects).empty().append(builderNameList.map(function(builderName) {
             var effect = document.createElement('li');
             effect.className = 'builder-name';

Modified: trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/ui/notifications_unittests.js (93800 => 93801)


--- trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/ui/notifications_unittests.js	2011-08-25 18:05:40 UTC (rev 93800)
+++ trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/ui/notifications_unittests.js	2011-08-25 18:07:02 UTC (rev 93801)
@@ -90,11 +90,15 @@
     equal(suspiciousCommit.innerHTML, '<div class="description"><a href="" author (reviewer)</div><ul class="actions"><li><button>Roll out</button></li></ul>');
 });
 
-test('TestFailures', 10, function() {
+test('TestFailures', 11, function() {
     var testFailures = new ui.notifications.TestFailures();
     equal(testFailures.tagName, 'LI');
     equal(testFailures.innerHTML,
         '<time class="relative">Just now</time>' +
+        '<table class="failures">' +
+            '<thead><tr><td>type</td><td>release</td><td>debug</td></tr></thead>' +
+            '<tbody></tbody>' +
+        '</table>' +
         '<div class="what">' +
             '<div class="problem">' +
                 '<ul class="effects"></ul>' +
@@ -104,10 +108,14 @@
         '<ul class="actions">' +
             '<li><button>Examine</button></li>' +
         '</ul>');
-    testFailures.addFailureAnalysis({testName: 'test'});
+    testFailures.addFailureAnalysis({testName: 'test', resultNodesByBuilder: {}});
     equal(testFailures.index(), 0);
     equal(testFailures.innerHTML,
         '<time class="relative">Just now</time>' +
+        '<table class="failures">' +
+            '<thead><tr><td>type</td><td>release</td><td>debug</td></tr></thead>' +
+            '<tbody></tbody>' +
+        '</table>' +
         '<div class="what">' +
             '<div class="problem">' +
                 '<ul class="effects">' +
@@ -124,6 +132,10 @@
     testFailures.addFailureAnalysis({testName: 'test'});
     equal(testFailures.innerHTML,
         '<time class="relative">Just now</time>' +
+        '<table class="failures">' +
+            '<thead><tr><td>type</td><td>release</td><td>debug</td></tr></thead>' +
+            '<tbody></tbody>' +
+        '</table>' +
         '<div class="what">' +
             '<div class="problem">' +
                 '<ul class="effects">' +
@@ -142,6 +154,10 @@
     equal(testFailures.index(), time.getTime());
     equal(testFailures.innerHTML,
         '<time class="relative">10 minutes ago</time>' +
+        '<table class="failures">' +
+            '<thead><tr><td>type</td><td>release</td><td>debug</td></tr></thead>' +
+            '<tbody></tbody>' +
+        '</table>' +
         '<div class="what">' +
             '<div class="problem">' +
                 '<ul class="effects">' +
@@ -162,6 +178,42 @@
         '<ul class="actions">' +
             '<li><button>Examine</button></li>' +
         '</ul>');
+
+    testFailures.addFailureAnalysis({testName: 'foo', resultNodesByBuilder: {'Webkit Linux (dbg)(1)': { actual: 'TEXT'}}});
+    equal(testFailures.innerHTML,
+        '<time class="relative">10 minutes ago</time>' +
+        '<table class="failures">' +
+            '<thead><tr><td>type</td><td>release</td><td>debug</td></tr></thead>' +
+            '<tbody>' +
+                '<tr>' +
+                    '<td>TEXT</td>' +
+                    '<td></td>' +
+                    '<td><div><span class="build-type">64-bit</span><span class="version">lucid</span></div></td>' +
+                '</tr>' +
+            '</tbody>' +
+        '</table>' +
+        '<div class="what">' +
+            '<div class="problem">' +
+                '<ul class="effects">' +
+                    '<li>test</li>' +
+                    '<li>foo</li>' +
+                '</ul>' +
+                '<ul class="causes">' +
+                    '<li>' +
+                        '<div class="description">' +
+                            '<a href="" author (reviewer)'+
+                        '</div>' +
+                        '<ul class="actions">' +
+                            '<li><button>Roll out</button></li>' +
+                        '</ul>' +
+                    '</li>' +
+                '</ul>' +
+            '</div>' +
+        '</div>' +
+        '<ul class="actions">' +
+            '<li><button>Examine</button></li>' +
+        '</ul>');
+
 });
 
 test('BuildersFailing', 1, function() {
@@ -169,6 +221,10 @@
     builderFailing.setFailingBuilders(['WebKit Linux', 'Webkit Vista']);
     equal(builderFailing.innerHTML,
         '<time class="relative">Just now</time>' +
+        '<table class="failures">' +
+            '<thead><tr><td>type</td><td>release</td><td>debug</td></tr></thead>' +
+            '<tbody></tbody>' +
+        '</table>' +
         '<div class="what">' +
             '<div class="problem">Build Failed:' +
                 '<ul class="effects">' +

Modified: trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/summary.html (93800 => 93801)


--- trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/summary.html	2011-08-25 18:05:40 UTC (rev 93800)
+++ trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/summary.html	2011-08-25 18:07:02 UTC (rev 93801)
@@ -45,6 +45,7 @@
 <script src=""
 <script src=""
 <script src=""
+<script src=""
 <script src=""
 <script src=""
 <script src=""

Modified: trunk/Tools/ChangeLog (93800 => 93801)


--- trunk/Tools/ChangeLog	2011-08-25 18:05:40 UTC (rev 93800)
+++ trunk/Tools/ChangeLog	2011-08-25 18:07:02 UTC (rev 93801)
@@ -1,3 +1,19 @@
+2011-08-25  Dimitri Glazkov  <[email protected]>
+
+        garden-o-matic needs a way to report where and how tests are failing in the summary view.
+        https://bugs.webkit.org/show_bug.cgi?id=66955
+
+        Introduce FailureGrid, your one-stop failure-indicating destination. 
+
+        Reviewed by Adam Barth.
+
+        * BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/run-unittests.html: Added new scripts.
+        * BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/ui/failures.js: Added.
+        * BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/ui/failures_unittests.js: Added.
+        * BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/ui/notifications.js: Updated to use FailureGrid.
+        * BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/ui/notifications_unittests.js: Updated tests.
+        * BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/summary.html: Added new scripts.
+
 2011-08-25  Igor Oliveira  <[email protected]>
 
         Add myself to the committers list
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to