Revert "Rename SSHHost.run to SSHHost.run_very_slowly"
This reverts commit 672fb5f8806694d9476f016c0f1094da29120f31.
Reason for revert: Broke android tests: crbug.com/737316
Original change's description:
> Rename SSHHost.run to SSHHost.run_very_slowly
>
> This CL renames several places that calls SSHHost.run directly to SSHHost.run_very_slowly.
> In addition, it warns the caller with a more verbose server stack message now.
>
> BUG=chromium:735653
> TEST=test_that dut graphics_Sanity
> ./utils/unittest_suite.py --debug
> CQ-DEPEND=I2a434782b9b7ed7a3d31289d9925f3c8502a6d9f
>
> Change-Id: Icd22fe9bcc4b5a47320478932194a8b535f4a936
> Reviewed-on: https://chromium-review.googlesource.com/545116
> Commit-Ready: Po-Hsien Wang <pwang@chromium.org>
> Tested-by: Po-Hsien Wang <pwang@chromium.org>
> Reviewed-by: Ilja H. Friedel <ihf@chromium.org>
Bug: chromium:735653
Change-Id: If57cd6103d73bc1f0335866d8c130953754df0d9
Reviewed-on: https://chromium-review.googlesource.com/550970
Reviewed-by: Allen Li <ayatane@chromium.org>
Tested-by: Allen Li <ayatane@chromium.org>
Trybot-Ready: Allen Li <ayatane@chromium.org>
diff --git a/server/hosts/abstract_ssh.py b/server/hosts/abstract_ssh.py
index c7ca60a..c3a1a19 100644
--- a/server/hosts/abstract_ssh.py
+++ b/server/hosts/abstract_ssh.py
@@ -121,8 +121,7 @@
Check if rsync is available on the remote host.
"""
try:
- self.run_very_slowly("rsync --version",
- stdout_tee=None, stderr_tee=None)
+ self.run("rsync --version", stdout_tee=None, stderr_tee=None)
except error.AutoservRunError:
return False
return True
@@ -523,14 +522,13 @@
"""
ctimeout = min(timeout, connect_timeout or timeout)
try:
- self.run_very_slowly(base_cmd, timeout=timeout,
- connect_timeout=ctimeout,
- ssh_failure_retry_ok=True)
+ self.run(base_cmd, timeout=timeout, connect_timeout=ctimeout,
+ ssh_failure_retry_ok=True)
except error.AutoservSSHTimeout:
msg = "Host (ssh) verify timed out (timeout = %d)" % timeout
raise error.AutoservSSHTimeout(msg)
except error.AutoservSshPermissionDeniedError:
- # let AutoservSshPermissionDeniedError be visible to the callers
+ #let AutoservSshPermissionDeniedError be visible to the callers
raise
except error.AutoservRunError, e:
# convert the generic AutoservRunError into something more
diff --git a/server/hosts/cros_host.py b/server/hosts/cros_host.py
index 23fe5ed..edbb5ea 100644
--- a/server/hosts/cros_host.py
+++ b/server/hosts/cros_host.py
@@ -187,13 +187,13 @@
"""
try:
- result = host.run_very_slowly(
+ result = host.run(
'grep -q CHROMEOS /etc/lsb-release && '
'! test -f /mnt/stateful_partition/.android_tester && '
'! grep -q moblab /etc/lsb-release',
ignore_status=True, timeout=timeout)
if result.exit_status == 0:
- lsb_release_content = host.run_very_slowly(
+ lsb_release_content = host.run(
'grep CHROMEOS_RELEASE_BOARD /etc/lsb-release',
timeout=timeout).stdout
return not lsbrelease_utils.is_jetstream(
diff --git a/server/hosts/remote.py b/server/hosts/remote.py
index 2c5dcb7..0d4994f 100644
--- a/server/hosts/remote.py
+++ b/server/hosts/remote.py
@@ -49,7 +49,7 @@
if hasattr(self, 'tmp_dirs'):
for dir in self.tmp_dirs:
try:
- self.run_very_slowly('rm -rf "%s"' % (utils.sh_escape(dir)))
+ self.run('rm -rf "%s"' % (utils.sh_escape(dir)))
except error.AutoservRunError:
pass
@@ -67,7 +67,7 @@
try:
cmd = ('test ! -e /var/log/messages || cp -f /var/log/messages '
'%s') % self.VAR_LOG_MESSAGES_COPY_PATH
- self.run_very_slowly(cmd)
+ self.run(cmd)
except Exception, e:
# Non-fatal error
logging.info('Failed to copy /var/log/messages at startup: %s', e)
@@ -243,10 +243,9 @@
on the destruction of the Host object that was used to obtain
it.
"""
- self.run_very_slowly("mkdir -p %s" % parent)
+ self.run("mkdir -p %s" % parent)
template = os.path.join(parent, 'autoserv-XXXXXX')
- dir_name = self.run_very_slowly("mktemp -d %s"
- % template).stdout.rstrip()
+ dir_name = self.run("mktemp -d %s" % template).stdout.rstrip()
self.tmp_dirs.append(dir_name)
return dir_name
diff --git a/server/hosts/ssh_host.py b/server/hosts/ssh_host.py
index 77da9d6..991987e 100644
--- a/server/hosts/ssh_host.py
+++ b/server/hosts/ssh_host.py
@@ -76,24 +76,17 @@
alive_interval=alive_interval)
return "%s %s" % (base_cmd, self.hostname)
- def _get_server_stack_state(self, lowest_frames=0, highest_frames=None,
- verbose=False):
+ def _get_server_stack_state(self, lowest_frames=0, highest_frames=None):
""" Get the server stack frame status.
@param lowest_frames: the lowest frames to start printing.
@param highest_frames: the highest frames to print.
- (None means no restriction)
+ (None means no restriction)
"""
stack_frames = inspect.stack()
stack = ''
for frame in stack_frames[lowest_frames:highest_frames]:
- info = inspect.getframeinfo(frame[0])
- if verbose:
- stack = '%s:%s <%s> | %s' % (info.filename,
- info.lineno,
- info.function,
- stack)
- else:
- stack = '%s | %s' % (info.function, stack)
+ function_name = inspect.getframeinfo(frame[0]).function
+ stack = '%s|%s' % (function_name, stack)
del stack_frames
return stack[:-1] # Delete the last '|' character
@@ -299,9 +292,7 @@
@raises AutoservSSHTimeout: ssh connection has timed out
"""
if verbose:
- stack = self._get_server_stack_state(lowest_frames=1,
- highest_frames=7,
- verbose=True)
+ stack = self._get_server_stack_state(lowest_frames=1, highest_frames=7)
logging.debug("Running (ssh) '%s' from '%s'", command, stack)
command = self._verbose_logger_command(command)
@@ -321,8 +312,6 @@
raise error.AutoservRunError(timeout_message, cmderr.args[1])
- # TODO(pwang): Delete this once all reference to the original run function
- # is changed to run_very_slowly. (crbug.com/735653)
def run(self, *args, **kwargs):
return self.run_very_slowly(*args, **kwargs)