autotest: Ignore ssh command timeouts on request
Add a flag to SSHHost.run() that allows callers to ignore command
timeouts. Upon SSH command timeouts, we get None instead of a result
value. Callers must be prepared to expect this.
TEST=Add a host parameter to dummy_PassServer and add:
host.run('sleep 10', timeout=1, ignore_timeout=True)
Observe that the test still passes, unlike before.
BUG=chromium:282471
Change-Id: I2bf64fb3f06b57d44ee7f13ad51ca2b19707891e
Reviewed-on: https://chromium-review.googlesource.com/168651
Tested-by: Christopher Wiley <wiley@chromium.org>
Reviewed-by: Simran Basi <sbasi@chromium.org>
Commit-Queue: Christopher Wiley <wiley@chromium.org>
diff --git a/client/common_lib/error.py b/client/common_lib/error.py
index 03e806f..076d7f4 100644
--- a/client/common_lib/error.py
+++ b/client/common_lib/error.py
@@ -274,9 +274,7 @@
class CmdError(TestError):
- """\
- Indicates that a command failed, is fatal to the test unless caught.
- """
+ """Indicates that a command failed, is fatal to the test unless caught."""
def __init__(self, command, result_obj, additional_text=None):
TestError.__init__(self, command, result_obj, additional_text)
self.command = command
@@ -298,6 +296,11 @@
return msg
+class CmdTimeoutError(CmdError):
+ """Indicates that a command timed out."""
+ pass
+
+
class PackageError(TestError):
"""Indicates an error trying to perform a package operation."""
pass