Title: [183621] trunk/Tools
Revision
183621
Author
commit-qu...@webkit.org
Date
2015-04-30 00:08:19 -0700 (Thu, 30 Apr 2015)

Log Message

Fix return code issue, check return code of safari process and dump results to log
https://bugs.webkit.org/show_bug.cgi?id=144436

Patch by Dewei Zhu <dewei_...@apple.com> on 2015-04-30
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):

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (183620 => 183621)


--- trunk/Tools/ChangeLog	2015-04-30 06:43:57 UTC (rev 183620)
+++ trunk/Tools/ChangeLog	2015-04-30 07:08:19 UTC (rev 183621)
@@ -1,3 +1,19 @@
+2015-04-30  Dewei Zhu  <dewei_...@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  <pecor...@apple.com>
 
         Should no longer need to worry about very old versions of Xcode

Modified: trunk/Tools/Scripts/run-benchmark (183620 => 183621)


--- trunk/Tools/Scripts/run-benchmark	2015-04-30 06:43:57 UTC (rev 183620)
+++ trunk/Tools/Scripts/run-benchmark	2015-04-30 07:08:19 UTC (rev 183621)
@@ -2,6 +2,8 @@
 
 import argparse
 import logging
+import sys
+
 from webkitpy.benchmark_runner.benchmark_runner import BenchmarkRunner
 
 
@@ -34,4 +36,4 @@
     return runner.execute()
 
 if __name__ == '__main__':
-    main()
+    sys.exit(main())

Modified: trunk/Tools/Scripts/webkitpy/benchmark_runner/benchmark_runner.py (183620 => 183621)


--- trunk/Tools/Scripts/webkitpy/benchmark_runner/benchmark_runner.py	2015-04-30 06:43:57 UTC (rev 183620)
+++ trunk/Tools/Scripts/webkitpy/benchmark_runner/benchmark_runner.py	2015-04-30 07:08:19 UTC (rev 183621)
@@ -72,7 +72,7 @@
 
     @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)
@@ -82,11 +82,13 @@
 
     @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

Modified: trunk/Tools/Scripts/webkitpy/benchmark_runner/browser_driver/osx_safari_driver.py (183620 => 183621)


--- trunk/Tools/Scripts/webkitpy/benchmark_runner/browser_driver/osx_safari_driver.py	2015-04-30 06:43:57 UTC (rev 183620)
+++ trunk/Tools/Scripts/webkitpy/benchmark_runner/browser_driver/osx_safari_driver.py	2015-04-30 07:08:19 UTC (rev 183621)
@@ -17,6 +17,7 @@
 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'))
@@ -26,7 +27,7 @@
         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)
@@ -37,3 +38,7 @@
         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!')
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to