Title: [220246] trunk/Tools
Revision
220246
Author
clo...@igalia.com
Date
2017-08-03 18:12:52 -0700 (Thu, 03 Aug 2017)

Log Message

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):

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (220245 => 220246)


--- trunk/Tools/ChangeLog	2017-08-04 01:07:24 UTC (rev 220245)
+++ trunk/Tools/ChangeLog	2017-08-04 01:12:52 UTC (rev 220246)
@@ -1,3 +1,40 @@
+2017-08-03  Carlos Alberto Lopez Perez  <clo...@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  <ji...@rd.scei.sony.co.jp>
 
         [PAL] Move spi/cf directory into PAL

Modified: trunk/Tools/Scripts/webkitpy/benchmark_runner/browser_driver/osx_chrome_driver.py (220245 => 220246)


--- trunk/Tools/Scripts/webkitpy/benchmark_runner/browser_driver/osx_chrome_driver.py	2017-08-04 01:07:24 UTC (rev 220245)
+++ trunk/Tools/Scripts/webkitpy/benchmark_runner/browser_driver/osx_chrome_driver.py	2017-08-04 01:12:52 UTC (rev 220246)
@@ -7,8 +7,6 @@
 
 
 _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 @@
     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="" args=args_with_url)
 
     def launch_driver(self, url, options, browser_build_path):
@@ -38,7 +36,7 @@
     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="" args=args_with_url)
 
     def launch_driver(self, url, options, browser_build_path):
@@ -55,6 +53,10 @@
         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()
@@ -61,5 +63,10 @@
     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

Modified: trunk/Tools/Scripts/webkitpy/benchmark_runner/browser_driver/osx_firefox_driver.py (220245 => 220246)


--- trunk/Tools/Scripts/webkitpy/benchmark_runner/browser_driver/osx_firefox_driver.py	2017-08-04 01:07:24 UTC (rev 220245)
+++ trunk/Tools/Scripts/webkitpy/benchmark_runner/browser_driver/osx_firefox_driver.py	2017-08-04 01:12:52 UTC (rev 220246)
@@ -8,9 +8,7 @@
 
 _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'
     browser_name = 'firefox'
@@ -17,7 +15,7 @@
     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="" args=args_with_url)
 
     def launch_driver(self, url, options, browser_build_path):
@@ -40,7 +38,7 @@
     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="" args=args_with_url)
 
     def launch_driver(self, url, options, browser_build_path):
@@ -56,3 +54,8 @@
         driver = webdriver.Firefox(firefox_options=firefox_options, executable_path=driver_executable)
         self._launch_webdriver(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
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to