⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 184044 in webkit


Ignore:
Timestamp:
May 9, 2015, 11:46:33 PM (11 years ago)
Author:
rniwa@webkit.org
Message:

Make arguments of run-benchmark more user friendly
https://bugs.webkit.org/show_bug.cgi?id=144835

Reviewed by Darin Adler.

Made --build-directory optional since I don't expect a typical WebKit developer to have a local build
of Chrome and Firefox. Also made --plan accept just a filename so that we can just say "speedometer"
instead of "Tools/Scripts/webkitpy/benchmark_runner/data/plans/speedometer.plan". Finally, removed
default values from --platform and --browser as they are required arguments.

  • Scripts/run-benchmark:

(main): Made --build-directory optional, and removed default values from --platform and --browser.
Also added help text for --build-directory and --plan. In addition, the list of platforms and browsers
are not dynamically obtained via BrowserDriverFactory.

  • Scripts/webkitpy/benchmark_runner/benchmark_runner.py:

(BenchmarkRunner.init): Raise when we can't find the plan file or the plan file is not a valid JSON
file instead of suppressing the error here and blowing up later mysteriously since we won't be able to
run any benchmark in that case.
(BenchmarkRunner._findPlanFile): Added. Look for the plan in webkitpy/benchmark_runner/data/plans if
the specified file isn't a valid relative or an absolute path.

  • Scripts/webkitpy/benchmark_runner/browser_driver/browser_driver_factory.py:

(BrowserDriverFactory.available_platforms): Added. Used in main to provide the list of valid platforms
and browsers.
(BrowserDriverFactory.available_browsers): Ditto.

  • Scripts/webkitpy/benchmark_runner/browser_driver/osx_chrome_driver.py:

(OSXChromeDriver.launchUrl): browserBuildPath is never optional since BenchmarkRunner.execute always
calls launchUrl with this argument so removed the default value. Also added a fallback path for when
browserBuildPath was None.

  • Scripts/webkitpy/benchmark_runner/browser_driver/osx_safari_driver.py:

(OSXSafariDriver.launchUrl): Ditto. We also fallback when the build directory doesn't contain Safari
so that we can use locally built WebKit to launch Safari.

Location:
trunk/Tools
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Tools/ChangeLog

    r184040 r184044  
     12015-05-09  Ryosuke Niwa  <rniwa@webkit.org>
     2
     3        Make arguments of run-benchmark more user friendly
     4        https://bugs.webkit.org/show_bug.cgi?id=144835
     5
     6        Reviewed by Darin Adler.
     7
     8        Made --build-directory optional since I don't expect a typical WebKit developer to have a local build
     9        of Chrome and Firefox. Also made --plan accept just a filename so that we can just say "speedometer"
     10        instead of "Tools/Scripts/webkitpy/benchmark_runner/data/plans/speedometer.plan". Finally, removed
     11        default values from --platform and --browser as they are required arguments.
     12
     13        * Scripts/run-benchmark:
     14        (main): Made --build-directory optional, and removed default values from --platform and --browser.
     15        Also added help text for --build-directory and --plan. In addition, the list of platforms and browsers
     16        are not dynamically obtained via BrowserDriverFactory.
     17        * Scripts/webkitpy/benchmark_runner/benchmark_runner.py:
     18        (BenchmarkRunner.__init__): Raise when we can't find the plan file or the plan file is not a valid JSON
     19        file instead of suppressing the error here and blowing up later mysteriously since we won't be able to
     20        run any benchmark in that case.
     21        (BenchmarkRunner._findPlanFile): Added. Look for the plan in webkitpy/benchmark_runner/data/plans if
     22        the specified file isn't a valid relative or an absolute path.
     23        * Scripts/webkitpy/benchmark_runner/browser_driver/browser_driver_factory.py:
     24        (BrowserDriverFactory.available_platforms): Added. Used in main to provide the list of valid platforms
     25        and browsers.
     26        (BrowserDriverFactory.available_browsers): Ditto.
     27        * Scripts/webkitpy/benchmark_runner/browser_driver/osx_chrome_driver.py:
     28        (OSXChromeDriver.launchUrl): browserBuildPath is never optional since BenchmarkRunner.execute always
     29        calls launchUrl with this argument so removed the default value. Also added a fallback path for when
     30        browserBuildPath was None.
     31        * Scripts/webkitpy/benchmark_runner/browser_driver/osx_safari_driver.py:
     32        (OSXSafariDriver.launchUrl): Ditto. We also fallback when the build directory doesn't contain Safari
     33        so that we can use locally built WebKit to launch Safari.
     34
    1352015-05-09  Yoav Weiss  <yoav@yoav.ws>
    236
  • trunk/Tools/Scripts/run-benchmark

    r183621 r184044  
    33import argparse
    44import logging
     5import platform
    56import sys
    67
    78from webkitpy.benchmark_runner.benchmark_runner import BenchmarkRunner
     9from webkitpy.benchmark_runner.browser_driver.browser_driver_factory import BrowserDriverFactory
    810
    911
     
    1921    parser = argparse.ArgumentParser(description='Automate the browser based performance benchmarks')
    2022    parser.add_argument('--output-file', dest='output', default=None)
    21     parser.add_argument('--build-directory', dest='buildDir', required=True)
    22     parser.add_argument('--plan', dest='plan', required=True)
    23     parser.add_argument('--platform', dest='platform', default='osx', choices=['osx', 'ios', 'windows'], required=True)
     23    parser.add_argument('--build-directory', dest='buildDir', help='Path to the browser executable. e.g. WebKitBuild/Release/')
     24    parser.add_argument('--plan', dest='plan', required=True, help='Benchmark plan to run. e.g. speedometer, jetstream')
     25    parser.add_argument('--platform', dest='platform', required=True, choices=BrowserDriverFactory.available_platforms())
    2426    # FIXME: Should we add chrome as an option? Well, chrome uses webkit in iOS.
    25     parser.add_argument('--browser', dest='browser', default='safari', choices=['safari', 'chrome'], required=True)
     27    parser.add_argument('--browser', dest='browser', required=True, choices=BrowserDriverFactory.available_browsers())
    2628    parser.add_argument('--debug', action='store_true')
    2729    args = parser.parse_args()
    28    
     30
    2931    if args.debug:
    3032        _log.setLevel(logging.DEBUG)
     
    3638    return runner.execute()
    3739
     40
    3841if __name__ == '__main__':
    3942    sys.exit(main())
  • trunk/Tools/Scripts/webkitpy/benchmark_runner/benchmark_runner.py

    r183685 r184044  
    2727        _log.info('Initializing benchmark running')
    2828        try:
     29            planFile = self._findPlanFile(planFile)
    2930            with open(planFile, 'r') as fp:
    3031                self.plan = json.load(fp)
    3132                self.browserDriver = BrowserDriverFactory.create([platform, browser])
    3233                self.httpServerDriver = HTTPServerDriverFactory.create([self.plan['http_server_driver']])
    33                 self.buildDir = os.path.abspath(buildDir)
     34                self.buildDir = os.path.abspath(buildDir) if buildDir else None
    3435                self.outputFile = outputFile
    3536        except IOError:
    3637            _log.error('Can not open plan file: %s' % planFile)
     38            raise
    3739        except ValueError:
    3840            _log.error('Plan file:%s may not follow JSON format' % planFile)
    39         except:
    4041            raise
     42
     43    def _findPlanFile(self, planFile):
     44        if not os.path.exists(planFile):
     45            absPath = os.path.join(os.path.dirname(__file__), 'data/plans', planFile)
     46            if os.path.exists(absPath):
     47                return absPath
     48            if not absPath.endswith('.plan'):
     49                absPath += '.plan'
     50            if os.path.exists(absPath):
     51                return absPath
     52        return planFile
    4153
    4254    def execute(self):
  • trunk/Tools/Scripts/webkitpy/benchmark_runner/browser_driver/browser_driver_factory.py

    r183309 r184044  
    1515
    1616    products = loadJSONFromFile(os.path.join(os.path.dirname(__file__), driverFileName))
     17
     18    @classmethod
     19    def available_platforms(cls):
     20        return cls.products.keys()
     21
     22    @classmethod
     23    def available_browsers(cls):
     24        browsers = []
     25        for platform in cls.products.values():
     26            for browser in platform:
     27                browsers.append(browser)
     28        return browsers
  • trunk/Tools/Scripts/webkitpy/benchmark_runner/browser_driver/osx_chrome_driver.py

    r183309 r184044  
    2020        self.chromePreferences = []
    2121
    22     def launchUrl(self, url, browserBuildPath=None):
     22    def launchUrl(self, url, browserBuildPath):
     23        if not browserBuildPath:
     24            browserBuildPath = '/Applications/'
    2325        _log.info('Launching chrome: %s with url: %s' % (os.path.join(browserBuildPath, 'Google Chrome.app'), url))
    2426        # FIXME: May need to be modified for develop build, such as setting up libraries
  • trunk/Tools/Scripts/webkitpy/benchmark_runner/browser_driver/osx_safari_driver.py

    r183621 r184044  
    2424        self.safariPreferences = ["-HomePage", "about:blank", "-WarnAboutFraudulentWebsites", "0", "-ExtensionsEnabled", "0", "-ShowStatusBar", "0", "-NewWindowBehavior", "1", "-NewTabBehavior", "1"]
    2525
    26     def launchUrl(self, url, browserBuildPath=None):
    27         args = [os.path.join(browserBuildPath, 'Safari.app/Contents/MacOS/Safari')]
     26    def launchUrl(self, url, browserBuildPath):
     27        args = ['/Applications/Safari.app/Contents/MacOS/SafariForWebKitDevelopment']
     28        env = {}
     29        if browserBuildPath:
     30            safariAppInBuildPath = os.path.join(browserBuildPath, 'Safari.app/Contents/MacOS/Safari')
     31            if os.path.exists(safariAppInBuildPath):
     32                args = [safariAppInBuildPath]
     33                env = {'DYLD_FRAMEWORK_PATH': browserBuildPath, 'DYLD_LIBRARY_PATH': browserBuildPath}
     34            else:
     35                _log.info('Could not find Safari.app at %s, using the system SafariForWebKitDevelopment in /Applications instead' % safariAppInBuildPath)
     36
    2837        args.extend(self.safariPreferences)
    2938        _log.info('Launching safari: %s with url: %s' % (args[0], url))
    30         self.safariProcess = subprocess.Popen(args, env={'DYLD_FRAMEWORK_PATH': browserBuildPath, 'DYLD_LIBRARY_PATH': browserBuildPath}, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
     39        self.safariProcess = subprocess.Popen(args, env=env, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
    3140        # Stop for initialization of the safari process, otherwise, open
    3241        # command may use the system safari.
Note: See TracChangeset for help on using the changeset viewer.