+2015-04-30 Dewei Zhu <dewei_zhu@apple.com>
+
+ Fix return code issue, check return code of safari process and dump results to log
+ https://bugs.webkit.org/show_bug.cgi?id=144436
+
+ Reviewed by Ryosuke Niwa.
+
+ * Scripts/run-benchmark:
+ * Scripts/webkitpy/benchmark_runner/benchmark_runner.py:
+ (BenchmarkRunner.dump): Correct typo.
+ (BenchmarkRunner.wrap): Add results to console.
+ * Scripts/webkitpy/benchmark_runner/browser_driver/osx_safari_driver.py: Check return code to detect Safari crashes.
+ (OSXSafariDriver.prepareEnv):
+ (OSXSafariDriver.launchUrl):
+ (OSXSafariDriver.closeBrowsers):
+
2015-04-29 Joseph Pecoraro <pecoraro@apple.com>
Should no longer need to worry about very old versions of Xcode
@classmethod
def dump(cls, results, outputFile):
- _log.info('Dumpping the results to file')
+ _log.info('Dumping the results to file')
try:
with open(outputFile, 'w') as fp:
json.dump(results, fp)
@classmethod
def wrap(cls, dicts):
+ _log.info('Merging following results:\n%s', json.dumps(dicts))
if not dicts:
return None
ret = {}
for dic in dicts:
ret = cls.merge(ret, dic)
+ _log.info('Results after merging:\n%s', json.dumps(ret))
return ret
@classmethod
class OSXSafariDriver(BrowserDriver):
def prepareEnv(self):
+ self.safariProcess = None
self.closeBrowsers()
forceRemove(os.path.join(os.path.expanduser('~'), 'Library/Saved Application State/com.apple.Safari.savedState'))
forceRemove(os.path.join(os.path.expanduser('~'), 'Library/Safari/LastSession.plist'))
args = [os.path.join(browserBuildPath, 'Safari.app/Contents/MacOS/Safari')]
args.extend(self.safariPreferences)
_log.info('Launching safari: %s with url: %s' % (args[0], url))
- subprocess.Popen(args, env={'DYLD_FRAMEWORK_PATH': browserBuildPath, 'DYLD_LIBRARY_PATH': browserBuildPath}, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+ self.safariProcess = subprocess.Popen(args, env={'DYLD_FRAMEWORK_PATH': browserBuildPath, 'DYLD_LIBRARY_PATH': browserBuildPath}, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
# Stop for initialization of the safari process, otherwise, open
# command may use the system safari.
time.sleep(3)
safariInstances = NSRunningApplication.runningApplicationsWithBundleIdentifier_('com.apple.Safari')
for safariInstance in safariInstances:
safariInstance.terminate()
+ if self.safariProcess:
+ _log.info('Safari process console output:\nstdout: %s\nstderr: %s' % self.safariProcess.communicate())
+ if self.safariProcess.returncode:
+ _log.error('Safari Crashed!')