Make run-benchmark script supports 'config' key in test plan.
authordewei_zhu@apple.com <dewei_zhu@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 2 Feb 2017 03:10:58 +0000 (03:10 +0000)
committerdewei_zhu@apple.com <dewei_zhu@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 2 Feb 2017 03:10:58 +0000 (03:10 +0000)
https://bugs.webkit.org/show_bug.cgi?id=167715

Reviewed by Ryosuke Niwa.

Add support for 'config' key in test paln.
'config' key is a dictionary that specifies environment configurations while test is running.
Specifies orientation to be portrait in MotionMark benchmark.

* Scripts/webkitpy/benchmark_runner/README.md:
* Scripts/webkitpy/benchmark_runner/benchmark_runner.py:
(BenchmarkRunner.__init__):
(BenchmarkRunner._run_benchmark):
* Scripts/webkitpy/benchmark_runner/browser_driver/browser_driver.py:
(BrowserDriver.prepare_env):
* Scripts/webkitpy/benchmark_runner/browser_driver/linux_browser_driver.py:
(LinuxBrowserDriver.prepare_env):
* Scripts/webkitpy/benchmark_runner/browser_driver/osx_browser_driver.py:
(OSXBrowserDriver.prepare_env):
* Scripts/webkitpy/benchmark_runner/browser_driver/osx_safari_driver.py:
(OSXSafariDriver.prepare_env):
* Scripts/webkitpy/benchmark_runner/data/plans/motionmark.plan:

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

Tools/ChangeLog
Tools/Scripts/webkitpy/benchmark_runner/README.md
Tools/Scripts/webkitpy/benchmark_runner/benchmark_runner.py
Tools/Scripts/webkitpy/benchmark_runner/browser_driver/browser_driver.py
Tools/Scripts/webkitpy/benchmark_runner/browser_driver/linux_browser_driver.py
Tools/Scripts/webkitpy/benchmark_runner/browser_driver/osx_browser_driver.py
Tools/Scripts/webkitpy/benchmark_runner/browser_driver/osx_safari_driver.py
Tools/Scripts/webkitpy/benchmark_runner/data/plans/motionmark.plan

index eaf1e1a..8f61791 100644 (file)
@@ -1,3 +1,28 @@
+2017-02-01  Dewei Zhu  <dewei_zhu@apple.com>
+
+        Make run-benchmark script supports 'config' key in test plan.
+        https://bugs.webkit.org/show_bug.cgi?id=167715
+
+        Reviewed by Ryosuke Niwa.
+
+        Add support for 'config' key in test paln.
+        'config' key is a dictionary that specifies environment configurations while test is running.
+        Specifies orientation to be portrait in MotionMark benchmark.
+
+        * Scripts/webkitpy/benchmark_runner/README.md:
+        * Scripts/webkitpy/benchmark_runner/benchmark_runner.py:
+        (BenchmarkRunner.__init__):
+        (BenchmarkRunner._run_benchmark):
+        * Scripts/webkitpy/benchmark_runner/browser_driver/browser_driver.py:
+        (BrowserDriver.prepare_env):
+        * Scripts/webkitpy/benchmark_runner/browser_driver/linux_browser_driver.py:
+        (LinuxBrowserDriver.prepare_env):
+        * Scripts/webkitpy/benchmark_runner/browser_driver/osx_browser_driver.py:
+        (OSXBrowserDriver.prepare_env):
+        * Scripts/webkitpy/benchmark_runner/browser_driver/osx_safari_driver.py:
+        (OSXSafariDriver.prepare_env):
+        * Scripts/webkitpy/benchmark_runner/data/plans/motionmark.plan:
+
 2017-02-01  Daniel Bates  <dabates@apple.com>
 
         REGRESSION (r210820): svn-create-patch does not emit property change only diff
index 61d6253..7810c98 100644 (file)
@@ -69,6 +69,9 @@ To create a plan, you may refer to Plans/jetstream.plan.
     "local_copy": "../../../../PerformanceTests/JetStream",
     "benchmark_patch": "data/patches/JetStream.patch",
     "entry_point": "JetStream/JetStream-1.0.1/index.html",
+    "config": {
+        "orientation": "portrait"
+    },
     "output_file": "jetstream.result"
 }
 ```
@@ -79,6 +82,7 @@ Plan is a json-formatted dictionary which contains following keys
 * **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)
+* **config**: a dictionary that specifies the environment configurations for the test (e.g. orientation while the test is running)
 * **output_file**: specify the output file, this can be overwritten by specifying '--output-file' while invoking run-benchmark script
 
 ### How to import a benchmark
index 237389c..7ad2fbb 100644 (file)
@@ -42,7 +42,9 @@ class BenchmarkRunner(object):
                 self._build_dir = os.path.abspath(build_dir) if build_dir else None
                 self._output_file = output_file
                 self._scale_unit = scale_unit
-                self._device_id = device_id
+                self._config = self._plan.get('config', {})
+                if device_id:
+                    self._config['device_id'] = device_id
         except IOError as error:
             _log.error('Can not open plan file: {plan_file} - Error {error}'.format(plan_file=plan_file, error=error))
             raise error
@@ -86,7 +88,7 @@ class BenchmarkRunner(object):
         for iteration in xrange(1, count + 1):
             _log.info('Start the iteration {current_iteration} of {iterations} for current benchmark'.format(current_iteration=iteration, iterations=count))
             try:
-                self._browser_driver.prepare_env(self._device_id)
+                self._browser_driver.prepare_env(self._config)
 
                 if 'entry_point' in self._plan:
                     result = self._run_one_test(web_root, self._plan['entry_point'])
index a1cbe2d..75e8a46 100644 (file)
@@ -10,7 +10,7 @@ class BrowserDriver(object):
     ___metaclass___ = ABCMeta
 
     @abstractmethod
-    def prepare_env(self, device_id):
+    def prepare_env(self, config):
         pass
 
     @abstractmethod
index 384e5a6..4c3e3be 100644 (file)
@@ -51,7 +51,7 @@ class LinuxBrowserDriver(BrowserDriver):
             raise ValueError('Cant find executable for browser {browser_name}. Searched list: {browser_process_list}'.format(
                               browser_name=self.browser_name, browser_process_list=self.process_search_list))
 
-    def prepare_env(self, device_id):
+    def prepare_env(self, config):
         self._browser_process = None
         self._browser_arguments = None
         self._temp_profiledir = tempfile.mkdtemp()
index f1b3518..5d03c0c 100644 (file)
@@ -14,7 +14,7 @@ class OSXBrowserDriver(BrowserDriver):
     process_name = None
     platform = 'osx'
 
-    def prepare_env(self, device_id):
+    def prepare_env(self, config):
         self.close_browsers()
         from Quartz import CGWarpMouseCursorPosition
         CGWarpMouseCursorPosition((10, 0))
index d466b96..8308c98 100644 (file)
@@ -17,9 +17,9 @@ class OSXSafariDriver(OSXBrowserDriver):
     process_name = 'Safari'
     browser_name = 'safari'
 
-    def prepare_env(self, device_id):
+    def prepare_env(self, config):
         self._safari_process = None
-        super(OSXSafariDriver, self).prepare_env(device_id)
+        super(OSXSafariDriver, self).prepare_env(config)
         force_remove(os.path.join(os.path.expanduser('~'), 'Library/Saved Application State/com.apple.Safari.savedState'))
         force_remove(os.path.join(os.path.expanduser('~'), 'Library/Safari/LastSession.plist'))
         self._maximize_window()
index 0830440..06188ae 100644 (file)
@@ -4,5 +4,8 @@
     "svn_source": "https://svn.webkit.org/repository/webkit/trunk/PerformanceTests/MotionMark/@r210459",
     "benchmark_patch": "data/patches/MotionMark.patch",
     "entry_point": "index.html",
+    "config": {
+        "orientation": "landscape"
+    },
     "output_file": "motionmark.result"
 }