Bug 1499889 - Make sure we don't try to remove device forwards that no longer exist r=gbrown
authorWes Kocher <wkocher@mozilla.com>
Fri, 19 Oct 2018 14:38:51 +0000
changeset 497935 6ff410edad90dbc51d72aeb722d0ff8d182606c1
parent 497934 b5eee61ba434f914398ffa77253f84b5f2127aa0
child 497936 021f6173bd2cc0dff6172c8a63311dbd0b092c63
push id10016
push userrgurzau@mozilla.com
push dateMon, 22 Oct 2018 13:58:55 +0000
treeherdermozilla-beta@848cf6354160 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgbrown
bugs1499889
milestone64.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1499889 - Make sure we don't try to remove device forwards that no longer exist r=gbrown The stop() function is apparently being called multiple times at the end of a test run, causing us to sometimes attempt to remove device forwards that were removed in an earlier stop() attempt but before the conditions checked in stop() to remove the device forwards get changed. This caused a traceback to be printed out at the end of every test run, complaining about attempts to remove device forwards that don't exist. Rather than dig through to figure out why/where stop() is getting called twice, this patch just papers over the issue by making sure there is at least one device forward still listed before attempting to remove them. Differential Revision: https://phabricator.services.mozilla.com/D9175
testing/web-platform/tests/tools/wptrunner/wptrunner/browsers/fennec.py
--- a/testing/web-platform/tests/tools/wptrunner/wptrunner/browsers/fennec.py
+++ b/testing/web-platform/tests/tools/wptrunner/wptrunner/browsers/fennec.py
@@ -225,18 +225,19 @@ class FennecBrowser(FirefoxBrowser):
             remote="tcp:{}".format(self.marionette_port))
 
         self.logger.debug("Fennec Started")
 
     def stop(self, force=False):
         if self.runner is not None:
             try:
                 if self.runner.device.connected:
-                    self.runner.device.device.remove_forwards(
-                        "tcp:{}".format(self.marionette_port))
+                    if len(self.runner.device.device.list_forwards()) > 0:
+                        self.runner.device.device.remove_forwards(
+                            "tcp:{}".format(self.marionette_port))
             except Exception:
                 traceback.print_exception(*sys.exc_info())
             # We assume that stopping the runner prompts the
             # browser to shut down. This allows the leak log to be written
             self.runner.stop()
             for clean, stop_f in [(True, lambda: self.runner.wait(self.shutdown_timeout)),
                                   (False, lambda: self.runner.stop(signal.SIGTERM)),
                                   (False, lambda: self.runner.stop(signal.SIGKILL))]: