Bug 1373444 - Ignore exceptions during wpt test teardown. r=maja_zf, a=test-only
authorJames Graham <james@hoppipolla.co.uk>
Thu, 31 Aug 2017 15:49:38 +0100
changeset 423932 ba89ef7040e03c1c6e92a4adeeac0903124d6c80
parent 423931 569cb400470af584fd505e82a005e7c411b0422f
child 423933 d0fb17cf639bff43bde763ae81515bca8089047d
push id1517
push userjlorenzo@mozilla.com
push dateThu, 14 Sep 2017 16:50:54 +0000
treeherdermozilla-release@3b41fd564418 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmaja_zf, test-only
bugs1373444
milestone56.0
Bug 1373444 - Ignore exceptions during wpt test teardown. r=maja_zf, a=test-only In general these exceptions are the result of something unexpected in the environment, but shouldn't themseslves cause the test to error. MozReview-Commit-ID: 5XjJoT4UwnC
testing/web-platform/tests/tools/wptrunner/wptrunner/executors/executormarionette.py
--- a/testing/web-platform/tests/tools/wptrunner/wptrunner/executors/executormarionette.py
+++ b/testing/web-platform/tests/tools/wptrunner/wptrunner/executors/executormarionette.py
@@ -495,20 +495,24 @@ class MarionetteRefTestExecutor(RefTestE
         with open(os.path.join(here, "reftest-wait.js")) as f:
             self.wait_script = f.read()
 
     def setup(self, runner):
         super(self.__class__, self).setup(runner)
         self.implementation.setup(**self.implementation_kwargs)
 
     def teardown(self):
-        self.implementation.teardown()
-        handle = self.protocol.marionette.window_handles[0]
-        self.protocol.marionette.switch_to_window(handle)
-        super(self.__class__, self).teardown()
+        try:
+            self.implementation.teardown()
+            handle = self.protocol.marionette.window_handles[0]
+            self.protocol.marionette.switch_to_window(handle)
+            super(self.__class__, self).teardown()
+        except Exception as e:
+            # Ignore errors during teardown
+            self.logger.warning(traceback.traceback.format_exc(e))
 
     def is_alive(self):
         return self.protocol.is_alive
 
     def on_environment_change(self, new_environment):
         self.protocol.on_environment_change(self.last_environment, new_environment)
 
     def do_test(self, test):
@@ -532,20 +536,20 @@ class MarionetteRefTestExecutor(RefTestE
         assert viewport_size is None
         assert dpi is None
 
         timeout =  self.timeout_multiplier * test.timeout if self.debug_info is None else None
 
         test_url = self.test_url(test)
 
         return ExecuteAsyncScriptRun(self.logger,
-                             self._screenshot,
-                             self.protocol,
-                             test_url,
-                             timeout).run()
+                                     self._screenshot,
+                                     self.protocol,
+                                     test_url,
+                                     timeout).run()
 
     def _screenshot(self, marionette, url, timeout):
         marionette.navigate(url)
 
         marionette.execute_async_script(self.wait_script)
 
         screenshot = marionette.screenshot(full=False)
         # strip off the data:img/png, part of the url
@@ -590,18 +594,20 @@ class InternalRefTestImplementation(obje
         for item, relation in node.references:
             rv.append([self.executor.test_url(item), self.get_references(item), relation])
         return rv
 
     def teardown(self):
         try:
             self.executor.protocol.marionette._send_message("reftest:teardown", {})
             self.executor.protocol.marionette.set_context(self.executor.protocol.marionette.CONTEXT_CONTENT)
-        except socket.error:
-            pass
+        except Exception as e:
+            # Ignore errors during teardown
+            self.logger.warning(traceback.traceback.format_exc(e))
+
 
 class WdspecRun(object):
     def __init__(self, func, session, path, timeout):
         self.func = func
         self.result = (None, None)
         self.session = session
         self.path = path
         self.timeout = timeout