Update ReadMe and correct the way to use abstract abstract class.
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 11 Aug 2015 03:15:00 +0000 (03:15 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 11 Aug 2015 03:15:00 +0000 (03:15 +0000)
https://bugs.webkit.org/show_bug.cgi?id=147860

Patch by Dewei Zhu <dewei_zhu@apple.com> on 2015-08-10
Reviewed by Ryosuke Niwa.

Update ReadMe according to recent changes. And set ABCMeta to be the __metaclass__ of BrowserDriver and HTTPServerDriver,
so that all methods annotated by 'abstractmethod' will check whether they are implememnt by subclasses.

* Scripts/webkitpy/benchmark_runner/README.md:
* Scripts/webkitpy/benchmark_runner/browser_driver/browser_driver.py:
(BrowserDriver):
* Scripts/webkitpy/benchmark_runner/browser_driver/osx_browser_driver.py:
(OSXBrowserDriver.restore_env):
* Scripts/webkitpy/benchmark_runner/http_server_driver/http_server_driver.py:
(HTTPServerDriver):
(HTTPServerDriver.set_device_id):
* Scripts/webkitpy/benchmark_runner/http_server_driver/simple_http_server_driver.py:
(SimpleHTTPServerDriver.get_return_code):
(SimpleHTTPServerDriver):
(SimpleHTTPServerDriver.set_device_id):

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

Tools/ChangeLog
Tools/Scripts/webkitpy/benchmark_runner/README.md
Tools/Scripts/webkitpy/benchmark_runner/browser_driver/browser_driver.py
Tools/Scripts/webkitpy/benchmark_runner/browser_driver/osx_browser_driver.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

index 765b0a2b9ec9fc1d998130235486daeef6c331de..9ad95d89770450d3030d51ab15af2f08ed4fcd7c 100644 (file)
@@ -1,3 +1,26 @@
+2015-08-10  Dewei Zhu  <dewei_zhu@apple.com>
+
+        Update ReadMe and correct the way to use abstract abstract class.
+        https://bugs.webkit.org/show_bug.cgi?id=147860
+
+        Reviewed by Ryosuke Niwa.
+
+        Update ReadMe according to recent changes. And set ABCMeta to be the __metaclass__ of BrowserDriver and HTTPServerDriver,
+        so that all methods annotated by 'abstractmethod' will check whether they are implememnt by subclasses.
+
+        * Scripts/webkitpy/benchmark_runner/README.md:
+        * Scripts/webkitpy/benchmark_runner/browser_driver/browser_driver.py:
+        (BrowserDriver):
+        * Scripts/webkitpy/benchmark_runner/browser_driver/osx_browser_driver.py:
+        (OSXBrowserDriver.restore_env):
+        * Scripts/webkitpy/benchmark_runner/http_server_driver/http_server_driver.py:
+        (HTTPServerDriver):
+        (HTTPServerDriver.set_device_id):
+        * Scripts/webkitpy/benchmark_runner/http_server_driver/simple_http_server_driver.py:
+        (SimpleHTTPServerDriver.get_return_code):
+        (SimpleHTTPServerDriver):
+        (SimpleHTTPServerDriver.set_device_id):
+
 2015-08-10  Alex Christensen  <achristensen@webkit.org>
 
         Build TestWebKitAPI with CMake on Windows
index 6b952c85ff4d07cb92c6d59d1addf90dc4ad3871..61d6253f267107bd15f7fb4aec479a427759b317 100644 (file)
@@ -5,27 +5,37 @@ This is a script for automating the browser based benchmarks(e.g. Speedometer, J
 benchmark_runner
 ├── README.md
 ├── __init__.py
-├── benchmark_builder
-│   ├── __init__.py
-│   ├── benchmark_builder_factory.py
-│   ├── benchmark_builders.json
-│   ├── generic_benchmark_builder.py
-│   └── jetstream_benchmark_builder.py
+├── benchmark_builder.py
+├── benchmark_results.py
+├── benchmark_results_unittest.py
 ├── benchmark_runner.py
 ├── browser_driver
 │   ├── __init__.py
 │   ├── browser_driver.py
 │   ├── browser_driver_factory.py
-│   ├── browser_drivers.json
+│   ├── osx_browser_driver.py
 │   ├── osx_chrome_driver.py
+│   ├── osx_firefox_driver.py
 │   └── osx_safari_driver.py
 ├── data
 │   ├── patches
+│   │   ├── Dromaeo.patch
+│   │   ├── JSBench.patch
 │   │   ├── JetStream.patch
-│   │   └── Speedometer.patch
+│   │   ├── Kraken.patch
+│   │   ├── Octane.patch
+│   │   ├── Speedometer.patch
+│   │   └── SunSpider.patch
 │   └── plans
+│       ├── dromaeo-cssquery.plan
+│       ├── dromaeo-dom.plan
+│       ├── dromaeo-jslib.plan
 │       ├── jetstream.plan
-│       └── speedometer.plan
+│       ├── jsbench.plan
+│       ├── kraken.plan
+│       ├── octane.plan
+│       ├── speedometer.plan
+│       └── sunspider.plan
 ├── generic_factory.py
 ├── http_server_driver
 │   ├── __init__.py
@@ -33,8 +43,8 @@ benchmark_runner
 │   │   └── twisted_http_server.py
 │   ├── http_server_driver.py
 │   ├── http_server_driver_factory.py
-│   ├── http_server_drivers.json
 │   └── simple_http_server_driver.py
+├── run_benchmark.py
 └── utils.py
 ```
 ## Requirements
@@ -54,10 +64,8 @@ benchmark_runner
 To create a plan, you may refer to Plans/jetstream.plan.
 ```json 
 {
-    "http_server_driver": "SimpleHTTPServerDriver", 
     "timeout" : 600,
     "count": 5,
-    "benchmark_builder": "JetStreamBenchmarkBuilder",
     "local_copy": "../../../../PerformanceTests/JetStream",
     "benchmark_patch": "data/patches/JetStream.patch",
     "entry_point": "JetStream/JetStream-1.0.1/index.html",
@@ -65,11 +73,9 @@ To create a plan, you may refer to Plans/jetstream.plan.
 }
 ```
 Plan is a json-formatted dictionary which contains following keys 
-* **http_server_driver**: (**case-sensitive**) the http server module you want to host the resources. Current available option is "SimpleHTTPServerHandle" which is based on python twisted framework.
 * **timeout**: time limit for **EACH RUN** of the benchmark. This can avoid program getting stuck in the extreme circumstances. The time limit is suggested to be 1.5-2x the time spent in a normal run.
 * **count**: the number of times you want to run benchmark
-* **benchmark_builder**:  builder of the benchmark which is responsible for arranging benchmark before the web server serving the directory. In most case, 'GenericBenchmarkHandler' is sufficient. It copies the benchmark to a temporary directory and applies patch to benchmark. If you have special requirement, you could design your own benchmark handle, just like the 'JetStreamBenchmarkHandle' in this example.
-* **local_copy**: path of benchmark, a relative path to the root of this project ('benchmark_runner' directory)
+* **local_copy**: (**OPTIONAL**) Path of benchmark, a relative path to the root of this project ('benchmark_runner' directory)
 * **remote_archive**: (**OPTIONAL**) URL of the remote (http/https) ZIP file that contains the benchmark.
 * **benchmark_path**: (**OPTIONAL**) path of patch, a relative path to the root of this project ('benchmark_runner' directory)
 * **entry_point**: the relative url you want browser to launch (a relative path to the benchmark directory)
@@ -103,4 +109,3 @@ Plan is a json-formatted dictionary which contains following keys
 * Do following instruction **ONLY IF NEEDED**. In most case, you do not have to.
     * If you want to customize BrowserDriver for specific browser/platform, you need to extend browser_driver/browser_driver.py and register your module in browser_driver/browser_driversjson.
     * If you want to customize HTTPServerDriver, you need to extend http_server_drirver/http_server_driver and register your module in http_server_driver/http_server_drivers.json.
-    * If you want to customize BenchmarkBuilder, you need to extend benchmark_builder/generic_benchmark_builder register you module in benchmark_builder/benchmark_builders.json
index ab1c5539e00a0a1e4e44f3b5bb31774e66e5318c..85580195ecf032ef9f7e91cac0c96b6925db3c3c 100644 (file)
@@ -1,24 +1,25 @@
 #!/usr/bin/env python
 
-import abc
-
+from abc import ABCMeta, abstractmethod
 
 class BrowserDriver(object):
     platform = None
     browser_name = None
 
-    @abc.abstractmethod
+    ___metaclass___ = ABCMeta
+
+    @abstractmethod
     def prepare_env(self, device_id):
         pass
 
-    @abc.abstractmethod
+    @abstractmethod
     def launch_url(self, url, browser_build_path=None):
         pass
 
-    @abc.abstractmethod
+    @abstractmethod
     def close_browsers(self):
         pass
 
-    @abc.abstractmethod
+    @abstractmethod
     def restore_env(self):
         pass
index 6a0e820b7d58673134eb195b4247bccebbd9c751..5b74ccb4e0e0995fa2ca502705b58d038314bbf3 100644 (file)
@@ -18,6 +18,9 @@ class OSXBrowserDriver(BrowserDriver):
         from Quartz import CGWarpMouseCursorPosition
         CGWarpMouseCursorPosition((10, 0))
 
+    def restore_env(self):
+        pass
+
     def close_browsers(self):
         self._terminiate_processes(self.process_name)
 
index 0f41c1ba03d3cfc90aae8b1f74cda72fceeaa810..5991e3b3938d5318c84b68c08654057ac6136671 100644 (file)
@@ -1,11 +1,13 @@
 #!/usr/bin/env python
 
-from abc import abstractmethod
+from abc import abstractmethod, ABCMeta
 
 
 class HTTPServerDriver(object):
     platforms = []
 
+    __metaclass__ = ABCMeta
+
     @abstractmethod
     def serve(self, webRoot):
         pass
@@ -23,5 +25,5 @@ class HTTPServerDriver(object):
         pass
 
     @abstractmethod
-    def set_device_id(self, deviceID):
+    def set_device_id(self, device_id):
         pass
index 135990dcf1a18a68969a24aa3df58b6167d854fd..3ead05ea6775503eb0ab5441e6452639a5cb550b 100644 (file)
@@ -91,3 +91,6 @@ class SimpleHTTPServerDriver(HTTPServerDriver):
 
     def get_return_code(self):
         return self._server_process.returncode
+
+    def set_device_id(self, device_id):
+        pass