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@xxxxxxxxx> --- 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