Kernel KVM virtualization development
 help / color / mirror / Atom feed
From: Claudio Imbrenda <imbrenda@linux.ibm.com>
To: Thomas Huth <thuth@redhat.com>
Cc: kvm@vger.kernel.org, "Nico Böhr" <nrb@linux.ibm.com>,
	"Janosch Frank" <frankja@linux.ibm.com>,
	"David Hildenbrand" <david@redhat.com>,
	linux-s390@vger.kernel.org
Subject: Re: [kvm-unit-tests RFC PATCH 3/3] scripts/arch-run.bash: Drop the dependency on "jq"
Date: Mon, 28 Jul 2025 15:59:42 +0200	[thread overview]
Message-ID: <20250728155942.0967cc2b@p-imbrenda> (raw)
In-Reply-To: <20250724133051.44045-4-thuth@redhat.com>

On Thu, 24 Jul 2025 15:30:51 +0200
Thomas Huth <thuth@redhat.com> wrote:

> From: Thomas Huth <thuth@redhat.com>
> 
> For checking whether a panic event occurred, a simple "grep"
> for the related text in the output is enough - it's very unlikely
> that the output of QEMU will change. This way we can drop the
> dependency on the program "jq" which might not be installed on
> some systems.
> 
> Signed-off-by: Thomas Huth <thuth@redhat.com>
> ---
>  Marked as "RFC" since I'm a little bit torn here - on the one side,
>  it's great to get rid of a dependency, on the other side, using
>  grep might be a little bit less robust in case QEMU ever changes
>  the layout of it's QMP output...

I share your concerns, but I'm also in favour of removing a relatively
uncommon dependency

> 
>  scripts/arch-run.bash | 8 +-------
>  1 file changed, 1 insertion(+), 7 deletions(-)
> 
> diff --git a/scripts/arch-run.bash b/scripts/arch-run.bash
> index 58e4f93f..5abf2626 100644
> --- a/scripts/arch-run.bash
> +++ b/scripts/arch-run.bash
> @@ -287,11 +287,6 @@ do_migration ()
>  
>  run_panic ()
>  {
> -	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}.in ${qmp}.out' RETURN EXIT
>  
> @@ -303,8 +298,7 @@ run_panic ()
>  		-mon chardev=mon,mode=control -S &
>  	echo '{ "execute": "qmp_capabilities" }{ "execute": "cont" }' > ${qmp}.in
>  
> -	panic_event_count=$(jq -c 'select(.event == "GUEST_PANICKED")' < ${qmp}.out | wc -l)
> -	if [ "$panic_event_count" -lt 1 ]; then
> +	if ! grep -q '"event": "GUEST_PANICKED"' ${qmp}.out ; then

maybe:
	grep -E -q '"event"[[:blank:]]*:[[:blank:]]*"GUEST PANICKED"' ...

>  		echo "FAIL: guest did not panic"
>  		ret=3
>  	else


      reply	other threads:[~2025-07-28 14:07 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 ` [kvm-unit-tests PATCH 1/3] s390x: Fix unreliable " Thomas Huth
2025-07-28 14:03   ` 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 [this message]

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=20250728155942.0967cc2b@p-imbrenda \
    --to=imbrenda@linux.ibm.com \
    --cc=david@redhat.com \
    --cc=frankja@linux.ibm.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=nrb@linux.ibm.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox