autotest:Fix the log collection logic that may break tests
The change introduced in https://crrev.com/c/2481972 breaks
tests/sub-tests that put DUT in power off state in the middle
due to no ssh connection.
BUG=b:172023918
TEST=run servo_LabstationVerification test locally
Change-Id: Iaf1b266cacbb99118a18a6eb08f2c9a4b852f79f
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/autotest/+/2508933
Tested-by: Garry Wang <xianuowang@chromium.org>
Reviewed-by: Miriam Zimmerman <mutexlox@chromium.org>
Reviewed-by: Greg Edelston <gredelston@google.com>
Commit-Queue: Garry Wang <xianuowang@chromium.org>
diff --git a/client/common_lib/test.py b/client/common_lib/test.py
index e623d79..35d0982 100644
--- a/client/common_lib/test.py
+++ b/client/common_lib/test.py
@@ -396,7 +396,7 @@
# attribute the crash to it (e.g. to the 'tast.critical-system'
# "autotest"). For this case, we should save the contents of the
# file before a test and restore it after.
- if 'host' in dargs:
+ if 'host' in dargs and dargs['host'].is_up_fast():
dargs['host'].run('echo %s > %s' %
(self.tagged_testname, self.test_in_prog_file),
ignore_status=True)
@@ -436,7 +436,7 @@
'after_iteration_hooks.', str(e))
raise
finally:
- if 'host' in dargs:
+ if 'host' in dargs and dargs['host'].is_up_fast():
dargs['host'].run('rm -f %s' % self.test_in_prog_file)
else:
try: