[PATCH V1] framework/ssh_pexpect: add output buffered information when execute command exception
Dong, JunX
junx.dong at intel.com
Tue Nov 16 07:07:58 CET 2021
From: "Dong, JunX" <junx.dong at intel.com>
Signed-off-by: Dong, JunX <junx.dong at intel.com>
---
framework/ssh_pexpect.py | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/framework/ssh_pexpect.py b/framework/ssh_pexpect.py
index 783f989..a9331d5 100644
--- a/framework/ssh_pexpect.py
+++ b/framework/ssh_pexpect.py
@@ -87,7 +87,7 @@ class SSHPexpect:
return before
def send_expect(self, command, expected, timeout=15, verify=False):
-
+ buffered_info = self.get_session_before(timeout=0)
try:
ret = self.send_expect_base(command, expected, timeout)
if verify:
@@ -96,11 +96,13 @@ class SSHPexpect:
return ret
else:
self.logger.error("Command: %s failure!" % command)
+ self.logger.error('Buffered info: ' + buffered_info)
self.logger.error(ret)
return int(ret_status)
else:
return ret
except Exception as e:
+ self.logger.error('Buffered info: ' + buffered_info)
print(RED("Exception happened in [%s] and output is [%s]" % (command, self.get_output_before())))
raise(e)
--
1.8.3.1
More information about the dts
mailing list