Changeset 90410 in webkit


Ignore:
Timestamp:
Jul 5, 2011 3:52:01 PM (13 years ago)
Author:
abarth@webkit.org
Message:

2011-07-05 Adam Barth <abarth@webkit.org>

Add trivial garden-o-matic command (with server)
https://bugs.webkit.org/show_bug.cgi?id=63872

Reviewed by Eric Seidel.

This patch adds a trivial "Hello, world" garden-o-matic command,
complete with an HTTP server. This command re-uses a bunch of code
from the existing rebaseline-server command. Over time, this command
will grow to be a tool useful for gardening the WebKit tree.

  • Scripts/webkitpy/tool/commands/init.py:
  • Scripts/webkitpy/tool/commands/abstractservercommand.py: Added.
  • Scripts/webkitpy/tool/commands/gardenomatic.py: Added.
  • Scripts/webkitpy/tool/commands/rebaselineserver.py:
  • Scripts/webkitpy/tool/servers/data/gardeningserver/index.html: Added.
  • Scripts/webkitpy/tool/servers/gardeningserver.py: Added.
  • Scripts/webkitpy/tool/servers/rebaselineserver.py:
Location:
trunk/Tools
Files:
5 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Tools/ChangeLog

    r90409 r90410  
     12011-07-05  Adam Barth  <abarth@webkit.org>
     2
     3        Add trivial garden-o-matic command (with server)
     4        https://bugs.webkit.org/show_bug.cgi?id=63872
     5
     6        Reviewed by Eric Seidel.
     7
     8        This patch adds a trivial "Hello, world" garden-o-matic command,
     9        complete with an HTTP server.  This command re-uses a bunch of code
     10        from the existing rebaseline-server command.  Over time, this command
     11        will grow to be a tool useful for gardening the WebKit tree.
     12
     13        * Scripts/webkitpy/tool/commands/__init__.py:
     14        * Scripts/webkitpy/tool/commands/abstractservercommand.py: Added.
     15        * Scripts/webkitpy/tool/commands/gardenomatic.py: Added.
     16        * Scripts/webkitpy/tool/commands/rebaselineserver.py:
     17        * Scripts/webkitpy/tool/servers/data/gardeningserver/index.html: Added.
     18        * Scripts/webkitpy/tool/servers/gardeningserver.py: Added.
     19        * Scripts/webkitpy/tool/servers/rebaselineserver.py:
     20
    1212011-07-05  Adam Roben  <aroben@apple.com>
    222
  • trunk/Tools/Scripts/webkitpy/tool/commands/__init__.py

    r76926 r90410  
    11# Required for Python to search this directory for module files
    22
     3from webkitpy.tool.commands.bugfortest import BugForTest
    34from webkitpy.tool.commands.bugsearch import BugSearch
    4 from webkitpy.tool.commands.bugfortest import BugForTest
    55from webkitpy.tool.commands.download import *
    66from webkitpy.tool.commands.earlywarningsystem import *
     7from webkitpy.tool.commands.gardenomatic import GardenOMatic
    78from webkitpy.tool.commands.openbugs import OpenBugs
    89from webkitpy.tool.commands.prettydiff import PrettyDiff
  • trunk/Tools/Scripts/webkitpy/tool/commands/rebaselineserver.py

    r90337 r90410  
    3333import os
    3434import os.path
    35 import threading
    36 
    37 from optparse import make_option
    3835
    3936from webkitpy.common import system
     
    4138from webkitpy.layout_tests.layout_package import json_results_generator
    4239from webkitpy.layout_tests.port import factory
    43 from webkitpy.tool.multicommandtool import AbstractDeclarativeCommand
     40from webkitpy.tool.commands.abstractlocalservercommand import AbstractLocalServerCommand
    4441from webkitpy.tool.servers.rebaselineserver import RebaselineHTTPServer, STATE_NEEDS_REBASELINE
    4542
     
    5552
    5653
    57 class RebaselineServer(AbstractDeclarativeCommand):
     54class RebaselineServer(AbstractLocalServerCommand):
    5855    name = "rebaseline-server"
    5956    help_text = __doc__
    6057    argument_names = "/path/to/results/directory"
    6158
    62     def __init__(self):
    63         options = [
    64             make_option("--httpd-port", action="store", type="int", default=8127, help="Port to use for the the rebaseline HTTP server"),
    65         ]
    66         AbstractDeclarativeCommand.__init__(self, options=options)
     59    server = RebaselineHTTPServer
    6760
    68     def execute(self, options, args, tool):
     61    def _prepare_config(self, options, args, tool):
    6962        results_directory = args[0]
    7063        filesystem = system.filesystem.FileSystem()
    7164        scm = self._tool.scm()
    72 
    73         if options.dry_run:
    74 
    75             def no_op_copyfile(src, dest):
    76                 pass
    77 
    78             def no_op_add(path, return_exit_code=False):
    79                 if return_exit_code:
    80                     return 0
    81 
    82             filesystem.copyfile = no_op_copyfile
    83             scm.add = no_op_add
    8465
    8566        print 'Parsing unexpected_results.json...'
     
    8970        port = factory.get()
    9071        layout_tests_directory = port.layout_tests_dir()
    91         platforms = filesystem.listdir(
    92             filesystem.join(layout_tests_directory, 'platform'))
    93         test_config = TestConfig(
    94             port,
    95             layout_tests_directory,
    96             results_directory,
    97             platforms,
    98             filesystem,
    99             scm)
     72        platforms = filesystem.listdir(filesystem.join(layout_tests_directory, 'platform'))
     73        test_config = TestConfig(port, layout_tests_directory, results_directory, platforms, filesystem, scm)
    10074
    10175        print 'Gathering current baselines...'
     
    11387        results_json['tests'] = new_tests_subtree
    11488
    115         server_url = "http://localhost:%d/" % options.httpd_port
    116         print "Starting server at %s" % server_url
    117         print ("Use the 'Exit' link in the UI, %squitquitquit "
    118             "or Ctrl-C to stop") % server_url
    119 
    120         threading.Timer(
    121             .1, lambda: self._tool.user.open_url(server_url)).start()
    122 
    123         httpd = RebaselineHTTPServer(
    124             httpd_port=options.httpd_port,
    125             test_config=test_config,
    126             results_json=results_json,
    127             platforms_json={
     89        return {
     90            'test_config': test_config,
     91            "results_json": results_json,
     92            "platforms_json": {
    12893                'platforms': platforms,
    12994                'defaultPlatform': port.name(),
    130             })
    131         httpd.serve_forever()
     95            },
     96        }
  • trunk/Tools/Scripts/webkitpy/tool/servers/rebaselineserver.py

    r90337 r90410  
    197197
    198198class RebaselineHTTPServer(BaseHTTPServer.HTTPServer):
    199     def __init__(self, httpd_port, test_config, results_json, platforms_json):
    200         BaseHTTPServer.HTTPServer.__init__(self, ("", httpd_port), RebaselineHTTPRequestHandler)
    201         self.test_config = test_config
    202         self.results_json = results_json
    203         self.platforms_json = platforms_json
     199    def __init__(self, httpd_port, config):
     200        server_name = ""
     201        BaseHTTPServer.HTTPServer.__init__(self, (server_name, httpd_port), RebaselineHTTPRequestHandler)
     202        self.test_config = config['test_config']
     203        self.results_json = config['results_json']
     204        self.platforms_json = config['platforms_json']
    204205
    205206
Note: See TracChangeset for help on using the changeset viewer.