Bug 1296562 - Revert order for crash and socket checks in do_process_check decorator. r?maja_zf draft
authorHenrik Skupin <mail@hskupin.info>
Fri, 19 Aug 2016 09:22:32 +0200
changeset 403161 4d3d4376553b41f670f543e7512466a4118adc35
parent 402150 97a52326b06a07930216ebefa5af333271578904
child 528839 17850fd00c53b9cc2fd87aeb6de0dd3c4d7c2fd8
push id26840
push userbmo:hskupin@gmail.com
push dateFri, 19 Aug 2016 07:24:26 +0000
reviewersmaja_zf
bugs1296562
milestone51.0a1
Bug 1296562 - Revert order for crash and socket checks in do_process_check decorator. r?maja_zf MozReview-Commit-ID: Dd2Pl3FnbUP
testing/marionette/client/marionette_driver/decorators.py
--- a/testing/marionette/client/marionette_driver/decorators.py
+++ b/testing/marionette/client/marionette_driver/decorators.py
@@ -38,23 +38,27 @@ def do_process_check(func, always=False)
                 # don't want to lose the original exception
                 traceback.print_exc()
 
         try:
             return func(*args, **kwargs)
         except (MarionetteException, IOError) as e:
             exc, val, tb = sys.exc_info()
 
+            # In case of no Marionette failures ensure to check for possible crashes.
+            # Do it before checking for port disconnects, to avoid reporting of unrelated
+            # crashes due to a forced shutdown of the application.
+            if not isinstance(e, MarionetteException) or type(e) is MarionetteException:
+                if not always:
+                    check_for_crash()
+
             # In case of socket failures force a shutdown of the application
             if type(e) in (socket.error, socket.timeout):
                 m.force_shutdown()
 
-            if not isinstance(e, MarionetteException) or type(e) is MarionetteException:
-                if not always:
-                    check_for_crash()
             raise exc, val, tb
         finally:
             if always:
                 check_for_crash(m)
     return _
 
 
 def uses_marionette(func):