REGRESSION(r219850): run-benchmark script broken on Linux
authorclopez@igalia.com <clopez@igalia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 4 Aug 2017 01:12:52 +0000 (01:12 +0000)
committerclopez@igalia.com <clopez@igalia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 4 Aug 2017 01:12:52 +0000 (01:12 +0000)
https://bugs.webkit.org/show_bug.cgi?id=175126

Reviewed by Stephanie Lewis.

The run-benchmark script dynamically generates the list of supported
browsers and platforms (currently Linux and OSX) by loading all
python files from Tools/Scripts/webkitpy/benchmark_runner/browser_driver
and getting the browser_name and platform variables from the
classes defined there.

This means that this classes should not raise an exception when
loaded on other platforms or otherwise they will broke the whole
script. Its fine if they raise an exception when executing any of
the methods they implement, but not when just loading/importing
the class.

Move the argument variable definitions that call on the platform
specific OSXBrowserDriver._screen_size() function from beeing
variables that are evaluated when loading the file, to be functions
that are only evaluated when the actual functionality needs to be
executed.

* Scripts/webkitpy/benchmark_runner/browser_driver/osx_chrome_driver.py:
(OSXChromeDriver.launch_url):
(OSXChromeCanaryDriver.launch_url):
(create_args):
(create_chrome_options):
(create_window_size_arg):
* Scripts/webkitpy/benchmark_runner/browser_driver/osx_firefox_driver.py:
(OSXFirefoxDriver.launch_url):
(OSXFirefoxNightlyDriver.launch_url):
(OSXFirefoxNightlyDriver.launch_driver):
(create_args):

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

Tools/ChangeLog
Tools/Scripts/webkitpy/benchmark_runner/browser_driver/osx_chrome_driver.py
Tools/Scripts/webkitpy/benchmark_runner/browser_driver/osx_firefox_driver.py

index 89349e94e0c55aa29cf09a8217243768e73aaad0..6c5504bed49c4a2037fec6a9b188207cde7b7765 100644 (file)
@@ -1,3 +1,40 @@
+2017-08-03  Carlos Alberto Lopez Perez  <clopez@igalia.com>
+
+        REGRESSION(r219850): run-benchmark script broken on Linux
+        https://bugs.webkit.org/show_bug.cgi?id=175126
+
+        Reviewed by Stephanie Lewis.
+
+        The run-benchmark script dynamically generates the list of supported
+        browsers and platforms (currently Linux and OSX) by loading all
+        python files from Tools/Scripts/webkitpy/benchmark_runner/browser_driver
+        and getting the browser_name and platform variables from the
+        classes defined there.
+
+        This means that this classes should not raise an exception when
+        loaded on other platforms or otherwise they will broke the whole
+        script. Its fine if they raise an exception when executing any of
+        the methods they implement, but not when just loading/importing
+        the class.
+
+        Move the argument variable definitions that call on the platform
+        specific OSXBrowserDriver._screen_size() function from beeing
+        variables that are evaluated when loading the file, to be functions
+        that are only evaluated when the actual functionality needs to be
+        executed.
+
+        * Scripts/webkitpy/benchmark_runner/browser_driver/osx_chrome_driver.py:
+        (OSXChromeDriver.launch_url):
+        (OSXChromeCanaryDriver.launch_url):
+        (create_args):
+        (create_chrome_options):
+        (create_window_size_arg):
+        * Scripts/webkitpy/benchmark_runner/browser_driver/osx_firefox_driver.py:
+        (OSXFirefoxDriver.launch_url):
+        (OSXFirefoxNightlyDriver.launch_url):
+        (OSXFirefoxNightlyDriver.launch_driver):
+        (create_args):
+
 2017-08-03  Yoshiaki Jitsukawa  <jitsu@rd.scei.sony.co.jp>
 
         [PAL] Move spi/cf directory into PAL
index c67066bbaffa1291e9ceb8724b18583a842be02e..9c385d787a296bd2e403ee50e56b2d47ed5d1918 100644 (file)
@@ -7,8 +7,6 @@ from osx_browser_driver import OSXBrowserDriver
 
 
 _log = logging.getLogger(__name__)
-window_size_arg = '--window-size={width},{height}'.format(width=int(OSXBrowserDriver._screen_size().width), height=int(OSXBrowserDriver._screen_size().height))
-args = ['--args', '--homepage', window_size_arg]
 
 class OSXChromeDriver(OSXBrowserDriver):
     process_name = 'Google Chrome'
@@ -16,7 +14,7 @@ class OSXChromeDriver(OSXBrowserDriver):
     app_name = 'Google Chrome.app'
 
     def launch_url(self, url, options, browser_build_path):
-        args_with_url = self._insert_url(args, 2, url)
+        args_with_url = self._insert_url(create_args(), 2, url)
         self._launch_process(build_dir=browser_build_path, app_name=self.app_name, url=url, args=args_with_url)
 
     def launch_driver(self, url, options, browser_build_path):
@@ -38,7 +36,7 @@ class OSXChromeCanaryDriver(OSXBrowserDriver):
     app_name = 'Google Chrome Canary.app'
 
     def launch_url(self, url, options, browser_build_path):
-        args_with_url = self._insert_url(args, 2, url)
+        args_with_url = self._insert_url(create_args(), 2, url)
         self._launch_process(build_dir=browser_build_path, app_name=self.app_name, url=url, args=args_with_url)
 
     def launch_driver(self, url, options, browser_build_path):
@@ -55,11 +53,20 @@ class OSXChromeCanaryDriver(OSXBrowserDriver):
         return driver
 
 
+def create_args():
+    args = ['--args', '--homepage', create_window_size_arg()]
+    return args
+
 def create_chrome_options():
     from webkitpy.thirdparty.autoinstalled.selenium.webdriver.chrome.options import Options
     chrome_options = Options()
     chrome_options.add_argument("--disable-web-security")
     chrome_options.add_argument("--user-data-dir")
     chrome_options.add_argument("--disable-extensions")
-    chrome_options.add_argument(window_size_arg)
+    chrome_options.add_argument(create_window_size_arg())
     return chrome_options
+
+
+def create_window_size_arg():
+    window_size_arg = '--window-size={width},{height}'.format(width=int(OSXBrowserDriver._screen_size().width), height=int(OSXBrowserDriver._screen_size().height))
+    return window_size_arg
index 54a056b0fe62303310ea1a0060fe12106b1731bd..ddf46a948276d1c1d470e884bcc84380eef2a3b3 100644 (file)
@@ -8,8 +8,6 @@ from osx_browser_driver import OSXBrowserDriver
 
 _log = logging.getLogger(__name__)
 
-args = ['--args', '-width', str(int(OSXBrowserDriver._screen_size().width)), '-height', str(int(OSXBrowserDriver._screen_size().height))]
-
 
 class OSXFirefoxDriver(OSXBrowserDriver):
     process_name = 'firefox'
@@ -17,7 +15,7 @@ class OSXFirefoxDriver(OSXBrowserDriver):
     app_name = 'Firefox.app'
 
     def launch_url(self, url, options, browser_build_path):
-        args_with_url = self._insert_url(args, 0, url)
+        args_with_url = self._insert_url(create_args(), 0, url)
         self._launch_process(build_dir=browser_build_path, app_name=self.app_name, url=url, args=args_with_url)
 
     def launch_driver(self, url, options, browser_build_path):
@@ -40,7 +38,7 @@ class OSXFirefoxNightlyDriver(OSXBrowserDriver):
     app_name = 'FirefoxNightly.app'
 
     def launch_url(self, url, options, browser_build_path):
-        args_with_url = self._insert_url(args, 0, url)
+        args_with_url = self._insert_url(create_args(), 0, url)
         self._launch_process(build_dir=browser_build_path, app_name=self.app_name, url=url, args=args_with_url)
 
     def launch_driver(self, url, options, browser_build_path):
@@ -56,3 +54,8 @@ class OSXFirefoxNightlyDriver(OSXBrowserDriver):
         driver = webdriver.Firefox(firefox_options=firefox_options, executable_path=driver_executable)
         self._launch_webdriver(url=url, driver=driver)
         return driver
+
+
+def create_args():
+    args = ['--args', '-width', str(int(OSXBrowserDriver._screen_size().width)), '-height', str(int(OSXBrowserDriver._screen_size().height))]
+    return args