Commit 844410d2 authored by Stephen Roe's avatar Stephen Roe Committed by Commit Bot

[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/+/2212987Reviewed-by: default avatarKevin Marshall <kmarshall@chromium.org>
Commit-Queue: Stephen Roe <steveroe@google.com>
Cr-Commit-Position: refs/heads/master@{#775358}
parent ebc9c0e9
......@@ -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,28 @@ class Target(object):
def _AssertIsStarted(self):
assert self.IsStarted()
def _WaitUntilReady(self):
def _WaitUntilReady(self, ssh_diagnostic_log_file=None):
logging.info('Connecting to Fuchsia using SSH.')
if ssh_diagnostic_log_file is None:
ssh_diagnostic_log_file = open(os.devnull, 'w')
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.')
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