From: Uladzimir Bely <ubely@ilbers.de>
To: isar-users@googlegroups.com
Subject: [PATCH 4/8] cibuilder.py: Simplify remote_run command
Date: Fri, 18 Aug 2023 09:07:02 +0200 [thread overview]
Message-ID: <20230818070706.27913-5-ubely@ilbers.de> (raw)
In-Reply-To: <20230818070706.27913-1-ubely@ilbers.de>
Since we now parse qemu boot log in a separate small function even
in case of executing SSH-based test, we don't need to pass qemu-related
`proc` object to the ssh ping routine `wait_connection`.
Signed-off-by: Uladzimir Bely <ubely@ilbers.de>
---
testsuite/cibuilder.py | 16 ++++++----------
1 file changed, 6 insertions(+), 10 deletions(-)
diff --git a/testsuite/cibuilder.py b/testsuite/cibuilder.py
index 8f28d05a..c0bfb75c 100755
--- a/testsuite/cibuilder.py
+++ b/testsuite/cibuilder.py
@@ -268,10 +268,7 @@ class CIBuilder(Test):
return rc
- def wait_connection(self, proc, cmd_prefix, timeout):
- if proc is None:
- return 0
-
+ def wait_connection(self, cmd_prefix, timeout):
self.log.debug('Waiting for SSH server ready...')
rc = None
@@ -279,9 +276,6 @@ class CIBuilder(Test):
# Use 3 good SSH ping attempts to consider SSH connection is stable
while time.time() < timeout and goodcnt < 3:
goodcnt += 1
- if proc.poll() is not None:
- self.log.error('Machine is not running')
- return rc
rc = self.exec_cmd('/bin/true', cmd_prefix)
time.sleep(1)
@@ -305,11 +299,13 @@ class CIBuilder(Test):
return priv_key
- def remote_run(self, user, host, port, cmd, script, proc=None, timeout=0):
+ def remote_run(self, user, host, port, cmd, script, timeout=0):
priv_key = self.prepare_priv_key()
cmd_prefix = self.get_ssh_cmd_prefix(user, host, port, priv_key)
- rc = self.wait_connection(proc, cmd_prefix, timeout)
+ rc = 0
+ if timeout:
+ rc = self.wait_connection(cmd_prefix, timeout)
if rc == 0:
if cmd is not None:
@@ -476,7 +472,7 @@ class CIBuilder(Test):
if match:
port = match.group(1)
break
- rc = self.remote_run(user, host, port, cmd, script, p1, timeout)
+ rc = self.remote_run(user, host, port, cmd, script, timeout)
if rc != 0:
self.vm_turn_off(p1)
self.fail('Failed to run test over ssh')
--
2.20.1
next prev parent reply other threads:[~2023-08-18 7:07 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-18 7:06 [PATCH 0/8] Testsuite improvements for SSH-based tests Uladzimir Bely
2023-08-18 7:06 ` [PATCH 1/8] cibuilder.py: Support custom arguments passing to CI scripts Uladzimir Bely
2023-08-18 7:07 ` [PATCH 2/8] meta-isar: Add more extra space to qemu ext4 images Uladzimir Bely
2023-08-18 7:07 ` [PATCH 3/8] cibuilder.py: Split vm_start function to smaller subfunctions Uladzimir Bely
2023-08-18 7:07 ` Uladzimir Bely [this message]
2023-08-18 7:07 ` [PATCH 5/8] cibuilder.py: Reuse the same qemu machine in ssh-based tests Uladzimir Bely
2023-08-18 7:07 ` [PATCH 6/8] citest.py: Adapt tests to qemu reuse Uladzimir Bely
2023-08-18 7:07 ` [PATCH 7/8] cibuilder.py: enable output from remote scripts Uladzimir Bely
2023-08-18 7:07 ` [PATCH 8/8] testsuite: Switch to remote scripts with arguments Uladzimir Bely
2023-08-24 15:34 ` [PATCH 0/8] Testsuite improvements for SSH-based tests Uladzimir Bely
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=20230818070706.27913-5-ubely@ilbers.de \
--to=ubely@ilbers.de \
--cc=isar-users@googlegroups.com \
/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