[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

mihaip at chromium.org mihaip at chromium.org
Wed Dec 22 16:09:42 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit e690192b5aafb97489d8311bf8b207a8fcb9a5dc
Author: mihaip at chromium.org <mihaip at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Fri Nov 19 04:51:17 2010 +0000

    2010-11-18  Mihai Parparita  <mihaip at chromium.org>
    
            Reviewed by Tony Chang.
    
            Rebaseline server: add rebaseline queue
            https://bugs.webkit.org/show_bug.cgi?id=49763
    
            Add a UI queue (a multi-item <select>) where tests to be baselined
            can be enqueued (also supports basic removal). A queue is used instead
            of immediately doing rebaselines since SCM operations can take a while.
            It's better to go through lots of tests quickly to mark them as
            needing rebaselining and then batch the SCM operations.
    
            Also adds a simple log where results can be displayed.
    
            * Scripts/webkitpy/tool/commands/data/rebaselineserver/index.html:
            * Scripts/webkitpy/tool/commands/data/rebaselineserver/main.css:
            * Scripts/webkitpy/tool/commands/data/rebaselineserver/main.js:
            * Scripts/webkitpy/tool/commands/data/rebaselineserver/queue.js: Added.
            * Scripts/webkitpy/tool/commands/data/rebaselineserver/util.js:
            * Scripts/webkitpy/tool/commands/rebaselineserver.py:
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@72364 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKitTools/ChangeLog b/WebKitTools/ChangeLog
index e278d36..ebaa2d4 100644
--- a/WebKitTools/ChangeLog
+++ b/WebKitTools/ChangeLog
@@ -1,3 +1,25 @@
+2010-11-18  Mihai Parparita  <mihaip at chromium.org>
+
+        Reviewed by Tony Chang.
+
+        Rebaseline server: add rebaseline queue
+        https://bugs.webkit.org/show_bug.cgi?id=49763
+        
+        Add a UI queue (a multi-item <select>) where tests to be baselined
+        can be enqueued (also supports basic removal). A queue is used instead
+        of immediately doing rebaselines since SCM operations can take a while.
+        It's better to go through lots of tests quickly to mark them as
+        needing rebaselining and then batch the SCM operations.
+        
+        Also adds a simple log where results can be displayed.
+
+        * Scripts/webkitpy/tool/commands/data/rebaselineserver/index.html:
+        * Scripts/webkitpy/tool/commands/data/rebaselineserver/main.css:
+        * Scripts/webkitpy/tool/commands/data/rebaselineserver/main.js:
+        * Scripts/webkitpy/tool/commands/data/rebaselineserver/queue.js: Added.
+        * Scripts/webkitpy/tool/commands/data/rebaselineserver/util.js:
+        * Scripts/webkitpy/tool/commands/rebaselineserver.py:
+
 2010-11-18  Gavin Barraclough  <barraclough at apple.com>
 
         Reviewed by Oliver Hunt.
diff --git a/WebKitTools/Scripts/webkitpy/tool/commands/data/rebaselineserver/index.html b/WebKitTools/Scripts/webkitpy/tool/commands/data/rebaselineserver/index.html
index 8cc48c1..e333e43 100644
--- a/WebKitTools/Scripts/webkitpy/tool/commands/data/rebaselineserver/index.html
+++ b/WebKitTools/Scripts/webkitpy/tool/commands/data/rebaselineserver/index.html
@@ -35,13 +35,24 @@
   <script src="/util.js"></script>
   <script src="/loupe.js"></script>
   <script src="/main.js"></script>
+  <script src="/queue.js"></script>
 </head>
 <body class="loading">
 
+<pre id="log" style="display: none"></pre>
+<div id="queue" style="display: none">
+  Queue:
+  <select id="queue-select" size="10"></select>
+  <button id="remove-queue-selection">Remove selection</button>
+  <button id="rebaseline-queue">Rebaseline queue</button>
+</div>
+
 <div id="header">
   <div id="controls">
     <!-- Add a dummy <select> node so that this lines up with the text on the left -->
     <select style="visibility: hidden"></select>
+    <span id="toggle-log" class="link">Log</span>
+    <span class="divider">|</span>    
     <a href="/quitquitquit">Exit</a>
   </div>
 
@@ -101,6 +112,18 @@
   </tbody>
 </table>
 
+<div id="footer">
+  <label>State: <span id="state"></span></label>
+
+  <!-- Add a dummy <button> node so that this lines up with the text on the left -->
+  <button style="visibility: hidden"></button>
+  
+  <div id="action-buttons">
+    <span id="toggle-queue" class="link">Queue</span>
+    <button id="add-to-rebaseline-queue">Add to rebaseline queue</button>
+  </div>
+</div>
+
 <table id="loupe" style="display: none">
   <tr>
     <td colspan="3" id="loupe-info">
diff --git a/WebKitTools/Scripts/webkitpy/tool/commands/data/rebaselineserver/main.css b/WebKitTools/Scripts/webkitpy/tool/commands/data/rebaselineserver/main.css
index 6e90fe4..1ad47ef 100644
--- a/WebKitTools/Scripts/webkitpy/tool/commands/data/rebaselineserver/main.css
+++ b/WebKitTools/Scripts/webkitpy/tool/commands/data/rebaselineserver/main.css
@@ -55,15 +55,52 @@ a, .link {
   text-decoration: none;
 }
 
-#header {
+#log,
+#queue {
+  padding: .25em 0 0 .25em;
+  position: absolute;
+  right: 0;
+  height: 200px;
+  overflow: auto;
+  background: #fff;
+  -webkit-box-shadow: 1px 1px 5px rgba(0, 0, 0, .5);
+}
+
+#log {
+  top: 2em;
+  width: 500px;
+}
+
+#queue {
+  bottom: 3em;
+  width: 400px;
+}
+
+#queue-select {
+  display: block;
+  width: 390px;
+}
+
+#header,
+#footer {
   padding: .5em 1em;
   background: #333;
   color: #fff;
   -webkit-box-shadow: 0 1px 5px rgba(0, 0, 0, 0.5);
+}
+
+#header {
   margin-bottom: 1em;
 }
 
-#header label {
+#header .divider,
+#footer .divider {
+  opacity: .3;
+  padding: 0 .5em;
+}
+
+#header label,
+#footer label {
   padding-right: 1em;
   color: #ccc;
 }
@@ -150,6 +187,42 @@ a, .link {
   background: #eee;
 }
 
+#footer {
+  position: absolute;
+  bottom: 0;
+  left: 0;
+  right: 0;
+  margin-top: 1em;
+}
+
+#state.needs_rebaseline {
+  color: yellow;
+}
+
+#state.rebaseline_failed {
+  color: red;
+}
+
+#state.rebaseline_succeeded {
+  color: green;
+}
+
+#state.in_queue {
+  color: gray;
+}
+
+#action-buttons {
+  float: right;
+}
+
+#action-buttons .link {
+  margin-right: 1em;
+}
+
+#footer button {
+  padding: 1em;
+}
+
 #loupe {
   -webkit-box-shadow: 2px 2px 5px rgba(0, 0, 0, .5);
   position: absolute;
diff --git a/WebKitTools/Scripts/webkitpy/tool/commands/data/rebaselineserver/main.js b/WebKitTools/Scripts/webkitpy/tool/commands/data/rebaselineserver/main.js
index fa037b3..4119b0b 100644
--- a/WebKitTools/Scripts/webkitpy/tool/commands/data/rebaselineserver/main.js
+++ b/WebKitTools/Scripts/webkitpy/tool/commands/data/rebaselineserver/main.js
@@ -30,11 +30,22 @@
 
 var ALL_DIRECTORY_PATH = '[all]';
 
+var STATE_NEEDS_REBASELINE = 'needs_rebaseline';
+var STATE_REBASELINE_FAILED = 'rebaseline_failed';
+var STATE_REBASELINE_SUCCEEDED = 'rebaseline_succeeded';
+var STATE_IN_QUEUE = 'in_queue';
+var STATE_TO_DISPLAY_STATE = {};
+STATE_TO_DISPLAY_STATE[STATE_NEEDS_REBASELINE] = 'Needs rebaseline';
+STATE_TO_DISPLAY_STATE[STATE_REBASELINE_FAILED] = 'Rebaseline failed';
+STATE_TO_DISPLAY_STATE[STATE_REBASELINE_SUCCEEDED] = 'Rebaseline succeeded';
+STATE_TO_DISPLAY_STATE[STATE_IN_QUEUE] = 'In queue';
+
 var results;
 var testsByFailureType = {};
 var testsByDirectory = {};
 var selectedTests = [];
 var loupe;
+var queue;
 
 function main()
 {
@@ -44,7 +55,10 @@ function main()
     $('next-test').addEventListener('click', nextTest);
     $('previous-test').addEventListener('click', previousTest);
 
+    $('toggle-log').addEventListener('click', function() { toggle('log'); });
+
     loupe = new Loupe();
+    queue = new RebaselineQueue();
 
     document.addEventListener('keydown', function(event) {
         if (event.altKey || event.ctrlKey || event.metaKey || event.shiftKey) {
@@ -60,6 +74,15 @@ function main()
             event.preventDefault();
             nextTest();
             break;
+        case 'U+0051': // q
+            queue.addCurrentTest();
+            break;
+        case 'U+0058': // x
+            queue.removeCurrentTest();
+            break;
+        case 'U+0052': // r
+            queue.rebaseline();
+            break;
         }
     });
 
@@ -229,6 +252,12 @@ function updateState()
 
     $('test-link').href =
         'http://trac.webkit.org/browser/trunk/LayoutTests/' + testName;
+
+    var state = results.tests[testName].state;
+    $('state').className = state;
+    $('state').innerHTML = STATE_TO_DISPLAY_STATE[state];
+
+    queue.updateState();
 }
 
 function getTestResultUrl(testName, mode)
diff --git a/WebKitTools/Scripts/webkitpy/tool/commands/data/rebaselineserver/queue.js b/WebKitTools/Scripts/webkitpy/tool/commands/data/rebaselineserver/queue.js
new file mode 100644
index 0000000..3282362
--- /dev/null
+++ b/WebKitTools/Scripts/webkitpy/tool/commands/data/rebaselineserver/queue.js
@@ -0,0 +1,155 @@
+/*
+ * Copyright (c) 2010 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:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *     * 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.
+ *     * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT
+ * OWNER OR 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 RebaselineQueue()
+{
+    this._selectNode = $('queue-select');
+    this._rebaselineButtonNode = $('rebaseline-queue');
+    this._toggleNode = $('toggle-queue');
+    this._removeSelectionButtonNode = $('remove-queue-selection');
+
+    this._inProgressRebaselineCount = 0;
+
+    var self = this;
+    $('add-to-rebaseline-queue').addEventListener(
+        'click', function() { self.addCurentTest(); });
+    this._selectNode.addEventListener('change', updateState);
+    this._removeSelectionButtonNode.addEventListener(
+        'click', function() { self._removeSelection(); });
+    this._rebaselineButtonNode.addEventListener(
+        'click', function() { self.rebaseline(); });
+    this._toggleNode.addEventListener(
+        'click', function() { toggle('queue'); });
+}
+
+RebaselineQueue.prototype.updateState = function()
+{
+    var testName = getSelectedTest();
+
+    var state = results.tests[testName].state;
+    $('add-to-rebaseline-queue').disabled = state != STATE_NEEDS_REBASELINE;
+
+    var queueLength = this._selectNode.options.length;
+    if (this._inProgressRebaselineCount > 0) {
+      this._rebaselineButtonNode.disabled = true;
+      this._rebaselineButtonNode.textContent =
+          'Rebaseline in progress (' + this._inProgressRebaselineCount +
+          ' tests left)';
+    } else if (queueLength == 0) {
+      this._rebaselineButtonNode.disabled = true;
+      this._rebaselineButtonNode.textContent = 'Rebaseline queue';
+      this._toggleNode.textContent = 'Queue';
+    } else {
+      this._rebaselineButtonNode.disabled = false;
+      this._rebaselineButtonNode.textContent =
+          'Rebaseline queue (' + queueLength + ' tests)';
+      this._toggleNode.textContent = 'Queue (' + queueLength + ' tests)';
+    }
+    this._removeSelectionButtonNode.disabled =
+        this._selectNode.selectedIndex == -1;
+};
+
+RebaselineQueue.prototype.addCurrentTest = function()
+{
+    var testName = getSelectedTest();
+    var test = results.tests[testName];
+
+    if (test.state != STATE_NEEDS_REBASELINE) {
+        log('Cannot add test with state "' + test.state + '" to queue.',
+            log.WARNING);
+        return;
+    }
+
+    var queueOption = document.createElement('option');
+    queueOption.value = testName;
+    queueOption.textContent = testName;
+    this._selectNode.appendChild(queueOption);
+    test.state = STATE_IN_QUEUE;
+    updateState();
+};
+
+RebaselineQueue.prototype.removeCurrentTest = function()
+{
+    this._removeTest(getSelectedTest());
+};
+
+RebaselineQueue.prototype._removeSelection = function()
+{
+    if (this._selectNode.selectedIndex == -1)
+        return;
+
+    this._removeTest(
+        this._selectNode.options[this._selectNode.selectedIndex].value);
+};
+
+RebaselineQueue.prototype._removeTest = function(testName)
+{
+    var queueOption = this._selectNode.firstChild;
+
+    while (queueOption && queueOption.value != testName) {
+        queueOption = queueOption.nextSibling;
+    }
+
+    if (!queueOption)
+        return;
+
+    this._selectNode.removeChild(queueOption);
+    var test = results.tests[testName];
+    test.state = STATE_NEEDS_REBASELINE;
+    updateState();
+};
+
+RebaselineQueue.prototype.rebaseline = function()
+{
+    var testNames = [];
+    for (var queueOption = this._selectNode.firstChild;
+         queueOption;
+         queueOption = queueOption.nextSibling) {
+        testNames.push(queueOption.value);
+    }
+
+    this._inProgressRebaselineCount = testNames.length;
+    updateState();
+
+    testNames.forEach(this._rebaselineTest, this);
+};
+
+RebaselineQueue.prototype._rebaselineTest = function(testName)
+{
+    // FIXME: actually rebaseline
+    log('Rebaselining ' + testName + '...');
+    var test = results.tests[testName];
+    this._removeTest(testName);
+    this._inProgressRebaselineCount--;
+    test.state = STATE_REBASELINE_SUCCEEDED;
+    updateState();
+    log('Rebaselined add test with state ' + test.state + ' to queue',
+        log.SUCCESS);    
+};
diff --git a/WebKitTools/Scripts/webkitpy/tool/commands/data/rebaselineserver/util.js b/WebKitTools/Scripts/webkitpy/tool/commands/data/rebaselineserver/util.js
index 1c8782b..213eed9 100644
--- a/WebKitTools/Scripts/webkitpy/tool/commands/data/rebaselineserver/util.js
+++ b/WebKitTools/Scripts/webkitpy/tool/commands/data/rebaselineserver/util.js
@@ -55,3 +55,35 @@ function loadText(url, callback)
     xhr.addEventListener('load', function() { callback(xhr.responseText); });
     xhr.send();
 }
+
+function log(text, type)
+{
+    var node = $('log');
+    
+    if (type) {
+        var typeNode = document.createElement('span');
+        typeNode.textContent = type.text;
+        typeNode.style.color = type.color;
+        node.appendChild(typeNode);
+    }
+
+    node.appendChild(document.createTextNode(text + '\n'));
+    node.scrollTop = node.scrollHeight;
+}
+
+log.WARNING = {text: 'Warning: ', color: '#aa3'};
+log.SUCCESS = {text: 'Success: ', color: 'green'};
+log.ERROR = {text: 'Error: ', color: 'red'};
+
+function toggle(id)
+{
+    var element = $(id);
+    var toggler = $('toggle-' + id);
+    if (element.style.display == 'none') {
+        element.style.display = '';
+        toggler.className = 'link selected';
+    } else {
+        element.style.display = 'none';
+        toggler.className = 'link';
+    }
+}
diff --git a/WebKitTools/Scripts/webkitpy/tool/commands/rebaselineserver.py b/WebKitTools/Scripts/webkitpy/tool/commands/rebaselineserver.py
index abb2af4..8b426a8 100644
--- a/WebKitTools/Scripts/webkitpy/tool/commands/rebaselineserver.py
+++ b/WebKitTools/Scripts/webkitpy/tool/commands/rebaselineserver.py
@@ -48,6 +48,10 @@ from wsgiref.handlers import format_date_time
 from webkitpy.tool.multicommandtool import AbstractDeclarativeCommand
 import webkitpy.thirdparty.simplejson as simplejson
 
+STATE_NEEDS_REBASELINE = 'needs_rebaseline'
+STATE_REBASELINE_FAILED = 'rebaseline_failed'
+STATE_REBASELINE_SUCCEEDED = 'rebaseline_succeeded'
+
 class RebaselineHTTPServer(BaseHTTPServer.HTTPServer):
     def __init__(self, httpd_port, results_directory, results_json):
         BaseHTTPServer.HTTPServer.__init__(self, ("", httpd_port), RebaselineHTTPRequestHandler)
@@ -61,6 +65,7 @@ class RebaselineHTTPRequestHandler(BaseHTTPServer.BaseHTTPRequestHandler):
         "loupe.js",
         "main.js",
         "main.css",
+        "queue.js",
         "util.js",
     ])
 
@@ -189,6 +194,9 @@ class RebaselineServer(AbstractDeclarativeCommand):
             results_json_file = file(results_json_path)
             results_json = simplejson.load(results_json_file)
 
+        for test_file, test_json in results_json['tests'].items():
+            test_json['state'] = STATE_NEEDS_REBASELINE
+
         print "Starting server at http://localhost:%d/" % options.httpd_port
         print ("Use the 'Exit' link in the UI, http://localhost:%d/"
             "quitquitquit or Ctrl-C to stop") % options.httpd_port

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list