Commit 0ae8b0c3 authored by Stephen Roe's avatar Stephen Roe Committed by Commit Bot

Reland "[fuchsia] Add ssh debug messages to the emulator output log file."

This is a reland of 844410d2

Fixed the bug in the timeout case logic.  Tested it by reducing the
timeout value so that the timeout logic was exercised.

Original change's description:
> [fuchsia] Add ssh debug messages to the emulator output log file.
>
> This will give more information on startup connectivity issues.
>
> Bug: 1063106
> Change-Id: I90590eaeee7aaac19d8e277b42f42ce5cd6b4f85
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2212987
> Reviewed-by: Kevin Marshall <kmarshall@chromium.org>
> Commit-Queue: Stephen Roe <steveroe@google.com>
> Cr-Commit-Position: refs/heads/master@{#775358}

Bug: 1063106
Change-Id: I8a28b9d41d5dce9bd444a04f623f6b260355c6f9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2235990
Commit-Queue: Stephen Roe <steveroe@google.com>
Reviewed-by: default avatarKevin Marshall <kmarshall@chromium.org>
Cr-Commit-Position: refs/heads/master@{#776267}
parent cb7122e7
......@@ -74,7 +74,7 @@ class EmuTarget(target.Target):
env=emu_env)
try:
self._WaitUntilReady();
self._WaitUntilReady(ssh_diagnostic_log_file=stdout)
except target.FuchsiaTargetException:
if temporary_system_log_file:
logging.info('Kernel logs:\n' +
......
......@@ -211,20 +211,25 @@ class Target(object):
def _AssertIsStarted(self):
assert self.IsStarted()
def _WaitUntilReady(self):
def _WaitUntilReady(self, ssh_diagnostic_log_file=open(os.devnull, 'w')):
logging.info('Connecting to Fuchsia using SSH.')
host, port = self._GetEndpoint()
end_time = time.time() + _ATTACH_RETRY_SECONDS
while time.time() < end_time:
runner = remote_cmd.CommandRunner(self._GetSshConfigPath(), host, port)
if runner.RunCommand(['true'], True) == 0:
ssh_proc = runner.RunCommandPiped(['true'],
ssh_args=['-v'],
stdout=ssh_diagnostic_log_file,
stderr=subprocess.STDOUT)
if ssh_proc.wait() == 0:
logging.info('Connected!')
self._started = True
return True
time.sleep(_ATTACH_RETRY_INTERVAL)
logging.error('Timeout limit reached.')
ssh_diagnostic_log_file.flush()
raise FuchsiaTargetException('Couldn\'t connect using SSH.')
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment