http_server_driver and benchmark_builder should not be in run-benchmark's plan files
authorrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 6 Aug 2015 23:40:49 +0000 (23:40 +0000)
committerrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 6 Aug 2015 23:40:49 +0000 (23:40 +0000)
https://bugs.webkit.org/show_bug.cgi?id=147752

Reviewed by Chris Dumez.

Removed BenchmarkBuilderFactory since we have exactly one subclass of BenchmarkBuilder.

Also made HTTPServerDriverFactory instantiate the appropriate HTTP server based on the platform name instead of HTTP server name.
This allows us to remove --http-server-driver option from run-benchmark, which was added to support the HTTP server for iOS.

* Scripts/webkitpy/benchmark_runner/benchmark_builder: Removed.
* Scripts/webkitpy/benchmark_runner/benchmark_builder.py: Moved from benchmark_runner/benchmark_builder/generic_benchmark_builder.py.
* Scripts/webkitpy/benchmark_runner/benchmark_builder/__init__.py: Removed.
* Scripts/webkitpy/benchmark_runner/benchmark_builder/benchmark_builder_factory.py: Removed.
* Scripts/webkitpy/benchmark_runner/benchmark_builder/generic_benchmark_builder.py: Moved to benchmark_runner/benchmark_builder.py.
* Scripts/webkitpy/benchmark_runner/benchmark_runner.py:
(BenchmarkRunner.__init__): No longer takes http_server_driver_override as an argument since this is not handled by
HTTPServerDriverFactory taking the platform name as an argument.
(BenchmarkRunner.execute): Directly instantiate BenchmarkBuilder.
* Scripts/webkitpy/benchmark_runner/data/plans/dromaeo-cssquery.plan: Removed http_server_driver and benchmark_builder.
* Scripts/webkitpy/benchmark_runner/data/plans/dromaeo-dom.plan: Ditto.
* Scripts/webkitpy/benchmark_runner/data/plans/dromaeo-jslib.plan: Ditto.
* Scripts/webkitpy/benchmark_runner/data/plans/jetstream.plan: Ditto.
* Scripts/webkitpy/benchmark_runner/data/plans/jsbench.plan: Ditto.
* Scripts/webkitpy/benchmark_runner/data/plans/kraken.plan: Ditto.
* Scripts/webkitpy/benchmark_runner/data/plans/octane.plan: Ditto.
* Scripts/webkitpy/benchmark_runner/data/plans/speedometer.plan: Ditto.
* Scripts/webkitpy/benchmark_runner/data/plans/sunspider.plan: Ditto.
* Scripts/webkitpy/benchmark_runner/http_server_driver/__init__.py:
(http_server_driver_loader): Register http server drivers via supported platform names instead of http server names.
* Scripts/webkitpy/benchmark_runner/http_server_driver/http_server_driver.py:
(HTTPServerDriver): Replaced name by platforms.
* Scripts/webkitpy/benchmark_runner/http_server_driver/simple_http_server_driver.py:
(SimpleHTTPServerDriver): Ditto.
* Scripts/webkitpy/benchmark_runner/run_benchmark.py:
(parse_args): Removed --http-server-driver option.
(start): Ditto.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@188092 268f45cc-cd09-0410-ab3c-d52691b4dbfc

18 files changed:
Tools/ChangeLog
Tools/Scripts/webkitpy/benchmark_runner/benchmark_builder.py [moved from Tools/Scripts/webkitpy/benchmark_runner/benchmark_builder/generic_benchmark_builder.py with 97% similarity]
Tools/Scripts/webkitpy/benchmark_runner/benchmark_builder/__init__.py [deleted file]
Tools/Scripts/webkitpy/benchmark_runner/benchmark_builder/benchmark_builder_factory.py [deleted file]
Tools/Scripts/webkitpy/benchmark_runner/benchmark_runner.py
Tools/Scripts/webkitpy/benchmark_runner/data/plans/dromaeo-cssquery.plan
Tools/Scripts/webkitpy/benchmark_runner/data/plans/dromaeo-dom.plan
Tools/Scripts/webkitpy/benchmark_runner/data/plans/dromaeo-jslib.plan
Tools/Scripts/webkitpy/benchmark_runner/data/plans/jetstream.plan
Tools/Scripts/webkitpy/benchmark_runner/data/plans/jsbench.plan
Tools/Scripts/webkitpy/benchmark_runner/data/plans/kraken.plan
Tools/Scripts/webkitpy/benchmark_runner/data/plans/octane.plan
Tools/Scripts/webkitpy/benchmark_runner/data/plans/speedometer.plan
Tools/Scripts/webkitpy/benchmark_runner/data/plans/sunspider.plan
Tools/Scripts/webkitpy/benchmark_runner/http_server_driver/__init__.py
Tools/Scripts/webkitpy/benchmark_runner/http_server_driver/http_server_driver.py
Tools/Scripts/webkitpy/benchmark_runner/http_server_driver/simple_http_server_driver.py
Tools/Scripts/webkitpy/benchmark_runner/run_benchmark.py

index d658331..ddb9b29 100644 (file)
@@ -1,3 +1,43 @@
+2015-08-06  Ryosuke Niwa  <rniwa@webkit.org>
+
+        http_server_driver and benchmark_builder should not be in run-benchmark's plan files
+        https://bugs.webkit.org/show_bug.cgi?id=147752
+
+        Reviewed by Chris Dumez.
+
+        Removed BenchmarkBuilderFactory since we have exactly one subclass of BenchmarkBuilder.
+
+        Also made HTTPServerDriverFactory instantiate the appropriate HTTP server based on the platform name instead of HTTP server name.
+        This allows us to remove --http-server-driver option from run-benchmark, which was added to support the HTTP server for iOS.
+
+        * Scripts/webkitpy/benchmark_runner/benchmark_builder: Removed.
+        * Scripts/webkitpy/benchmark_runner/benchmark_builder.py: Moved from benchmark_runner/benchmark_builder/generic_benchmark_builder.py.
+        * Scripts/webkitpy/benchmark_runner/benchmark_builder/__init__.py: Removed.
+        * Scripts/webkitpy/benchmark_runner/benchmark_builder/benchmark_builder_factory.py: Removed.
+        * Scripts/webkitpy/benchmark_runner/benchmark_builder/generic_benchmark_builder.py: Moved to benchmark_runner/benchmark_builder.py.
+        * Scripts/webkitpy/benchmark_runner/benchmark_runner.py:
+        (BenchmarkRunner.__init__): No longer takes http_server_driver_override as an argument since this is not handled by
+        HTTPServerDriverFactory taking the platform name as an argument.
+        (BenchmarkRunner.execute): Directly instantiate BenchmarkBuilder.
+        * Scripts/webkitpy/benchmark_runner/data/plans/dromaeo-cssquery.plan: Removed http_server_driver and benchmark_builder.
+        * Scripts/webkitpy/benchmark_runner/data/plans/dromaeo-dom.plan: Ditto.
+        * Scripts/webkitpy/benchmark_runner/data/plans/dromaeo-jslib.plan: Ditto.
+        * Scripts/webkitpy/benchmark_runner/data/plans/jetstream.plan: Ditto.
+        * Scripts/webkitpy/benchmark_runner/data/plans/jsbench.plan: Ditto.
+        * Scripts/webkitpy/benchmark_runner/data/plans/kraken.plan: Ditto.
+        * Scripts/webkitpy/benchmark_runner/data/plans/octane.plan: Ditto.
+        * Scripts/webkitpy/benchmark_runner/data/plans/speedometer.plan: Ditto.
+        * Scripts/webkitpy/benchmark_runner/data/plans/sunspider.plan: Ditto.
+        * Scripts/webkitpy/benchmark_runner/http_server_driver/__init__.py:
+        (http_server_driver_loader): Register http server drivers via supported platform names instead of http server names.
+        * Scripts/webkitpy/benchmark_runner/http_server_driver/http_server_driver.py:
+        (HTTPServerDriver): Replaced name by platforms.
+        * Scripts/webkitpy/benchmark_runner/http_server_driver/simple_http_server_driver.py:
+        (SimpleHTTPServerDriver): Ditto.
+        * Scripts/webkitpy/benchmark_runner/run_benchmark.py:
+        (parse_args): Removed --http-server-driver option.
+        (start): Ditto.
+
 2015-08-06  Chris Dumez  <cdumez@apple.com>
 
         Toggle GPS state based on page visibility to save battery
@@ -15,10 +15,7 @@ from webkitpy.benchmark_runner.utils import get_path_from_project_root, force_re
 _log = logging.getLogger(__name__)
 
 
-class GenericBenchmarkBuilder(object):
-
-    builder_name = 'GenericBenchmarkBuilder'
-
+class BenchmarkBuilder(object):
     def prepare(self, name, plan):
         self._name = name
         self._web_root = tempfile.mkdtemp()
diff --git a/Tools/Scripts/webkitpy/benchmark_runner/benchmark_builder/__init__.py b/Tools/Scripts/webkitpy/benchmark_runner/benchmark_builder/__init__.py
deleted file mode 100644 (file)
index a32f002..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-# Required for Python to search this directory for module files
-
-# Keep this file free of any code or import statements that could
-# cause either an error to occur or a log message to be logged.
-# This ensures that calling code can import initialization code from
-# webkitpy before any errors or log messages due to code in this file.
-# Initialization code can include things like version-checking code and
-# logging configuration code.
-#
-# We do not execute any version-checking code or logging configuration
-# code in this file so that callers can opt-in as they want.  This also
-# allows different callers to choose different initialization code,
-# as necessary.
-import os
-
-from webkitpy.benchmark_runner.utils import load_subclasses
-from benchmark_builder_factory import BenchmarkBuilderFactory
-
-
-def benchmark_builder_loader(benchmark_builder_class):
-    if benchmark_builder_class.builder_name:
-        BenchmarkBuilderFactory.add(benchmark_builder_class.builder_name, benchmark_builder_class)
-
-
-load_subclasses(
-    dirname=os.path.dirname(os.path.abspath(__file__)),
-    base_class_name='GenericBenchmarkBuilder',
-    loader=benchmark_builder_loader)
diff --git a/Tools/Scripts/webkitpy/benchmark_runner/benchmark_builder/benchmark_builder_factory.py b/Tools/Scripts/webkitpy/benchmark_runner/benchmark_builder/benchmark_builder_factory.py
deleted file mode 100644 (file)
index c6200b9..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-#!/usr/bin/env python
-
-import logging
-import json
-import os
-
-from webkitpy.benchmark_runner.generic_factory import GenericFactory
-
-
-class BenchmarkBuilderFactory(GenericFactory):
-
-    products = {}
index c1d2b66..5d82822 100644 (file)
@@ -12,7 +12,7 @@ import types
 import os
 import urlparse
 
-from benchmark_builder.benchmark_builder_factory import BenchmarkBuilderFactory
+from benchmark_builder import BenchmarkBuilder
 from benchmark_results import BenchmarkResults
 from browser_driver.browser_driver_factory import BrowserDriverFactory
 from http_server_driver.http_server_driver_factory import HTTPServerDriverFactory
@@ -24,7 +24,7 @@ _log = logging.getLogger(__name__)
 
 class BenchmarkRunner(object):
 
-    def __init__(self, plan_file, local_copy, count_override, build_dir, output_file, platform, browser, http_server_driver_override=None, device_id=None):
+    def __init__(self, plan_file, local_copy, count_override, build_dir, output_file, platform, browser, device_id=None):
         try:
             plan_file = self._find_plan_file(plan_file)
             with open(plan_file, 'r') as fp:
@@ -34,10 +34,8 @@ class BenchmarkRunner(object):
                     self._plan['local_copy'] = local_copy
                 if count_override:
                     self._plan['count'] = count_override
-                if http_server_driver_override:
-                    self._plan['http_server_driver'] = http_server_driver_override
                 self._browser_driver = BrowserDriverFactory.create(platform, browser)
-                self._http_server_driver = HTTPServerDriverFactory.create(self._plan['http_server_driver'])
+                self._http_server_driver = HTTPServerDriverFactory.create(platform)
                 self._http_server_driver.set_device_id(device_id)
                 self._build_dir = os.path.abspath(build_dir) if build_dir else None
                 self._output_file = output_file
@@ -64,7 +62,7 @@ class BenchmarkRunner(object):
         _log.info('Start to execute the plan')
         _log.info('Start a new benchmark')
         results = []
-        self._benchmark_builder = BenchmarkBuilderFactory.create(self._plan['benchmark_builder'])
+        self._benchmark_builder = BenchmarkBuilder()
 
         web_root = self._benchmark_builder.prepare(self._plan_name, self._plan)
         for x in xrange(int(self._plan['count'])):
index 3d0c9ad..9e8ff16 100644 (file)
@@ -1,8 +1,6 @@
 {
-    "http_server_driver": "SimpleHTTPServerDriver",
     "timeout": 1200,
     "count": 1,
-    "benchmark_builder": "GenericBenchmarkBuilder",
     "remote_archive": "https://github.com/jeresig/dromaeo/archive/ed7e6a8f25ea72f45c191f34a68722f80dc3c513.zip",
     "benchmark_patch": "data/patches/Dromaeo.patch",
     "create_script": ["make", "web"],
index 458b3ca..9f23e4d 100644 (file)
@@ -1,8 +1,6 @@
 {
-    "http_server_driver": "SimpleHTTPServerDriver",
     "timeout": 1200,
     "count": 1,
-    "benchmark_builder": "GenericBenchmarkBuilder",
     "remote_archive": "https://github.com/jeresig/dromaeo/archive/ed7e6a8f25ea72f45c191f34a68722f80dc3c513.zip",
     "benchmark_patch": "data/patches/Dromaeo.patch",
     "create_script": ["make", "web"],
index ee5b436..2b93060 100644 (file)
@@ -1,8 +1,6 @@
 {
-    "http_server_driver": "SimpleHTTPServerDriver",
     "timeout": 1200,
     "count": 1,
-    "benchmark_builder": "GenericBenchmarkBuilder",
     "remote_archive": "https://github.com/jeresig/dromaeo/archive/ed7e6a8f25ea72f45c191f34a68722f80dc3c513.zip",
     "benchmark_patch": "data/patches/Dromaeo.patch",
     "create_script": ["make", "web"],
index 941f755..72efefe 100644 (file)
@@ -1,8 +1,6 @@
 {
-    "http_server_driver": "SimpleHTTPServerDriver", 
     "timeout": 600,
     "count": 5,
-    "benchmark_builder": "GenericBenchmarkBuilder",
     "svn_source": "https://svn.webkit.org/repository/webkit/trunk/PerformanceTests/JetStream/@r183091",
     "benchmark_patch": "data/patches/JetStream.patch",
     "create_script": ["ruby", "create.rb"],
index 7749241..30bd209 100644 (file)
@@ -1,8 +1,6 @@
 {
-    "http_server_driver": "SimpleHTTPServerDriver", 
     "timeout": 600,
     "count": 1,
-    "benchmark_builder": "GenericBenchmarkBuilder",
     "remote_archive": "http://plg.uwaterloo.ca/~dynjs/jsbench/suite/jsbench-2013.1.tar.gz",
     "benchmark_patch": "data/patches/JSBench.patch",
     "entry_point": "index.html",
index fd9c9b8..d22bf02 100644 (file)
@@ -1,8 +1,6 @@
 {
-    "http_server_driver": "SimpleHTTPServerDriver",
     "timeout": 300,
     "count": 5,
-    "benchmark_builder": "GenericBenchmarkBuilder",
     "remote_archive": "http://hg.mozilla.org/projects/kraken/archive/tip.zip",
     "benchmark_patch": "data/patches/Kraken.patch",
     "create_script": ["python", "make-hosted.py"],
index 588871f..cac6df3 100644 (file)
@@ -1,8 +1,6 @@
 {
-    "http_server_driver": "SimpleHTTPServerDriver",
     "timeout": 300,
     "count": 5,
-    "benchmark_builder": "GenericBenchmarkBuilder",
     "remote_archive": "https://github.com/chromium/octane-benchmark/archive/fab09aef01c2a5560c22cdc1c1a2451c0d0f4cdc.zip",
     "benchmark_patch": "data/patches/Octane.patch",
     "entry_point": "index.html?auto=1",
index 9d840f5..2825274 100644 (file)
@@ -1,8 +1,6 @@
 {
-    "http_server_driver": "SimpleHTTPServerDriver",
     "timeout": 300,
     "count": 5,
-    "benchmark_builder": "GenericBenchmarkBuilder",
     "local_copy": "../../../../PerformanceTests/Speedometer",
     "benchmark_patch": "data/patches/Speedometer.patch",
     "entry_point": "Full.html",
index f089d9d..accc47f 100644 (file)
@@ -1,8 +1,6 @@
 {
-    "http_server_driver": "SimpleHTTPServerDriver",
     "timeout": 300,
     "count": 5,
-    "benchmark_builder": "GenericBenchmarkBuilder",
     "svn_source": "https://svn.webkit.org/repository/webkit/trunk/PerformanceTests/SunSpider/@r182170",
     "benchmark_patch": "data/patches/SunSpider.patch",
     "create_script": ["perl", "make-hosted"],
index 1a0d6bd..cb56a52 100644 (file)
@@ -19,8 +19,8 @@ from http_server_driver_factory import HTTPServerDriverFactory
 
 
 def http_server_driver_loader(http_server_driver_class):
-    if http_server_driver_class.name:
-        HTTPServerDriverFactory.add(http_server_driver_class.name, http_server_driver_class)
+    for platform in http_server_driver_class.platforms:
+        HTTPServerDriverFactory.add(platform, http_server_driver_class)
 
 
 load_subclasses(
index 754d23a..0f41c1b 100644 (file)
@@ -4,7 +4,8 @@ from abc import abstractmethod
 
 
 class HTTPServerDriver(object):
-    name = None
+    platforms = []
+
     @abstractmethod
     def serve(self, webRoot):
         pass
index 9e2a7e6..86621da 100644 (file)
@@ -18,7 +18,8 @@ class SimpleHTTPServerDriver(HTTPServerDriver):
 
     """This class depends on unix environment, need to be modified to achieve crossplatform compability
     """
-    name = 'SimpleHTTPServerDriver'
+
+    platforms = ['osx']
 
     def __init__(self):
         self._server_process = None
index 3ad7b16..0d5da5b 100755 (executable)
@@ -23,7 +23,6 @@ def parse_args():
     parser.add_argument('--debug', action='store_true')
     parser.add_argument('--local-copy', dest='localCopy', help='Path to a local copy of the benchmark. e.g. PerformanceTests/SunSpider/')
     parser.add_argument('--count', dest='countOverride', type=int, help='Number of times to run the benchmark. e.g. 5')
-    parser.add_argument('--http-server-driver', dest='httpServerDriverOverride', default=None, help='Specify which HTTP server you wants to use')
     parser.add_argument('--device-id', dest='device_id', default=None)
 
     args = parser.parse_args()
@@ -39,7 +38,7 @@ def parse_args():
 
 
 def start(args):
-    runner = BenchmarkRunner(args.plan, args.localCopy, args.countOverride, args.buildDir, args.output, args.platform, args.browser, args.httpServerDriverOverride, args.device_id)
+    runner = BenchmarkRunner(args.plan, args.localCopy, args.countOverride, args.buildDir, args.output, args.platform, args.browser, args.device_id)
     runner.execute()