Changeset 184044 in webkit
- Timestamp:
- May 9, 2015, 11:46:33 PM (11 years ago)
- Location:
- trunk/Tools
- Files:
-
- 6 edited
-
ChangeLog (modified) (1 diff)
-
Scripts/run-benchmark (modified) (3 diffs)
-
Scripts/webkitpy/benchmark_runner/benchmark_runner.py (modified) (1 diff)
-
Scripts/webkitpy/benchmark_runner/browser_driver/browser_driver_factory.py (modified) (1 diff)
-
Scripts/webkitpy/benchmark_runner/browser_driver/osx_chrome_driver.py (modified) (1 diff)
-
Scripts/webkitpy/benchmark_runner/browser_driver/osx_safari_driver.py (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Tools/ChangeLog
r184040 r184044 1 2015-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 1 35 2015-05-09 Yoav Weiss <yoav@yoav.ws> 2 36 -
trunk/Tools/Scripts/run-benchmark
r183621 r184044 3 3 import argparse 4 4 import logging 5 import platform 5 6 import sys 6 7 7 8 from webkitpy.benchmark_runner.benchmark_runner import BenchmarkRunner 9 from webkitpy.benchmark_runner.browser_driver.browser_driver_factory import BrowserDriverFactory 8 10 9 11 … … 19 21 parser = argparse.ArgumentParser(description='Automate the browser based performance benchmarks') 20 22 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()) 24 26 # 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()) 26 28 parser.add_argument('--debug', action='store_true') 27 29 args = parser.parse_args() 28 30 29 31 if args.debug: 30 32 _log.setLevel(logging.DEBUG) … … 36 38 return runner.execute() 37 39 40 38 41 if __name__ == '__main__': 39 42 sys.exit(main()) -
trunk/Tools/Scripts/webkitpy/benchmark_runner/benchmark_runner.py
r183685 r184044 27 27 _log.info('Initializing benchmark running') 28 28 try: 29 planFile = self._findPlanFile(planFile) 29 30 with open(planFile, 'r') as fp: 30 31 self.plan = json.load(fp) 31 32 self.browserDriver = BrowserDriverFactory.create([platform, browser]) 32 33 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 34 35 self.outputFile = outputFile 35 36 except IOError: 36 37 _log.error('Can not open plan file: %s' % planFile) 38 raise 37 39 except ValueError: 38 40 _log.error('Plan file:%s may not follow JSON format' % planFile) 39 except:40 41 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 41 53 42 54 def execute(self): -
trunk/Tools/Scripts/webkitpy/benchmark_runner/browser_driver/browser_driver_factory.py
r183309 r184044 15 15 16 16 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 20 20 self.chromePreferences = [] 21 21 22 def launchUrl(self, url, browserBuildPath=None): 22 def launchUrl(self, url, browserBuildPath): 23 if not browserBuildPath: 24 browserBuildPath = '/Applications/' 23 25 _log.info('Launching chrome: %s with url: %s' % (os.path.join(browserBuildPath, 'Google Chrome.app'), url)) 24 26 # 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 24 24 self.safariPreferences = ["-HomePage", "about:blank", "-WarnAboutFraudulentWebsites", "0", "-ExtensionsEnabled", "0", "-ShowStatusBar", "0", "-NewWindowBehavior", "1", "-NewTabBehavior", "1"] 25 25 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 28 37 args.extend(self.safariPreferences) 29 38 _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) 31 40 # Stop for initialization of the safari process, otherwise, open 32 41 # command may use the system safari.
Note:
See TracChangeset
for help on using the changeset viewer.