Bug 1394381 - Add logging output for Marionette connection attempts.
If Marionette client cannot connect to the server, the attempts
have to be logged to stderr. This allows us to inspect the reason
why a connection from the client could not be made, and that it
still tries to connect (see
bug 1362293).
MozReview-Commit-ID: ElE1M73ums8
--- a/testing/marionette/client/marionette_driver/marionette.py
+++ b/testing/marionette/client/marionette_driver/marionette.py
@@ -658,34 +658,34 @@ class Marionette(object):
"""
if timeout is None:
timeout = self.DEFAULT_STARTUP_TIMEOUT
runner = None
if self.instance is not None:
runner = self.instance.runner
- poll_interval = 0.1
+ poll_interval = 1
starttime = datetime.datetime.now()
while datetime.datetime.now() - starttime < datetime.timedelta(seconds=timeout):
# If the instance we want to connect to is not running return immediately
if runner is not None and not runner.is_running():
return False
sock = None
try:
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.settimeout(0.5)
sock.connect((self.host, self.port))
data = sock.recv(16)
if ":" in data:
return True
- except socket.error:
- pass
+ except socket.error as e:
+ print >>sys.stderr, "Connection attempt to Marionette failed ({})".format(e)
finally:
if sock is not None:
sock.close()
time.sleep(poll_interval)
return False