Title: [133061] trunk/Tools
Revision
133061
Author
[email protected]
Date
2012-10-31 12:36:03 -0700 (Wed, 31 Oct 2012)

Log Message

garden-o-matic should work for local results
https://bugs.webkit.org/show_bug.cgi?id=100805

Reviewed by Adam Barth.

This is the next step in making garden-o-matic replace
'webkit-patch rebaseline-server' and be able to deal with local
results. garden-o-matic now accepts a '--results-directory' option
that will point to a layout-test-results directory. At the moment
this will only work if you are also filtering to a single bot/
platform at a time (we can't handle multiple bots' worth of local
results, but that is a logical next step).

* BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/garden-o-matic.html:
* BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/config.js:
* BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/results.js:
* Scripts/webkitpy/tool/commands/gardenomatic.py:
(GardenOMatic.__init__):
(GardenOMatic.execute):
* Scripts/webkitpy/tool/commands/rebaseline.py:
(AbstractRebaseliningCommand):
(RebaselineTest.__init__):
(RebaselineTest._rebaseline_test):
(RebaselineTest._rebaseline_test_and_update_expectations):
(RebaselineTest.execute):
(AbstractParallelRebaselineCommand._rebaseline_commands):
(AbstractParallelRebaselineCommand._rebaseline):
(RebaselineJson.__init__):
* Scripts/webkitpy/tool/commands/rebaseline_unittest.py:
(_BaseTestCase):
(test_rebaseline_updates_expectations_file):
(test_rebaseline_does_not_include_overrides):
(test_rebaseline_test):
(test_rebaseline_test_and_print_scm_changes):
(test_rebaseline_and_copy_test):
(test_rebaseline_and_copy_test_no_existing_result):
(test_rebaseline_and_copy_test_with_lion_result):
(test_rebaseline_and_copy_no_overwrite_test):
(test_rebaseline_test_internal_with_move_overwritten_baselines_to):
(TestRebaselineJson.test_rebaseline_all):
(TestRebaselineJson.test_rebaseline_debug):
(TestRebaselineJson.test_move_overwritten):
(TestRebaselineJson.test_no_optimize):
(TestRebaselineExpectations.test_rebaseline_expectations):
* Scripts/webkitpy/tool/servers/gardeningserver.py:
(GardeningHTTPRequestHandler.rebaselineall):
(GardeningHTTPRequestHandler):
(GardeningHTTPRequestHandler.localresult):
* Scripts/webkitpy/tool/servers/reflectionhandler.py:
(ReflectionHandler.do_POST):
(ReflectionHandler):
(ReflectionHandler.do_HEAD):

Modified Paths

Diff

Modified: trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/garden-o-matic.html (133060 => 133061)


--- trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/garden-o-matic.html	2012-10-31 19:34:11 UTC (rev 133060)
+++ trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/garden-o-matic.html	2012-10-31 19:36:03 UTC (rev 133061)
@@ -32,9 +32,9 @@
                                          script-src 'self' file: https://ajax.googleapis.com;
                                          style-src 'self' 'unsafe-inline' file: https://ajax.googleapis.com http://fonts.googleapis.com;
                                          font-src http://themes.googleusercontent.com;
-                                         img-src 'self' https://ajax.googleapis.com http://build.chromium.org http://build.webkit.org file:;
-                                         media-src http://build.chromium.org http://build.webkit.org;
-                                         frame-src http://build.chromium.org http://build.webkit.org http://test-results.appspot.com;
+                                         img-src 'self' https://ajax.googleapis.com http://build.chromium.org http://build.webkit.org file: http://127.0.0.1:8127;
+                                         media-src http://build.chromium.org http://build.webkit.org http://127.0.0.1:8127;
+                                         frame-src http://build.chromium.org http://build.webkit.org http://test-results.appspot.com http://127.0.0.1:8127;
                                          connect-src http://trac.webkit.org http://build.chromium.org http://build.webkit.org http://127.0.0.1:8127">
 <title>Garden-O-Matic</title>
 <link rel="stylesheet" href=""

Modified: trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/config.js (133060 => 133061)


--- trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/config.js	2012-10-31 19:34:11 UTC (rev 133060)
+++ trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/config.js	2012-10-31 19:36:03 UTC (rev 133061)
@@ -189,4 +189,6 @@
     config.currentPlatform = platform;
 };
 
+config.useLocalResults = Boolean(base.getURLParameter('useLocalResults')) || false;
+
 })();

Modified: trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/results.js (133060 => 133061)


--- trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/results.js	2012-10-31 19:34:11 UTC (rev 133060)
+++ trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/results.js	2012-10-31 19:36:03 UTC (rev 133061)
@@ -27,7 +27,6 @@
 
 (function() {
 
-var kLayoutTestResultsPath = '/results/layout-test-results/';
 var kResultsName = 'full_results.json';
 
 var kBuildLinkRegexp = /a href=""
@@ -188,7 +187,9 @@
 
 function resultsDirectoryURL(platform, builderName)
 {
-    return layoutTestResultsURL(platform) + '/' + results.directoryForBuilder(builderName) + kLayoutTestResultsPath;
+    if (config.useLocalResults)
+        return config.kLocalServerURL + '/localresult?path=';
+    return resultsDirectoryListingURL(platform, builderName) + 'results/layout-test-results';
 }
 
 function resultsDirectoryListingURL(platform, builderName)

Modified: trunk/Tools/ChangeLog (133060 => 133061)


--- trunk/Tools/ChangeLog	2012-10-31 19:34:11 UTC (rev 133060)
+++ trunk/Tools/ChangeLog	2012-10-31 19:36:03 UTC (rev 133061)
@@ -1,5 +1,60 @@
 2012-10-31  Dirk Pranke  <[email protected]>
 
+        garden-o-matic should work for local results
+        https://bugs.webkit.org/show_bug.cgi?id=100805
+
+        Reviewed by Adam Barth.
+
+        This is the next step in making garden-o-matic replace
+        'webkit-patch rebaseline-server' and be able to deal with local
+        results. garden-o-matic now accepts a '--results-directory' option
+        that will point to a layout-test-results directory. At the moment
+        this will only work if you are also filtering to a single bot/
+        platform at a time (we can't handle multiple bots' worth of local
+        results, but that is a logical next step).
+
+        * BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/garden-o-matic.html:
+        * BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/config.js:
+        * BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/results.js:
+        * Scripts/webkitpy/tool/commands/gardenomatic.py:
+        (GardenOMatic.__init__):
+        (GardenOMatic.execute):
+        * Scripts/webkitpy/tool/commands/rebaseline.py:
+        (AbstractRebaseliningCommand):
+        (RebaselineTest.__init__):
+        (RebaselineTest._rebaseline_test):
+        (RebaselineTest._rebaseline_test_and_update_expectations):
+        (RebaselineTest.execute):
+        (AbstractParallelRebaselineCommand._rebaseline_commands):
+        (AbstractParallelRebaselineCommand._rebaseline):
+        (RebaselineJson.__init__):
+        * Scripts/webkitpy/tool/commands/rebaseline_unittest.py:
+        (_BaseTestCase):
+        (test_rebaseline_updates_expectations_file):
+        (test_rebaseline_does_not_include_overrides):
+        (test_rebaseline_test):
+        (test_rebaseline_test_and_print_scm_changes):
+        (test_rebaseline_and_copy_test):
+        (test_rebaseline_and_copy_test_no_existing_result):
+        (test_rebaseline_and_copy_test_with_lion_result):
+        (test_rebaseline_and_copy_no_overwrite_test):
+        (test_rebaseline_test_internal_with_move_overwritten_baselines_to):
+        (TestRebaselineJson.test_rebaseline_all):
+        (TestRebaselineJson.test_rebaseline_debug):
+        (TestRebaselineJson.test_move_overwritten):
+        (TestRebaselineJson.test_no_optimize):
+        (TestRebaselineExpectations.test_rebaseline_expectations):
+        * Scripts/webkitpy/tool/servers/gardeningserver.py:
+        (GardeningHTTPRequestHandler.rebaselineall):
+        (GardeningHTTPRequestHandler):
+        (GardeningHTTPRequestHandler.localresult):
+        * Scripts/webkitpy/tool/servers/reflectionhandler.py:
+        (ReflectionHandler.do_POST):
+        (ReflectionHandler):
+        (ReflectionHandler.do_HEAD):
+
+2012-10-31  Dirk Pranke  <[email protected]>
+
         garden-o-matic should support gardening a single port and specifying how to deal with overwritten baselines
         https://bugs.webkit.org/show_bug.cgi?id=100563
 

Modified: trunk/Tools/Scripts/webkitpy/tool/commands/gardenomatic.py (133060 => 133061)


--- trunk/Tools/Scripts/webkitpy/tool/commands/gardenomatic.py	2012-10-31 19:34:11 UTC (rev 133060)
+++ trunk/Tools/Scripts/webkitpy/tool/commands/gardenomatic.py	2012-10-31 19:36:03 UTC (rev 133061)
@@ -34,6 +34,7 @@
     def __init__(self):
         return super(AbstractRebaseliningCommand, self).__init__(options=(self.platform_options + [
             self.move_overwritten_baselines_option,
+            self.results_directory_option,
             self.no_optimize_option,
             ]))
 
@@ -48,6 +49,8 @@
             builder = builders.builder_name_for_port_name(options.platform)
             if builder:
                 args['builder'] = builder
+        if options.results_directory:
+            args['useLocalResults'] = "true"
 
         httpd = GardeningHTTPServer(httpd_port=8127, config={'tool': tool, 'options': options})
         self._tool.user.open_url(httpd.url(args))

Modified: trunk/Tools/Scripts/webkitpy/tool/commands/rebaseline.py (133060 => 133061)


--- trunk/Tools/Scripts/webkitpy/tool/commands/rebaseline.py	2012-10-31 19:34:11 UTC (rev 133060)
+++ trunk/Tools/Scripts/webkitpy/tool/commands/rebaseline.py	2012-10-31 19:36:03 UTC (rev 133061)
@@ -69,6 +69,8 @@
 
     platform_options = factory.platform_options()
 
+    results_directory_option = optparse.make_option("--results-directory", help="Local results directory to use")
+
     suffixes_option = optparse.make_option("--suffixes", default=','.join(BASELINE_SUFFIX_LIST), action=""
         help="Comma-separated-list of file types to rebaseline")
 
@@ -84,6 +86,7 @@
     def __init__(self):
         super(RebaselineTest, self).__init__(options=[
             self.no_optimize_option,
+            self.results_directory_option,
             self.suffixes_option,
             optparse.make_option("--builder", help="Builder to pull new baselines from"),
             optparse.make_option("--move-overwritten-baselines-to", action="" default=[],
@@ -164,8 +167,7 @@
     def _file_name_for_expected_result(self, test_name, suffix):
         return "%s-expected.%s" % (self._test_root(test_name), suffix)
 
-    def _rebaseline_test(self, builder_name, test_name, move_overwritten_baselines_to, suffix):
-        results_url = self._results_url(builder_name)
+    def _rebaseline_test(self, builder_name, test_name, move_overwritten_baselines_to, suffix, results_url):
         baseline_directory = self._baseline_directory(builder_name)
 
         source_baseline = "%s/%s" % (results_url, self._file_name_for_actual_result(test_name, suffix))
@@ -177,14 +179,15 @@
         _log.debug("Retrieving %s." % source_baseline)
         self._save_baseline(self._tool.web.get_binary(source_baseline, convert_404_to_None=True), target_baseline)
 
-    def _rebaseline_test_and_update_expectations(self, builder_name, test_name, platforms_to_move_existing_baselines_to):
+    def _rebaseline_test_and_update_expectations(self, builder_name, test_name, platforms_to_move_existing_baselines_to, results_url):
         for suffix in self._baseline_suffix_list:
-            self._rebaseline_test(builder_name, test_name, platforms_to_move_existing_baselines_to, suffix)
+            self._rebaseline_test(builder_name, test_name, platforms_to_move_existing_baselines_to, suffix, results_url)
         self._update_expectations_file(builder_name, test_name)
 
     def execute(self, options, args, tool):
         self._baseline_suffix_list = options.suffixes.split(',')
-        self._rebaseline_test_and_update_expectations(options.builder, options.test, options.move_overwritten_baselines_to)
+        results_url = options.results_directory or self._results_url(options.builder)
+        self._rebaseline_test_and_update_expectations(options.builder, options.test, options.move_overwritten_baselines_to, results_url)
         print json.dumps(self._scm_changes)
 
 
@@ -274,7 +277,7 @@
                 builders_to_fallback_paths[builder] = fallback_path
         return builders_to_fallback_paths.keys()
 
-    def _rebaseline_commands(self, test_list, move_overwritten_baselines=False, verbose=False):
+    def _rebaseline_commands(self, test_list, options):
 
         path_to_webkit_patch = self._tool.path()
         cwd = self._tool.scm().checkout_root
@@ -283,11 +286,13 @@
             for builder in self._builders_to_fetch_from(test_list[test]):
                 suffixes = ','.join(test_list[test][builder])
                 cmd_line = [path_to_webkit_patch, 'rebaseline-test-internal', '--suffixes', suffixes, '--builder', builder, '--test', test]
-                if move_overwritten_baselines:
+                if options.move_overwritten_baselines:
                     move_overwritten_baselines_to = builders.move_overwritten_baselines_to(builder)
                     for platform in move_overwritten_baselines_to:
                         cmd_line.extend(['--move-overwritten-baselines-to', platform])
-                if verbose:
+                if options.results_directory:
+                    cmd_line.extend(['--results_directory', options.results_directory])
+                if options.verbose:
                     cmd_line.append('--verbose')
                 commands.append(tuple([cmd_line, cwd]))
         return commands
@@ -325,7 +330,7 @@
             for builder, suffixes in sorted(builders.items()):
                 _log.debug("  %s: %s" % (builder, ",".join(suffixes)))
 
-        commands = self._rebaseline_commands(test_list, options.move_overwritten_baselines, options.verbose)
+        commands = self._rebaseline_commands(test_list, options)
         command_results = self._tool.executive.run_in_parallel(commands)
 
         log_output = '\n'.join(result[2] for result in command_results).replace('\n\n', '\n')
@@ -349,6 +354,7 @@
         return super(RebaselineJson, self).__init__(options=[
             self.move_overwritten_baselines_option,
             self.no_optimize_option,
+            self.results_directory_option,
             ])
 
     def execute(self, options, args, tool):

Modified: trunk/Tools/Scripts/webkitpy/tool/commands/rebaseline_unittest.py (133060 => 133061)


--- trunk/Tools/Scripts/webkitpy/tool/commands/rebaseline_unittest.py	2012-10-31 19:34:11 UTC (rev 133060)
+++ trunk/Tools/Scripts/webkitpy/tool/commands/rebaseline_unittest.py	2012-10-31 19:36:03 UTC (rev 133061)
@@ -38,6 +38,8 @@
 
 class _BaseTestCase(unittest.TestCase):
     MOCK_WEB_RESULT = 'MOCK Web result, convert 404 to None=True'
+    WEB_PREFIX = 'http://example.com/f/builders/WebKit Mac10.7/results/layout-test-results'
+
     command_constructor = None
 
     def setUp(self):
@@ -94,12 +96,12 @@
         self._write("fast/css/large-list-of-rules-crash.html", "Dummy test contents")
         self._write("userscripts/another-test.html", "Dummy test contents")
 
-        self.command._rebaseline_test_and_update_expectations("WebKit Mac10.7", "userscripts/another-test.html", None)
+        self.command._rebaseline_test_and_update_expectations("WebKit Mac10.7", "userscripts/another-test.html", None, self.WEB_PREFIX)
 
         self.assertEquals(self.tool.web.urls_fetched,
-            ['http://example.com/f/builders/WebKit Mac10.7/results/layout-test-results/userscripts/another-test-actual.png',
-             'http://example.com/f/builders/WebKit Mac10.7/results/layout-test-results/userscripts/another-test-actual.wav',
-             'http://example.com/f/builders/WebKit Mac10.7/results/layout-test-results/userscripts/another-test-actual.txt'])
+            [self.WEB_PREFIX + '/userscripts/another-test-actual.png',
+             self.WEB_PREFIX + '/userscripts/another-test-actual.wav',
+             self.WEB_PREFIX + '/userscripts/another-test-actual.txt'])
         new_expectations = self._read(self.lion_expectations_path)
         self.assertEqual(new_expectations, """Bug(B) [ Mac Linux XP Debug ] fast/dom/Window/window-postmessage-clone-really-deep-array.html [ Pass ]
 Bug(A) [ Debug ] : fast/css/large-list-of-rules-crash.html [ Failure ]
@@ -109,12 +111,12 @@
         self._write(self.lion_expectations_path, "Bug(x) [ Mac ] userscripts/another-test.html [ ImageOnlyFailure ]\nbug(z) [ Linux ] userscripts/another-test.html [ ImageOnlyFailure ]\n")
         self._write("userscripts/another-test.html", "Dummy test contents")
 
-        self.command._rebaseline_test_and_update_expectations("WebKit Mac10.7", "userscripts/another-test.html", None)
+        self.command._rebaseline_test_and_update_expectations("WebKit Mac10.7", "userscripts/another-test.html", None, self.WEB_PREFIX)
 
         self.assertEquals(self.tool.web.urls_fetched,
-            ['http://example.com/f/builders/WebKit Mac10.7/results/layout-test-results/userscripts/another-test-actual.png',
-             'http://example.com/f/builders/WebKit Mac10.7/results/layout-test-results/userscripts/another-test-actual.wav',
-             'http://example.com/f/builders/WebKit Mac10.7/results/layout-test-results/userscripts/another-test-actual.txt'])
+            [self.WEB_PREFIX + '/userscripts/another-test-actual.png',
+             self.WEB_PREFIX + '/userscripts/another-test-actual.wav',
+             self.WEB_PREFIX + '/userscripts/another-test-actual.txt'])
         new_expectations = self._read(self.lion_expectations_path)
         self.assertEqual(new_expectations, "Bug(x) [ MountainLion SnowLeopard ] userscripts/another-test.html [ ImageOnlyFailure ]\nbug(z) [ Linux ] userscripts/another-test.html [ ImageOnlyFailure ]\n")
 
@@ -123,39 +125,43 @@
         self._write(self.lion_port.path_from_chromium_base('skia', 'skia_test_expectations.txt'), "Bug(y) [ Mac ] other-test.html [ Failure ]\n")
         self._write("userscripts/another-test.html", "Dummy test contents")
 
-        self.command._rebaseline_test_and_update_expectations("WebKit Mac10.7", "userscripts/another-test.html", None)
+        self.command._rebaseline_test_and_update_expectations("WebKit Mac10.7", "userscripts/another-test.html", None, self.WEB_PREFIX)
 
         self.assertEquals(self.tool.web.urls_fetched,
-            ['http://example.com/f/builders/WebKit Mac10.7/results/layout-test-results/userscripts/another-test-actual.png',
-             'http://example.com/f/builders/WebKit Mac10.7/results/layout-test-results/userscripts/another-test-actual.wav',
-             'http://example.com/f/builders/WebKit Mac10.7/results/layout-test-results/userscripts/another-test-actual.txt'])
+            [self.WEB_PREFIX + '/userscripts/another-test-actual.png',
+             self.WEB_PREFIX + '/userscripts/another-test-actual.wav',
+             self.WEB_PREFIX + '/userscripts/another-test-actual.txt'])
 
         new_expectations = self._read(self.lion_expectations_path)
         self.assertEqual(new_expectations, "Bug(x) [ MountainLion SnowLeopard ] userscripts/another-test.html [ ImageOnlyFailure ]\nBug(z) [ Linux ] userscripts/another-test.html [ ImageOnlyFailure ]\n")
 
     def test_rebaseline_test(self):
-        self.command._rebaseline_test("WebKit Linux", "userscripts/another-test.html", None, "txt")
-        self.assertEquals(self.tool.web.urls_fetched, ['http://example.com/f/builders/WebKit Linux/results/layout-test-results/userscripts/another-test-actual.txt'])
+        self.command._rebaseline_test("WebKit Linux", "userscripts/another-test.html", None, "txt", self.WEB_PREFIX)
+        self.assertEquals(self.tool.web.urls_fetched, [self.WEB_PREFIX + '/userscripts/another-test-actual.txt'])
 
+    def test_rebaseline_test_with_results_directory(self):
+        self.command._rebaseline_test("WebKit Linux", "userscripts/another-test.html", None, "txt", '/tmp')
+        self.assertEquals(self.tool.web.urls_fetched, ['/tmp/userscripts/another-test-actual.txt'])
+
     def test_rebaseline_test_and_print_scm_changes(self):
         self.command._print_scm_changes = True
         self.command._scm_changes = {'add': [], 'delete': []}
         self.tool._scm.exists = lambda x: False
 
-        self.command._rebaseline_test("WebKit Linux", "userscripts/another-test.html", None, "txt")
+        self.command._rebaseline_test("WebKit Linux", "userscripts/another-test.html", None, "txt", None)
 
         self.assertEquals(self.command._scm_changes, {'add': ['/mock-checkout/LayoutTests/platform/chromium-linux/userscripts/another-test-expected.txt'], 'delete': []})
 
     def test_rebaseline_and_copy_test(self):
         self._write("userscripts/another-test-expected.txt", "generic result")
 
-        self.command._rebaseline_test("WebKit Mac10.7", "userscripts/another-test.html", ["chromium-mac-snowleopard"], "txt")
+        self.command._rebaseline_test("WebKit Mac10.7", "userscripts/another-test.html", ["chromium-mac-snowleopard"], "txt", None)
 
         self.assertEquals(self._read('platform/chromium-mac-lion/userscripts/another-test-expected.txt'), self.MOCK_WEB_RESULT)
         self.assertEquals(self._read('platform/chromium-mac-snowleopard/userscripts/another-test-expected.txt'), 'generic result')
 
     def test_rebaseline_and_copy_test_no_existing_result(self):
-        self.command._rebaseline_test("WebKit Mac10.7", "userscripts/another-test.html", ["chromium-mac-snowleopard"], "txt")
+        self.command._rebaseline_test("WebKit Mac10.7", "userscripts/another-test.html", ["chromium-mac-snowleopard"], "txt", None)
 
         self.assertEquals(self._read('platform/chromium-mac-lion/userscripts/another-test-expected.txt'), self.MOCK_WEB_RESULT)
         self.assertFalse(self.tool.filesystem.exists(self._expand('platform/chromium-mac-snowleopard/userscripts/another-test-expected.txt')))
@@ -163,9 +169,9 @@
     def test_rebaseline_and_copy_test_with_lion_result(self):
         self._write("platform/chromium-mac-lion/userscripts/another-test-expected.txt", "original lion result")
 
-        self.command._rebaseline_test("WebKit Mac10.7", "userscripts/another-test.html", ["chromium-mac-snowleopard"], "txt")
+        self.command._rebaseline_test("WebKit Mac10.7", "userscripts/another-test.html", ["chromium-mac-snowleopard"], "txt", self.WEB_PREFIX)
 
-        self.assertEquals(self.tool.web.urls_fetched, ["http://example.com/f/builders/WebKit Mac10.7/results/layout-test-results/userscripts/another-test-actual.txt"])
+        self.assertEquals(self.tool.web.urls_fetched, [self.WEB_PREFIX + '/userscripts/another-test-actual.txt'])
         self.assertEquals(self._read("platform/chromium-mac-snowleopard/userscripts/another-test-expected.txt"), "original lion result")
         self.assertEquals(self._read("platform/chromium-mac-lion/userscripts/another-test-expected.txt"), self.MOCK_WEB_RESULT)
 
@@ -173,7 +179,7 @@
         self._write("platform/chromium-mac-lion/userscripts/another-test-expected.txt", "original lion result")
         self._write("platform/chromium-mac-snowleopard/userscripts/another-test-expected.txt", "original snowleopard result")
 
-        self.command._rebaseline_test("WebKit Mac10.7", "userscripts/another-test.html", ["chromium-mac-snowleopard"], "txt")
+        self.command._rebaseline_test("WebKit Mac10.7", "userscripts/another-test.html", ["chromium-mac-snowleopard"], "txt", None)
 
         self.assertEquals(self._read("platform/chromium-mac-snowleopard/userscripts/another-test-expected.txt"), "original snowleopard result")
         self.assertEquals(self._read("platform/chromium-mac-lion/userscripts/another-test-expected.txt"), self.MOCK_WEB_RESULT)
@@ -194,7 +200,8 @@
             }
 
             options = MockOptions(optimize=True, builder="MOCK SnowLeopard", suffixes="txt",
-                move_overwritten_baselines_to=["test-mac-leopard"], verbose=True, test="failures/expected/image.html")
+                move_overwritten_baselines_to=["test-mac-leopard"], verbose=True, test="failures/expected/image.html",
+                results_directory=None)
 
             oc.capture_output()
             self.command.execute(options, [], self.tool)
@@ -224,7 +231,7 @@
         super(TestRebaselineJson, self).tearDown()
 
     def test_rebaseline_all(self):
-        options = MockOptions(optimize=True, verbose=True, move_overwritten_baselines=False)
+        options = MockOptions(optimize=True, verbose=True, move_overwritten_baselines=False, results_directory=None)
         self.command._rebaseline(options,  {"user-scripts/another-test.html": {"MOCK builder": ["txt", "png"]}})
 
         # Note that we have one run_in_parallel() call followed by a run_command()
@@ -233,7 +240,7 @@
              ['echo', '--verbose', 'optimize-baselines', '--suffixes', 'txt,png', 'user-scripts/another-test.html']])
 
     def test_rebaseline_debug(self):
-        options = MockOptions(optimize=True, verbose=True, move_overwritten_baselines=False)
+        options = MockOptions(optimize=True, verbose=True, move_overwritten_baselines=False, results_directory=None)
         self.command._rebaseline(options,  {"user-scripts/another-test.html": {"MOCK builder (Debug)": ["txt", "png"]}})
 
         # Note that we have one run_in_parallel() call followed by a run_command()
@@ -242,7 +249,7 @@
              ['echo', '--verbose', 'optimize-baselines', '--suffixes', 'txt,png', 'user-scripts/another-test.html']])
 
     def test_move_overwritten(self):
-        options = MockOptions(optimize=True, verbose=True, move_overwritten_baselines=True)
+        options = MockOptions(optimize=True, verbose=True, move_overwritten_baselines=True, results_directory=None)
         self.command._rebaseline(options,  {"user-scripts/another-test.html": {"MOCK builder": ["txt", "png"]}})
 
         # Note that we have one run_in_parallel() call followed by a run_command()
@@ -251,14 +258,22 @@
              ['echo', '--verbose', 'optimize-baselines', '--suffixes', 'txt,png', 'user-scripts/another-test.html']])
 
     def test_no_optimize(self):
-        options = MockOptions(optimize=False, verbose=True, move_overwritten_baselines=False)
+        options = MockOptions(optimize=False, verbose=True, move_overwritten_baselines=False, results_directory=None)
         self.command._rebaseline(options,  {"user-scripts/another-test.html": {"MOCK builder (Debug)": ["txt", "png"]}})
 
         # Note that we have only one run_in_parallel() call
         self.assertEquals(self.tool.executive.calls,
             [[['echo', 'rebaseline-test-internal', '--suffixes', 'txt,png', '--builder', 'MOCK builder (Debug)', '--test', 'user-scripts/another-test.html', '--verbose']]])
 
+    def test_results_directory(self):
+        options = MockOptions(optimize=False, verbose=True, move_overwritten_baselines=False, results_directory='/tmp')
+        self.command._rebaseline(options,  {"user-scripts/another-test.html": {"MOCK builder": ["txt", "png"]}})
 
+        # Note that we have only one run_in_parallel() call
+        self.assertEquals(self.tool.executive.calls,
+            [[['echo', 'rebaseline-test-internal', '--suffixes', 'txt,png', '--builder', 'MOCK builder', '--test', 'user-scripts/another-test.html', '--results_directory', '/tmp', '--verbose']]])
+
+
 class TestRebaseline(_BaseTestCase):
     # This command shares most of its logic with RebaselineJson, so these tests just test what is different.
 
@@ -310,7 +325,7 @@
         self.tool.executive = MockExecutive2()
 
         self.command._tests_to_rebaseline = lambda port: {'userscripts/another-test.html': set(['txt']), 'userscripts/images.svg': set(['png'])}
-        self.command.execute(MockOptions(optimize=False, verbose=False, move_overwritten_baselines=False), [], self.tool)
+        self.command.execute(MockOptions(optimize=False, verbose=False, move_overwritten_baselines=False, results_directory=None), [], self.tool)
 
         # FIXME: change this to use the test- ports.
         calls = filter(lambda x: x != ['qmake', '-v'], self.tool.executive.calls)

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


--- trunk/Tools/Scripts/webkitpy/tool/servers/gardeningserver.py	2012-10-31 19:34:11 UTC (rev 133060)
+++ trunk/Tools/Scripts/webkitpy/tool/servers/gardeningserver.py	2012-10-31 19:36:03 UTC (rev 133061)
@@ -111,6 +111,8 @@
         command = ['rebaseline-json']
         if self.server.options.move_overwritten_baselines:
             command.append('--move-overwritten-baselines')
+        if self.server.options.results_directory:
+            command.extend(['--results-directory', self.server.options.results_directory])
         if not self.server.options.optimize:
             command.append('--no-optimize')
         if self.server.options.verbose:
@@ -127,3 +129,16 @@
 
         # FIXME: propagate error and/or log messages back to the UI.
         self._serve_text('success')
+
+    def localresult(self):
+        path = self.query['path'][0]
+        filesystem = self.server.tool.filesystem
+
+        # Ensure that we're only serving files from inside the results directory.
+        if not filesystem.isabs(path) and self.server.options.results_directory:
+            fullpath = filesystem.abspath(filesystem.join(self.server.options.results_directory, path))
+            if fullpath.startswith(filesystem.abspath(self.server.options.results_directory)):
+                self._serve_file(fullpath, headers_only=(self.command == 'HEAD'))
+                return
+
+        self._send_response(403)

Modified: trunk/Tools/Scripts/webkitpy/tool/servers/reflectionhandler.py (133060 => 133061)


--- trunk/Tools/Scripts/webkitpy/tool/servers/reflectionhandler.py	2012-10-31 19:34:11 UTC (rev 133060)
+++ trunk/Tools/Scripts/webkitpy/tool/servers/reflectionhandler.py	2012-10-31 19:36:03 UTC (rev 133061)
@@ -59,6 +59,9 @@
     def do_POST(self):
         self._handle_request()
 
+    def do_HEAD(self):
+        self._handle_request()
+
     def read_entity_body(self):
         length = int(self.headers.getheader('content-length'))
         return self.rfile.read(length)
@@ -116,7 +119,7 @@
         self.end_headers()
         json.dump(json_object, self.wfile)
 
-    def _serve_file(self, file_path, cacheable_seconds=0):
+    def _serve_file(self, file_path, cacheable_seconds=0, headers_only=False):
         if not os.path.exists(file_path):
             self.send_error(404, "File not found")
             return
@@ -136,4 +139,5 @@
                 self.send_header("Expires", expires_formatted)
             self.end_headers()
 
-            shutil.copyfileobj(static_file, self.wfile)
+            if not header_only:
+                shutil.copyfileobj(static_file, self.wfile)
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to