Improve failed test diagnostics.

This commit is contained in:
Pavel Minaev 2019-11-18 12:27:26 -08:00 committed by Pavel Minaev
parent 3e29307d65
commit fb6d35ebea
3 changed files with 6 additions and 5 deletions

View file

@ -337,7 +337,7 @@ attach_pid_injected.attach(port={port}, host=host, client={client}, log_dir=log_
def main():
original_argv = sys.argv
original_argv = list(sys.argv)
try:
sys.argv[1:] = parse(sys.argv[1:])
except Exception as ex:

View file

@ -561,8 +561,9 @@ class Session(object):
)
if start_request.response is not None:
# It was an immediate response - configuration is not possible. Just get
# the "process" event, and return to caller.
# It was an immediate response - either the request failed, or there is
# no configuration stage for this debug session.
start_request.response.result # raise exception if failed
return self.wait_for_process()
# We got "initialized" - now we need to yield to the caller, so that it can

View file

@ -63,11 +63,11 @@ def wait_until_port_is_listening(port, interval=1, max_attempts=1000):
try:
log.info("Probing localhost:{0} (attempt {1})...", port, i)
sock.connect(("localhost", port))
except socket.error:
except socket.error as exc:
# The first attempt will almost always fail, because the port isn't
# open yet. But if it keeps failing after that, we want to know why.
if i > 1:
log.exception()
log.warning("Failed to connect to localhost:{0}:\n{1}", port, exc)
time.sleep(interval)
else:
log.info("localhost:{0} is listening - server is up!", port)