Title: [92166] trunk/Tools
Revision
92166
Author
aba...@webkit.org
Date
2011-08-01 20:47:48 -0700 (Mon, 01 Aug 2011)

Log Message

garden-o-matic should call optimize-baselines when rebaselining tests
https://bugs.webkit.org/show_bug.cgi?id=65499

Reviewed by Dimitri Glazkov.

I took the opportunity to modernize this code to use some of our more
powerful primitives from base.

* BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/base.js:
* BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/base_unittests.js:
* BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/checkout.js:
* Scripts/webkitpy/tool/servers/gardeningserver.py:
* Scripts/webkitpy/tool/servers/gardeningserver_unittest.py:

Modified Paths

Diff

Modified: trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/base.js (92165 => 92166)


--- trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/base.js	2011-08-02 03:09:50 UTC (rev 92165)
+++ trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/base.js	2011-08-02 03:47:48 UTC (rev 92166)
@@ -134,16 +134,18 @@
     });
 };
 
-base.callInSequence = function(functionList, callback)
+base.callInSequence = function(func, argumentList, callback)
 {
     var nextIndex = 0;
 
     function callNext()
     {
-        if (nextIndex >= functionList.length)
+        if (nextIndex >= argumentList.length) {
             callback();
+            return;
+        }
 
-        functionList[nextIndex].call(null, callNext);
+        func(argumentList[nextIndex++], callNext);
     }
 
     callNext();

Modified: trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/base_unittests.js (92165 => 92166)


--- trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/base_unittests.js	2011-08-02 03:09:50 UTC (rev 92165)
+++ trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/base_unittests.js	2011-08-02 03:47:48 UTC (rev 92166)
@@ -48,6 +48,46 @@
     deepEqual(base.keys({"a": 1, "b": { "c" : 1}}), ["a", "b"]);
 });
 
+test("callInParallel", 4, function() {
+    var expectedCall = [true, true, true];
+    var expectCompletionCallback = true;
+
+    base.callInParallel([
+        function(callback) {
+            ok(expectedCall[0]);
+            expectedCall[0] = false;
+            callback();
+        },
+        function(callback) {
+            ok(expectedCall[1]);
+            expectedCall[1] = false;
+            callback();
+        },
+        function(callback) {
+            ok(expectedCall[2]);
+            expectedCall[2] = false;
+            callback();
+        },
+    ], function() {
+        ok(expectCompletionCallback);
+        expectCompletionCallback = false;
+    })
+});
+
+test("callInSequence", 7, function() {
+    var expectedArg = 42;
+    var expectCompletionCallback = true;
+
+    base.callInSequence(function(arg, callback) {
+        ok(arg < 45);
+        equals(arg, expectedArg++);
+        callback();
+    }, [42, 43, 44], function() {
+        ok(expectCompletionCallback);
+        expectCompletionCallback = false;
+    })
+});
+
 test("RequestTracker", 3, function() {
     var ready = false;
     var tracker = new base.RequestTracker(1, function() {

Modified: trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/checkout.js (92165 => 92166)


--- trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/checkout.js	2011-08-02 03:09:50 UTC (rev 92165)
+++ trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/checkout.js	2011-08-02 03:47:48 UTC (rev 92166)
@@ -14,7 +14,7 @@
     return kWebKitTrunk + 'LayoutTests/' + testName;
 }
 
-checkout.existsAtRevision = function (subversionURL, revision, callback)
+checkout.existsAtRevision = function(subversionURL, revision, callback)
 {
     $.ajax({
         method: 'HEAD',
@@ -28,46 +28,38 @@
     });
 };
 
-checkout.rebaseline = function(builderName, testName, failureTypeList, callback)
+checkout.optimizeBaselines = function(testName, callback)
 {
-    var extensionList = [];
-
-    $.each(failureTypeList, function(index, failureType) {
-        extensionList = extensionList.concat(results.failureTypeToExtensionList(failureType));
+    $.post('/optimizebaselines?' + $.param({
+        'test': testName,
+    }), function() {
+        callback();
     });
+};
 
-    if (!extensionList.length)
-        callback();
+checkout.rebaseline = function(builderName, testName, failureTypeList, callback)
+{
+    var extensionList = Array.prototype.concat.apply([], failureTypeList.map(results.failureTypeToExtensionList));
 
-    var requestTracker = new base.RequestTracker(extensionList.length, callback);
-
-    $.each(extensionList, function(index, extension) {
+    base.callInSequence(function(extension, callback) {
         $.post('/rebaseline?' + $.param({
             'builder': builderName,
             'test': testName,
-            // FIXME: Rename "suffix" query parameter to "extension".
-            'suffix': extension
+            'extension': extension
         }), function() {
-            requestTracker.requestComplete();
+            callback();
         });
-    });
+    }, extensionList, callback);
 };
 
 checkout.rebaselineAll = function(rebaselineTasks, callback)
 {
-    var nextIndex = 0;
-
-    function rebaselineNext()
-    {
-        if (nextIndex >= rebaselineTasks.length) {
-            callback();
-            return;
-        }
-        var task = rebaselineTasks[nextIndex++];
-        checkout.rebaseline(task.builderName, task.testName, task.failureTypeList, rebaselineNext);
-    }
-
-    rebaselineNext();
+    base.callInSequence(function(task, callback) {
+        checkout.rebaseline(task.builderName, task.testName, task.failureTypeList, callback);
+    }, rebaselineTasks, function() {
+        var testNameList = base.uniquifyArray(rebaselineTasks.map(function(task) { return task.testName; }));
+        base.callInSequence(checkout.optimizeBaselines, testNameList, callback);
+    });
 };
 
 })();

Modified: trunk/Tools/ChangeLog (92165 => 92166)


--- trunk/Tools/ChangeLog	2011-08-02 03:09:50 UTC (rev 92165)
+++ trunk/Tools/ChangeLog	2011-08-02 03:47:48 UTC (rev 92166)
@@ -1,3 +1,19 @@
+2011-08-01  Adam Barth  <aba...@webkit.org>
+
+        garden-o-matic should call optimize-baselines when rebaselining tests
+        https://bugs.webkit.org/show_bug.cgi?id=65499
+
+        Reviewed by Dimitri Glazkov.
+
+        I took the opportunity to modernize this code to use some of our more
+        powerful primitives from base.
+
+        * BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/base.js:
+        * BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/base_unittests.js:
+        * BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/checkout.js:
+        * Scripts/webkitpy/tool/servers/gardeningserver.py:
+        * Scripts/webkitpy/tool/servers/gardeningserver_unittest.py:
+
 2011-08-01  Stephanie Lewis  <sle...@apple.com>
 
         Finish reconfiguration started by Lucas Forschler

Modified: trunk/Tools/Scripts/webkitpy/tool/servers/gardeningserver.py (92165 => 92166)


--- trunk/Tools/Scripts/webkitpy/tool/servers/gardeningserver.py	2011-08-02 03:09:50 UTC (rev 92165)
+++ trunk/Tools/Scripts/webkitpy/tool/servers/gardeningserver.py	2011-08-02 03:47:48 UTC (rev 92166)
@@ -83,11 +83,19 @@
     def rebaseline(self):
         builder = self.query['builder'][0]
         test = self.query['test'][0]
-        suffix = self.query['suffix'][0]
+        extension = self.query['extension'][0]
         self._run_webkit_patch([
             'rebaseline-test',
             builder,
             test,
-            suffix,
+            extension,
         ])
         self._serve_text('success')
+
+    def optimizebaselines(self):
+        test = self.query['test'][0]
+        self._run_webkit_patch([
+            'optimize-baselines',
+            test,
+        ])
+        self._serve_text('success')

Modified: trunk/Tools/Scripts/webkitpy/tool/servers/gardeningserver_unittest.py (92165 => 92166)


--- trunk/Tools/Scripts/webkitpy/tool/servers/gardeningserver_unittest.py	2011-08-02 03:09:50 UTC (rev 92165)
+++ trunk/Tools/Scripts/webkitpy/tool/servers/gardeningserver_unittest.py	2011-08-02 03:47:48 UTC (rev 92166)
@@ -77,4 +77,9 @@
     def test_rebaseline(self):
         expected_stderr = "MOCK run_command: ['echo', 'rebaseline-test', 'MOCK builder', 'user-scripts/another-test.html', 'txt'], cwd=/mock-checkout\n"
         expected_stdout = "== Begin Response ==\nsuccess\n== End Response ==\n"
-        self._post_to_path("/rebaseline?builder=MOCK+builder&test=user-scripts/another-test.html&suffix=txt", expected_stderr=expected_stderr, expected_stdout=expected_stdout)
+        self._post_to_path("/rebaseline?builder=MOCK+builder&test=user-scripts/another-test.html&extension=txt", expected_stderr=expected_stderr, expected_stdout=expected_stdout)
+
+    def test_optimizebaselines(self):
+        expected_stderr = "MOCK run_command: ['echo', 'optimize-baselines', 'user-scripts/another-test.html'], cwd=/mock-checkout\n"
+        expected_stdout = "== Begin Response ==\nsuccess\n== End Response ==\n"
+        self._post_to_path("/optimizebaselines?test=user-scripts/another-test.html", expected_stderr=expected_stderr, expected_stdout=expected_stdout)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to