From: David Gibson <david@gibson.dropbear.id.au>
To: passt-dev@passt.top
Subject: Re: [PATCH 01/12] test: Add wait_for() shell helper
Date: Sat, 24 Sep 2022 12:59:48 +1000 [thread overview]
Message-ID: <Yy5ypFOv6RmOfT7M@yekko> (raw)
In-Reply-To: <20220924010746.6577473f@elisabeth>
[-- Attachment #1: Type: text/plain, Size: 1915 bytes --]
On Sat, Sep 24, 2022 at 01:07:46AM +0200, Stefano Brivio wrote:
> On Fri, 23 Sep 2022 17:20:27 +1000
> David Gibson <david(a)gibson.dropbear.id.au> wrote:
>
> > Add a shell helper function to wait for some command to succeed - typically
> > a test for something to be done by a background process. Use it in the
> > context code which waits for the guest to respond to ssh-over-vsock
> > connections.
> >
> > Signed-off-by: David Gibson <david(a)gibson.dropbear.id.au>
> > ---
> > test/lib/context | 4 +---
> > test/lib/util | 8 ++++++++
> > 2 files changed, 9 insertions(+), 3 deletions(-)
> >
> > diff --git a/test/lib/context b/test/lib/context
> > index 43b00dd..ee6b683 100644
> > --- a/test/lib/context
> > +++ b/test/lib/context
> > @@ -63,9 +63,7 @@ EOF
> > echo "ssh -F ${__ssh} ${__name}" > "${__enter}"
> >
> > # Wait for the guest to be booted and accepting connections
> > - while ! ssh -F "${__ssh}" "${__name}" :; do
> > - sleep 0.1
> > - done
> > + wait_for ssh -F "${__ssh}" "${__name}" :
> > }
> >
> > # context_teardown() - Remove a context (leave log files intact)
> > diff --git a/test/lib/util b/test/lib/util
> > index dee6c8d..72023ab 100755
> > --- a/test/lib/util
> > +++ b/test/lib/util
> > @@ -123,3 +123,11 @@ get_info_cols() {
> > __j=$((__j + 1))
> > done
> > }
> > +
> > +# wait_for() - Retry a command until it succeeds
> > +# $@: Command to run
> > +wait_for() {
> > + while ! "$@"; do
> > + sleep 0.1
>
> While at it, could we replace this with sleep 0.1 || sleep 1, just in
> case we happen to run in an environment not supporting sleep 0.1?
Good idea, I'll respin with that change.
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply other threads:[~2022-09-24 2:59 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-23 7:20 [PATCH 00/12] Assorted test fixes, batch 7 David Gibson
2022-09-23 7:20 ` [PATCH 01/12] test: Add wait_for() shell helper David Gibson
2022-09-23 23:07 ` Stefano Brivio
2022-09-24 2:59 ` David Gibson [this message]
2022-09-23 7:20 ` [PATCH 02/12] test: Remove unnecessary sleeps from layout functions David Gibson
2022-09-23 23:08 ` Stefano Brivio
2022-09-24 3:02 ` David Gibson
2022-09-23 7:20 ` [PATCH 03/12] test: Remove unnecessary sleeps from shutdown tests David Gibson
2022-09-23 7:20 ` [PATCH 04/12] test: More robust wait for pasta/passt to be ready David Gibson
2022-09-23 23:08 ` Stefano Brivio
2022-09-24 3:03 ` David Gibson
2022-09-23 7:20 ` [PATCH 05/12] test: Use --config-net for namespace setup David Gibson
2022-09-23 7:20 ` [PATCH 06/12] test: Simplify data handling for transfer tests David Gibson
2022-09-23 23:08 ` Stefano Brivio
2022-09-23 7:20 ` [PATCH 07/12] test: Remove unneccessary pane naming from layout_two_guests David Gibson
2022-09-23 7:20 ` [PATCH 08/12] clang-tidy: Disable 'readability-identifier-length' David Gibson
2022-09-23 23:08 ` Stefano Brivio
2022-09-24 3:06 ` David Gibson
2022-09-23 7:20 ` [PATCH 09/12] cppcheck: Avoid excessive scanning due to system headers David Gibson
2022-09-23 7:20 ` [PATCH 10/12] cppcheck: Run quietly David Gibson
2022-09-23 7:20 ` [PATCH 11/12] Makefile: Simplify getting target triple for compiler David Gibson
2022-09-23 7:20 ` [PATCH 12/12] cppcheck: Add target specific headers David Gibson
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=Yy5ypFOv6RmOfT7M@yekko \
--to=david@gibson.dropbear.id.au \
--cc=passt-dev@passt.top \
/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.
Code repositories for project(s) associated with this public inbox
https://passt.top/passt
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 IMAP folder(s).