Changeset 220246 in webkit


Ignore:
Timestamp:
Aug 3, 2017 6:12:52 PM (7 years ago)
Author:
clopez@igalia.com
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):

Location:
trunk/Tools
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Tools/ChangeLog

    r220243 r220246  
     12017-08-03  Carlos Alberto Lopez Perez  <clopez@igalia.com>
     2
     3        REGRESSION(r219850): run-benchmark script broken on Linux
     4        https://bugs.webkit.org/show_bug.cgi?id=175126
     5
     6        Reviewed by Stephanie Lewis.
     7
     8        The run-benchmark script dynamically generates the list of supported
     9        browsers and platforms (currently Linux and OSX) by loading all
     10        python files from Tools/Scripts/webkitpy/benchmark_runner/browser_driver
     11        and getting the browser_name and platform variables from the
     12        classes defined there.
     13
     14        This means that this classes should not raise an exception when
     15        loaded on other platforms or otherwise they will broke the whole
     16        script. Its fine if they raise an exception when executing any of
     17        the methods they implement, but not when just loading/importing
     18        the class.
     19
     20        Move the argument variable definitions that call on the platform
     21        specific OSXBrowserDriver._screen_size() function from beeing
     22        variables that are evaluated when loading the file, to be functions
     23        that are only evaluated when the actual functionality needs to be
     24        executed.
     25
     26        * Scripts/webkitpy/benchmark_runner/browser_driver/osx_chrome_driver.py:
     27        (OSXChromeDriver.launch_url):
     28        (OSXChromeCanaryDriver.launch_url):
     29        (create_args):
     30        (create_chrome_options):
     31        (create_window_size_arg):
     32        * Scripts/webkitpy/benchmark_runner/browser_driver/osx_firefox_driver.py:
     33        (OSXFirefoxDriver.launch_url):
     34        (OSXFirefoxNightlyDriver.launch_url):
     35        (OSXFirefoxNightlyDriver.launch_driver):
     36        (create_args):
     37
    1382017-08-03  Yoshiaki Jitsukawa  <jitsu@rd.scei.sony.co.jp>
    239
  • trunk/Tools/Scripts/webkitpy/benchmark_runner/browser_driver/osx_chrome_driver.py

    r219860 r220246  
    88
    99_log = logging.getLogger(__name__)
    10 window_size_arg = '--window-size={width},{height}'.format(width=int(OSXBrowserDriver._screen_size().width), height=int(OSXBrowserDriver._screen_size().height))
    11 args = ['--args', '--homepage', window_size_arg]
    1210
    1311class OSXChromeDriver(OSXBrowserDriver):
     
    1715
    1816    def launch_url(self, url, options, browser_build_path):
    19         args_with_url = self._insert_url(args, 2, url)
     17        args_with_url = self._insert_url(create_args(), 2, url)
    2018        self._launch_process(build_dir=browser_build_path, app_name=self.app_name, url=url, args=args_with_url)
    2119
     
    3937
    4038    def launch_url(self, url, options, browser_build_path):
    41         args_with_url = self._insert_url(args, 2, url)
     39        args_with_url = self._insert_url(create_args(), 2, url)
    4240        self._launch_process(build_dir=browser_build_path, app_name=self.app_name, url=url, args=args_with_url)
    4341
     
    5654
    5755
     56def create_args():
     57    args = ['--args', '--homepage', create_window_size_arg()]
     58    return args
     59
    5860def create_chrome_options():
    5961    from webkitpy.thirdparty.autoinstalled.selenium.webdriver.chrome.options import Options
     
    6264    chrome_options.add_argument("--user-data-dir")
    6365    chrome_options.add_argument("--disable-extensions")
    64     chrome_options.add_argument(window_size_arg)
     66    chrome_options.add_argument(create_window_size_arg())
    6567    return chrome_options
     68
     69
     70def create_window_size_arg():
     71    window_size_arg = '--window-size={width},{height}'.format(width=int(OSXBrowserDriver._screen_size().width), height=int(OSXBrowserDriver._screen_size().height))
     72    return window_size_arg
  • trunk/Tools/Scripts/webkitpy/benchmark_runner/browser_driver/osx_firefox_driver.py

    r219860 r220246  
    99_log = logging.getLogger(__name__)
    1010
    11 args = ['--args', '-width', str(int(OSXBrowserDriver._screen_size().width)), '-height', str(int(OSXBrowserDriver._screen_size().height))]
    12 
    1311
    1412class OSXFirefoxDriver(OSXBrowserDriver):
     
    1816
    1917    def launch_url(self, url, options, browser_build_path):
    20         args_with_url = self._insert_url(args, 0, url)
     18        args_with_url = self._insert_url(create_args(), 0, url)
    2119        self._launch_process(build_dir=browser_build_path, app_name=self.app_name, url=url, args=args_with_url)
    2220
     
    4139
    4240    def launch_url(self, url, options, browser_build_path):
    43         args_with_url = self._insert_url(args, 0, url)
     41        args_with_url = self._insert_url(create_args(), 0, url)
    4442        self._launch_process(build_dir=browser_build_path, app_name=self.app_name, url=url, args=args_with_url)
    4543
     
    5755        self._launch_webdriver(url=url, driver=driver)
    5856        return driver
     57
     58
     59def create_args():
     60    args = ['--args', '-width', str(int(OSXBrowserDriver._screen_size().width)), '-height', str(int(OSXBrowserDriver._screen_size().height))]
     61    return args
Note: See TracChangeset for help on using the changeset viewer.