linux-s390.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Huth <thuth@redhat.com>
To: kvm@vger.kernel.org, "Nico Böhr" <nrb@linux.ibm.com>
Cc: Claudio Imbrenda <imbrenda@linux.ibm.com>,
	Janosch Frank <frankja@linux.ibm.com>,
	David Hildenbrand <david@redhat.com>,
	linux-s390@vger.kernel.org
Subject: [kvm-unit-tests PATCH 1/3] s390x: Fix unreliable panic-loop tests
Date: Thu, 24 Jul 2025 15:30:49 +0200	[thread overview]
Message-ID: <20250724133051.44045-2-thuth@redhat.com> (raw)
In-Reply-To: <20250724133051.44045-1-thuth@redhat.com>

From: Thomas Huth <thuth@redhat.com>

In our CI, the s390x panic-loop-extint and panic-loop-pgm tests
are sometimes failing. Having a closer look, this seems to be caused
by ncat sometimes complaining about "Connection reset by peer" on stderr,
likely because QEMU terminated (due to the panic) before ncat could
properly tear down the connection. But having some output on stderr is
interpreted as test failure in qemu_fixup_return_code(), so the test is
marked as failed, even though the panic event occurred as expected.

To fix it, drop the usage of ncat here and simply handle the QMP
input and output via normal fifos instead. This has also the advantage
that we do not need an additional program for these tests anymore
that might not be available in the installation.

Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 scripts/arch-run.bash | 21 +++++----------------
 1 file changed, 5 insertions(+), 16 deletions(-)

diff --git a/scripts/arch-run.bash b/scripts/arch-run.bash
index c440f216..58e4f93f 100644
--- a/scripts/arch-run.bash
+++ b/scripts/arch-run.bash
@@ -63,14 +63,6 @@ qmp ()
 	echo '{ "execute": "qmp_capabilities" }{ "execute":' "$2" '}' | ncat -U $1
 }
 
-qmp_events ()
-{
-	while ! test -S "$1"; do sleep 0.1; done
-	echo '{ "execute": "qmp_capabilities" }{ "execute": "cont" }' |
-		ncat --no-shutdown -U $1 |
-		jq -c 'select(has("event"))'
-}
-
 filter_quiet_msgs ()
 {
 	grep -v "Now migrate the VM (quiet)" |
@@ -295,26 +287,23 @@ do_migration ()
 
 run_panic ()
 {
-	if ! command -v ncat >/dev/null 2>&1; then
-		echo "${FUNCNAME[0]} needs ncat (netcat)" >&2
-		return 77
-	fi
-
 	if ! command -v jq >/dev/null 2>&1; then
 		echo "${FUNCNAME[0]} needs jq" >&2
 		return 77
 	fi
 
 	trap 'trap - TERM ; kill 0 ; exit 2' INT TERM
-	trap 'rm -f ${qmp}' RETURN EXIT
+	trap 'rm -f ${qmp}.in ${qmp}.out' RETURN EXIT
 
 	qmp=$(mktemp -u -t panic-qmp.XXXXXXXXXX)
+	mkfifo ${qmp}.in ${qmp}.out
 
 	# start VM stopped so we don't miss any events
-	"$@" -chardev socket,id=mon,path=${qmp},server=on,wait=off \
+	"$@" -chardev pipe,id=mon,path=${qmp} \
 		-mon chardev=mon,mode=control -S &
+	echo '{ "execute": "qmp_capabilities" }{ "execute": "cont" }' > ${qmp}.in
 
-	panic_event_count=$(qmp_events ${qmp} | jq -c 'select(.event == "GUEST_PANICKED")' | wc -l)
+	panic_event_count=$(jq -c 'select(.event == "GUEST_PANICKED")' < ${qmp}.out | wc -l)
 	if [ "$panic_event_count" -lt 1 ]; then
 		echo "FAIL: guest did not panic"
 		ret=3
-- 
2.50.1


  reply	other threads:[~2025-07-24 13:31 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-24 13:30 [kvm-unit-tests PATCH 0/3] Improvements for the s390x panic-loop tests Thomas Huth
2025-07-24 13:30 ` Thomas Huth [this message]
2025-07-28 14:03   ` [kvm-unit-tests PATCH 1/3] s390x: Fix unreliable " Claudio Imbrenda
2025-07-24 13:30 ` [kvm-unit-tests PATCH 2/3] .gitlab-ci.yml: Add the s390x panic-loop tests to the CI Thomas Huth
2025-07-28 14:00   ` Claudio Imbrenda
2025-07-24 13:30 ` [kvm-unit-tests RFC PATCH 3/3] scripts/arch-run.bash: Drop the dependency on "jq" Thomas Huth
2025-07-28 13:59   ` Claudio Imbrenda

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=20250724133051.44045-2-thuth@redhat.com \
    --to=thuth@redhat.com \
    --cc=david@redhat.com \
    --cc=frankja@linux.ibm.com \
    --cc=imbrenda@linux.ibm.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=nrb@linux.ibm.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;
as well as URLs for NNTP newsgroup(s).