@@ -130,17 +130,15 @@ fi
cat << EOF > lib-test.c
__UINT32_TYPE__
EOF
-u32_long=$($cross_prefix$cc -E lib-test.c | grep -v '^#' | grep -q long && echo yes)
+u32_long=$("$cross_prefix$cc" -E lib-test.c | grep -v '^#' | grep -q long && echo yes)
rm -f lib-test.c
# api/: check for dependent 32 bit libraries and gnu++11 support
if [ "$testdir" = "x86" ]; then
echo 'int main () {}' > lib-test.c
- $cc -m32 -o /dev/null -lstdc++ -lpthread -lrt lib-test.c &> /dev/null
- exit=$?
- $cxx -m32 -o /dev/null -std=gnu++11 lib-test.c &> /dev/null
- if [ $? -eq 0 -a $exit -eq 0 ]; then
- api=true
+ if $cc -m32 -o /dev/null -lstdc++ -lpthread -lrt lib-test.c &> /dev/null &&
+ $cxx -m32 -o /dev/null -std=gnu++11 lib-test.c &> /dev/null; then
+ api=yes
fi
rm -f lib-test.c
fi
@@ -163,7 +161,7 @@ fi
# link lib/asm for the architecture
rm -f lib/asm
-asm=asm-generic
+asm="asm-generic"
if [ -d "$srcdir/lib/$arch/asm" ]; then
asm="$srcdir/lib/$arch/asm"
elif [ -d "$srcdir/lib/$testdir/asm" ]; then
@@ -28,7 +28,7 @@ run_qemu ()
{
local stdout errors ret sig
- echo -n $@
+ echo -n "$@"
initrd_create &&
echo -n " #"
echo " $INITRD"
@@ -107,7 +107,7 @@ qmp ()
run_migration ()
{
if ! command -v nc >/dev/null 2>&1; then
- echo "$FUNCNAME needs nc (netcat)" >&2
+ echo "${FUNCNAME[0]} needs nc (netcat)" >&2
exit 2
fi
@@ -229,8 +229,8 @@ env_generate_errata ()
local kernel_version kernel_patchlevel kernel_sublevel kernel_extraversion
local line commit minver errata rest v p s x have
- IFS=. read kernel_version kernel_patchlevel rest <<<$kernel_version_string
- IFS=- read kernel_sublevel kernel_extraversion <<<$rest
+ IFS=. read -r kernel_version kernel_patchlevel rest <<<$kernel_version_string
+ IFS=- read -r kernel_sublevel kernel_extraversion <<<$rest
kernel_sublevel=${kernel_sublevel%%[!0-9]*}
kernel_extraversion=${kernel_extraversion%%[!0-9]*}
@@ -247,8 +247,8 @@ env_generate_errata ()
errata="ERRATA_$commit"
test -v $errata && continue
- IFS=. read v p rest <<<$minver
- IFS=- read s x <<<$rest
+ IFS=. read -r v p rest <<<$minver
+ IFS=- read -r s x <<<$rest
s=${s%%[!0-9]*}
x=${x%%[!0-9]*}
@@ -305,8 +305,8 @@ kvm_available ()
return 1
[ "$HOST" = "$ARCH_NAME" ] ||
- [ "$HOST" = aarch64 -a "$ARCH" = arm ] ||
- [ "$HOST" = x86_64 -a "$ARCH" = i386 ]
+ ( [ "$HOST" = aarch64 ] && [ "$ARCH" = arm ] ) ||
+ ( [ "$HOST" = x86_64 ] && [ "$ARCH" = i386 ] )
}
get_qemu_accelerator ()
@@ -15,7 +15,7 @@ function for_each_unittest()
exec {fd}<"$unittests"
- while read -u $fd line; do
+ while read -r -u $fd line; do
if [[ "$line" =~ ^\[(.*)\]$ ]]; then
"$cmd" "$testname" "$groups" "$smp" "$kernel" "$opts" "$arch" "$check" "$accel" "$timeout"
testname=${BASH_REMATCH[1]}
@@ -38,7 +38,7 @@ skip_nodefault()
[ "$STANDALONE" != "yes" ] && return 0
while true; do
- read -p "Test marked not to be run by default, are you sure (y/N)? " yn
+ read -r -p "Test marked not to be run by default, are you sure (y/N)? " yn
case $yn in
"Y" | "y" | "Yes" | "yes")
return 1
@@ -84,7 +84,7 @@ function run()
# check a file for a particular value before running a test
# 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>
- for check_param in ${check[@]}; do
+ for check_param in "${check[@]}"; do
path=${check_param%%=*}
value=${check_param#*=}
if [ "$path" ] && [ "$(cat $path)" != "$value" ]; then
@@ -37,7 +37,7 @@ else
pc_testdev="-device testdev,chardev=testlog -chardev file,id=testlog,path=msr.out"
fi
-command="${qemu} -nodefaults $pc_testdev -vnc none -serial stdio $pci_testdev $hyperv_testdev"
+command="${qemu} -nodefaults $pc_testdev -vnc none -serial stdio $pci_testdev"
command+=" -machine accel=$ACCEL -kernel"
command="$(timeout_cmd) $command"
Checked all the bash scripts with shellcheck --shell=bash checking with and without the following exclude list --exclude=SC1091,SC2004,SC2006,SC2086,SC2143,SC2155 Even with the exclude list there were some warnings not fixed with this patch, but those are OK. Signed-off-by: Andrew Jones <drjones@redhat.com> --- configure | 12 +++++------- scripts/arch-run.bash | 16 ++++++++-------- scripts/common.bash | 2 +- scripts/runtime.bash | 4 ++-- x86/run | 2 +- 5 files changed, 17 insertions(+), 19 deletions(-)