From: "Juraj Linkeš" <juraj.linkes@pantheon.tech>
Cc: dev@dpdk.org, "Juraj Linkeš" <juraj.linkes@pantheon.tech>
Subject: [PATCH v1] dts: fix ssh timeout and output
Date: Thu, 27 Oct 2022 14:09:45 +0000 [thread overview]
Message-ID: <20221027140945.18249-1-juraj.linkes@pantheon.tech> (raw)
We were always waiting the full timeout because we always waited for
the MAGIC_PROMPT, which is only usable for cleaning the session of
previous data. That also meant that the actual prompt was appended to
the output, resulting in output being '[PEXPECT]#' when the executed
command produced empty output. Both are fixed by using the MAGIC_PROMPT
only in self._clean_session.
Fixes: e81a070a1c7d ("dts: add ssh session module")
Signed-off-by: Juraj Linkeš <juraj.linkes@pantheon.tech>
---
dts/framework/remote_session/ssh_session.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/dts/framework/remote_session/ssh_session.py b/dts/framework/remote_session/ssh_session.py
index f71acfb1ca..dc37e9772b 100644
--- a/dts/framework/remote_session/ssh_session.py
+++ b/dts/framework/remote_session/ssh_session.py
@@ -116,7 +116,9 @@ def send_expect_base(self, command: str, prompt: str, timeout: float) -> str:
return before
def _clean_session(self) -> None:
+ self.session.PROMPT = self.magic_prompt
self.get_output(timeout=0.01)
+ self.session.PROMPT = self.session.UNIQUE_PROMPT
def _send_line(self, command: str) -> None:
if not self.is_alive():
@@ -134,7 +136,6 @@ def get_output(self, timeout: float = 15) -> str:
"""
Get all output before timeout
"""
- self.session.PROMPT = self.magic_prompt
try:
self.session.prompt(timeout)
except Exception:
@@ -143,7 +144,6 @@ def get_output(self, timeout: float = 15) -> str:
before = self._get_output()
self._flush()
- self.logger.debug(before)
return before
def _get_output(self) -> str:
--
2.30.2
reply other threads:[~2022-10-27 14:09 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20221027140945.18249-1-juraj.linkes@pantheon.tech \
--to=juraj.linkes@pantheon.tech \
--cc=dev@dpdk.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).