From: Nicholas Piggin <npiggin@gmail.com>
To: Andrew Jones <andrew.jones@linux.dev>
Cc: "Nicholas Piggin" <npiggin@gmail.com>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Thomas Huth" <thuth@redhat.com>,
"Alexandru Elisei" <alexandru.elisei@arm.com>,
"Eric Auger" <eric.auger@redhat.com>,
"Janosch Frank" <frankja@linux.ibm.com>,
"Claudio Imbrenda" <imbrenda@linux.ibm.com>,
"Nico Böhr" <nrb@linux.ibm.com>,
"David Hildenbrand" <david@redhat.com>,
"Shaoqin Huang" <shahuang@redhat.com>,
"Nikos Nikoleris" <nikos.nikoleris@arm.com>,
"David Woodhouse" <dwmw@amazon.co.uk>,
"Ricardo Koller" <ricarkol@google.com>,
rminmin <renmm6@chinaunicom.cn>, "Gavin Shan" <gshan@redhat.com>,
"Nina Schoetterl-Glausch" <nsg@linux.ibm.com>,
"Sean Christopherson" <seanjc@google.com>,
kvm@vger.kernel.org, kvmarm@lists.linux.dev,
kvm-riscv@lists.infradead.org, linux-s390@vger.kernel.org
Subject: [kvm-unit-tests PATCH v3 5/5] shellcheck: Suppress various messages
Date: Wed, 1 May 2024 21:29:34 +1000 [thread overview]
Message-ID: <20240501112938.931452-6-npiggin@gmail.com> (raw)
In-Reply-To: <20240501112938.931452-1-npiggin@gmail.com>
Various info and warnings are suppressed here, where circumstances
(commented) warrant.
Reviewed-by: Andrew Jones <andrew.jones@linux.dev>
Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
---
configure | 2 ++
run_tests.sh | 3 +++
scripts/arch-run.bash | 15 +++++++++++++++
scripts/mkstandalone.sh | 2 ++
scripts/runtime.bash | 2 ++
5 files changed, 24 insertions(+)
diff --git a/configure b/configure
index 49f047cb2..e13a346d3 100755
--- a/configure
+++ b/configure
@@ -422,6 +422,8 @@ ln -sf "$asm" lib/asm
# create the config
cat <<EOF > config.mak
+# Shellcheck does not see these are used
+# shellcheck disable=SC2034
SRCDIR=$srcdir
PREFIX=$prefix
HOST=$host
diff --git a/run_tests.sh b/run_tests.sh
index 938bb8edf..152323ffc 100755
--- a/run_tests.sh
+++ b/run_tests.sh
@@ -45,6 +45,9 @@ fi
only_tests=""
list_tests=""
args=$(getopt -u -o ag:htj:vl -l all,group:,help,tap13,parallel:,verbose,list,probe-maxsmp -- "$@")
+# Shellcheck likes to test commands directly rather than with $? but sometimes they
+# are too long to put in the same test.
+# shellcheck disable=SC2181
[ $? -ne 0 ] && exit 2;
set -- $args;
while [ $# -gt 0 ]; do
diff --git a/scripts/arch-run.bash b/scripts/arch-run.bash
index 98d29b671..8643bab3b 100644
--- a/scripts/arch-run.bash
+++ b/scripts/arch-run.bash
@@ -44,6 +44,8 @@ run_qemu ()
if [ "$errors" ]; then
sig=$(grep 'terminating on signal' <<<"$errors")
if [ "$sig" ]; then
+ # This is too complex for ${var/search/replace}
+ # shellcheck disable=SC2001
sig=$(sed 's/.*terminating on signal \([0-9][0-9]*\).*/\1/' <<<"$sig")
fi
fi
@@ -174,9 +176,12 @@ run_migration ()
# Holding both ends of the input fifo open prevents opens from
# blocking and readers getting EOF when a writer closes it.
+ # These fds appear to be unused to shellcheck so quieten the warning.
mkfifo ${src_infifo}
mkfifo ${dst_infifo}
+ # shellcheck disable=SC2034
exec {src_infifo_fd}<>${src_infifo}
+ # shellcheck disable=SC2034
exec {dst_infifo_fd}<>${dst_infifo}
"${migcmdline[@]}" \
@@ -184,6 +189,9 @@ run_migration ()
-mon chardev=mon,mode=control \
< ${src_infifo} > ${src_outfifo} &
live_pid=$!
+ # Shellcheck complains about useless cat but it is clearer than a
+ # redirect in this case.
+ # shellcheck disable=SC2002
cat ${src_outfifo} | tee ${src_out} | filter_quiet_msgs &
# Start the first destination QEMU machine in advance of the test
@@ -224,6 +232,9 @@ do_migration ()
-mon chardev=mon,mode=control -incoming unix:${dst_incoming} \
< ${dst_infifo} > ${dst_outfifo} &
incoming_pid=$!
+ # Shellcheck complains about useless cat but it is clearer than a
+ # redirect in this case.
+ # shellcheck disable=SC2002
cat ${dst_outfifo} | tee ${dst_out} | filter_quiet_msgs &
# The test must prompt the user to migrate, so wait for the
@@ -467,6 +478,8 @@ env_params ()
[ -n "$ACCEL" ] && QEMU_ACCEL=$ACCEL
fi
QEMU_VERSION_STRING="$($qemu -h | head -1)"
+ # Shellcheck does not see QEMU_MAJOR|MINOR|MICRO are used
+ # shellcheck disable=SC2034
IFS='[ .]' read -r _ _ _ QEMU_MAJOR QEMU_MINOR QEMU_MICRO rest <<<"$QEMU_VERSION_STRING"
fi
env_add_params QEMU_ACCEL QEMU_VERSION_STRING QEMU_MAJOR QEMU_MINOR QEMU_MICRO
@@ -597,6 +610,8 @@ hvf_available ()
set_qemu_accelerator ()
{
+ # Shellcheck does not see ACCEL_PROPS is used
+ # shellcheck disable=SC2034
ACCEL_PROPS=${ACCEL#"${ACCEL%%,*}"}
ACCEL=${ACCEL%%,*}
diff --git a/scripts/mkstandalone.sh b/scripts/mkstandalone.sh
index 756647f29..2318a85f0 100755
--- a/scripts/mkstandalone.sh
+++ b/scripts/mkstandalone.sh
@@ -65,6 +65,8 @@ generate_test ()
fi
temp_file bin "$kernel"
+ # Don't want to expand $bin but print it as-is.
+ # shellcheck disable=SC2016
args[3]='$bin'
(echo "#!/usr/bin/env bash"
diff --git a/scripts/runtime.bash b/scripts/runtime.bash
index 597c90991..fb7c83a25 100644
--- a/scripts/runtime.bash
+++ b/scripts/runtime.bash
@@ -127,6 +127,8 @@ function run()
# the check line can contain multiple files to check separated by a space
# but each check parameter needs to be of the form <path>=<value>
if [ "$check" ]; then
+ # There is no globbing or whitespace allowed in check parameters.
+ # shellcheck disable=SC2206
check=($check)
for check_param in "${check[@]}"; do
path=${check_param%%=*}
--
2.43.0
next prev parent reply other threads:[~2024-05-01 11:30 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-01 11:29 [kvm-unit-tests PATCH v3 0/5] add shellcheck support Nicholas Piggin
2024-05-01 11:29 ` [kvm-unit-tests PATCH v3 1/5] Add initial shellcheck checking Nicholas Piggin
2024-05-01 11:29 ` [kvm-unit-tests PATCH v3 2/5] shellcheck: Fix SC2155 Nicholas Piggin
2024-05-01 11:29 ` [kvm-unit-tests PATCH v3 3/5] shellcheck: Fix SC2124 Nicholas Piggin
2024-05-01 11:29 ` [kvm-unit-tests PATCH v3 4/5] shellcheck: Fix SC2294 Nicholas Piggin
2024-05-01 11:29 ` Nicholas Piggin [this message]
2024-05-02 8:12 ` [kvm-unit-tests PATCH v3 0/5] add shellcheck support Andrew Jones
2024-05-02 8:23 ` Thomas Huth
2024-05-02 8:56 ` Andrew Jones
2024-05-02 9:34 ` Thomas Huth
2024-05-02 9:48 ` Andrew Jones
2024-05-03 5:02 ` Nicholas Piggin
2024-05-03 5:13 ` Thomas Huth
2024-05-07 4:26 ` Nicholas Piggin
2024-05-03 5:11 ` 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=20240501112938.931452-6-npiggin@gmail.com \
--to=npiggin@gmail.com \
--cc=alexandru.elisei@arm.com \
--cc=andrew.jones@linux.dev \
--cc=david@redhat.com \
--cc=dwmw@amazon.co.uk \
--cc=eric.auger@redhat.com \
--cc=frankja@linux.ibm.com \
--cc=gshan@redhat.com \
--cc=imbrenda@linux.ibm.com \
--cc=kvm-riscv@lists.infradead.org \
--cc=kvm@vger.kernel.org \
--cc=kvmarm@lists.linux.dev \
--cc=linux-s390@vger.kernel.org \
--cc=nikos.nikoleris@arm.com \
--cc=nrb@linux.ibm.com \
--cc=nsg@linux.ibm.com \
--cc=pbonzini@redhat.com \
--cc=renmm6@chinaunicom.cn \
--cc=ricarkol@google.com \
--cc=seanjc@google.com \
--cc=shahuang@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox