@@ -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
@@ -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
@@ -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%%,*}
@@ -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"
@@ -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%%=*}