From: Eric Blake <eblake@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Daniel P. Berrangé" <berrange@redhat.com>,
"Kevin Wolf" <kwolf@redhat.com>, "Max Reitz" <mreitz@redhat.com>,
"open list:Block layer core" <qemu-block@nongnu.org>
Subject: [Qemu-devel] [PULL 08/12] tests: check if qemu-nbd is still alive before waiting
Date: Mon, 19 Nov 2018 11:54:23 -0600 [thread overview]
Message-ID: <20181119175427.2298497-9-eblake@redhat.com> (raw)
In-Reply-To: <20181119175427.2298497-1-eblake@redhat.com>
From: Daniel P. Berrangé <berrange@redhat.com>
If the qemu-nbd UNIX socket has not shown up, the tests will sleep a bit
and then check again repeatedly for up to 30 seconds. This is pointless
if the qemu-nbd process has quit due to an error, so check whether the
pid is still alive before waiting and retrying.
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Message-Id: <20181116155325.22428-5-berrange@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
---
tests/qemu-iotests/common.nbd | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/tests/qemu-iotests/common.nbd b/tests/qemu-iotests/common.nbd
index 27357f3151d..9f841ab4029 100644
--- a/tests/qemu-iotests/common.nbd
+++ b/tests/qemu-iotests/common.nbd
@@ -37,11 +37,19 @@ function nbd_server_stop()
function nbd_server_wait_for_unix_socket()
{
+ pid=$1
+
for ((i = 0; i < 300; i++))
do
if [ -r "$nbd_unix_socket" ]; then
return
fi
+ kill -s 0 $pid 2>/dev/null
+ if test $? != 0
+ then
+ echo "qemu-nbd unexpectedly quit"
+ exit 1
+ fi
sleep 0.1
done
echo "Failed in check of unix socket created by qemu-nbd"
@@ -52,5 +60,5 @@ function nbd_server_start_unix_socket()
{
nbd_server_stop
$QEMU_NBD -v -t -k "$nbd_unix_socket" "$@" &
- nbd_server_wait_for_unix_socket
+ nbd_server_wait_for_unix_socket $!
}
--
2.17.2
next prev parent reply other threads:[~2018-11-19 17:54 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-19 17:54 [Qemu-devel] [PULL 00/12] NBD patches for 3.1-rc2 Eric Blake
2018-11-19 17:54 ` [Qemu-devel] [PULL 01/12] qemu-iotests: remove unused variable 'here' Eric Blake
2018-11-19 17:54 ` [Qemu-devel] [PULL 02/12] qemu-iotests: convert `pwd` and $(pwd) to $PWD Eric Blake
2018-11-19 17:54 ` [Qemu-devel] [PULL 03/12] qemu-iotests: Modern shell scripting (use $() instead of ``) Eric Blake
2018-11-19 17:54 ` [Qemu-devel] [PULL 04/12] nbd: fix whitespace in server error message Eric Blake
2018-11-19 17:54 ` [Qemu-devel] [PULL 05/12] nbd/server: Ignore write errors when replying to NBD_OPT_ABORT Eric Blake
2018-11-19 17:54 ` [Qemu-devel] [PULL 06/12] io: return 0 for EOF in TLS session read after shutdown Eric Blake
2018-11-19 17:54 ` [Qemu-devel] [PULL 07/12] tests: pull qemu-nbd iotest helpers into common.nbd file Eric Blake
2018-11-19 17:54 ` Eric Blake [this message]
2018-11-19 17:54 ` [Qemu-devel] [PULL 09/12] tests: add iotests helpers for dealing with TLS certificates Eric Blake
2018-11-19 17:54 ` [Qemu-devel] [PULL 10/12] tests: exercise NBD server in TLS mode Eric Blake
2018-11-19 17:54 ` [Qemu-devel] [PULL 11/12] iotests: Also test I/O over NBD TLS Eric Blake
2018-11-19 17:54 ` [Qemu-devel] [PULL 12/12] iotests: Drop use of bash keyword 'function' Eric Blake
2018-11-20 10:20 ` [Qemu-devel] [PULL 00/12] NBD patches for 3.1-rc2 Peter Maydell
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=20181119175427.2298497-9-eblake@redhat.com \
--to=eblake@redhat.com \
--cc=berrange@redhat.com \
--cc=kwolf@redhat.com \
--cc=mreitz@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.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).