From: Nicholas Piggin <npiggin@gmail.com>
To: kvm@vger.kernel.org
Cc: Nicholas Piggin <npiggin@gmail.com>,
Paolo Bonzini <pbonzini@redhat.com>,
Thomas Huth <thuth@redhat.com>, Nico Boehr <nrb@linux.ibm.com>
Subject: [kvm-unit-tests PATCH 2/3] migration: Fix test harness hang if source does not reach migration point
Date: Tue, 25 Jul 2023 13:39:36 +1000 [thread overview]
Message-ID: <20230725033937.277156-3-npiggin@gmail.com> (raw)
In-Reply-To: <20230725033937.277156-1-npiggin@gmail.com>
After starting the test, the harness waits polling for "migrate" in the
output. If the test does not print for some reason, the harness hangs.
Test that the pid is still alive while polling to fix this hang.
While here, wait for the full string "Now migrate the VM", which I think
makes it more obvious to read and could avoid an unfortunate collision
with some debugging output in a test case.
Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
---
scripts/arch-run.bash | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/scripts/arch-run.bash b/scripts/arch-run.bash
index 518607f4..30e535c7 100644
--- a/scripts/arch-run.bash
+++ b/scripts/arch-run.bash
@@ -142,6 +142,7 @@ run_migration ()
eval "$@" -chardev socket,id=mon1,path=${qmp1},server=on,wait=off \
-mon chardev=mon1,mode=control | tee ${migout1} &
+ live_pid=`jobs -l %+ | grep "eval" | awk '{print$2}'`
# We have to use cat to open the named FIFO, because named FIFO's, unlike
# pipes, will block on open() until the other end is also opened, and that
@@ -152,7 +153,14 @@ run_migration ()
incoming_pid=`jobs -l %+ | awk '{print$2}'`
# The test must prompt the user to migrate, so wait for the "migrate" keyword
- while ! grep -q -i "migrate" < ${migout1} ; do
+ while ! grep -q -i "Now migrate the VM" < ${migout1} ; do
+ if ! ps -p ${live_pid} > /dev/null ; then
+ echo "ERROR: Test exit before migration point." >&2
+ echo > ${fifo}
+ qmp ${qmp1} '"quit"'> ${qmpout1} 2>/dev/null
+ qmp ${qmp2} '"quit"'> ${qmpout2} 2>/dev/null
+ return 3
+ fi
sleep 1
done
--
2.40.1
next prev parent reply other threads:[~2023-07-25 3:39 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-25 3:39 [kvm-unit-tests PATCH 0/3] migration: fixes and multiple migration Nicholas Piggin
2023-07-25 3:39 ` [kvm-unit-tests PATCH 1/3] migration: Fix test harness hang on fifo Nicholas Piggin
2023-07-28 7:20 ` Nico Boehr
2023-07-25 3:39 ` Nicholas Piggin [this message]
2023-07-28 7:34 ` [kvm-unit-tests PATCH 2/3] migration: Fix test harness hang if source does not reach migration point Nico Boehr
2023-07-30 10:03 ` Nicholas Piggin
2023-09-25 11:14 ` Nico Boehr
2023-10-16 18:32 ` Thomas Huth
2023-10-19 7:55 ` Nico Boehr
2023-10-19 8:10 ` Thomas Huth
2023-07-25 3:39 ` [kvm-unit-tests PATCH 3/3] arch-run: Support multiple migrations Nicholas Piggin
2023-07-28 8:44 ` [kvm-unit-tests PATCH 0/3] migration: fixes and multiple migration Shaoqin Huang
2023-07-30 10:06 ` Nicholas Piggin
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=20230725033937.277156-3-npiggin@gmail.com \
--to=npiggin@gmail.com \
--cc=kvm@vger.kernel.org \
--cc=nrb@linux.ibm.com \
--cc=pbonzini@redhat.com \
--cc=thuth@redhat.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.