test: Shellcheck - correct rule: Double quote array
Correct shellcheck rule SC2068: Double quote array expansions to avoid re-splitting elements. Signed-off-by: Maciej Wawryk <maciejx.wawryk@intel.com> Change-Id: Iefc4f0104249f4d437a66c3d9c7a195f4f6f6da3 Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/475690 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
parent
25f601cfb8
commit
fdc82d3bc8
@ -241,7 +241,7 @@ if hash shellcheck 2>/dev/null; then
|
||||
# Error descriptions can also be found at: https://github.com/koalaman/shellcheck/wiki
|
||||
# This SHCK_EXCLUDE list is out "to do" and we work to fix all of this errors.
|
||||
SHCK_EXCLUDE="SC1083,SC2002,\
|
||||
SC2010,SC2012,SC2016,SC2034,SC2045,SC2046,SC2068,SC2086,SC2089,SC2090,\
|
||||
SC2010,SC2012,SC2016,SC2034,SC2045,SC2046,SC2086,SC2089,SC2090,\
|
||||
SC2097,SC2098,SC2119,SC2120"
|
||||
# SPDK fails some error checks which have been deprecated in later versions of shellcheck.
|
||||
# We will not try to fix these error checks, but instead just leave the error types here
|
||||
|
@ -22,7 +22,7 @@ if [ -n "$1" ]; then
|
||||
driver_to_bind=$1
|
||||
fi
|
||||
|
||||
for driver in ${allowed_drivers[@]}; do
|
||||
for driver in "${allowed_drivers[@]}"; do
|
||||
if [ $driver == $driver_to_bind ]; then
|
||||
bad_driver=false
|
||||
fi
|
||||
@ -40,7 +40,7 @@ if service qat_service start; then
|
||||
fi
|
||||
|
||||
# configure virtual functions for the QAT cards.
|
||||
for qat_bdf in ${qat_pci_bdfs[@]}; do
|
||||
for qat_bdf in "${qat_pci_bdfs[@]}"; do
|
||||
echo "$num_vfs" > /sys/bus/pci/drivers/c6xx/$qat_bdf/sriov_numvfs
|
||||
num_vfs=$(cat /sys/bus/pci/drivers/c6xx/$qat_bdf/sriov_numvfs)
|
||||
echo "$qat_bdf set to $num_vfs VFs"
|
||||
@ -55,7 +55,7 @@ if (( ${#qat_vf_bdfs[@]} != ${#qat_pci_bdfs[@]}*num_vfs )); then
|
||||
fi
|
||||
|
||||
# Unbind old driver if necessary.
|
||||
for vf in ${qat_vf_bdfs[@]}; do
|
||||
for vf in "${qat_vf_bdfs[@]}"; do
|
||||
old_driver=$(basename $(readlink -f /sys/bus/pci/devices/${vf}/driver))
|
||||
if [ $old_driver != "driver" ]; then
|
||||
echo "unbinding driver $old_driver from qat VF at BDF $vf"
|
||||
@ -81,7 +81,7 @@ else
|
||||
fi
|
||||
|
||||
echo -n "8086 37c9" > /sys/bus/pci/drivers/$driver_to_bind/new_id
|
||||
for vf in ${qat_vf_bdfs[@]}; do
|
||||
for vf in "${qat_vf_bdfs[@]}"; do
|
||||
if ! ls -l /sys/bus/pci/devices/$vf/driver | grep -q $driver_to_bind; then
|
||||
echo "unable to bind the driver to the device at bdf $vf"
|
||||
if [ "$driver_to_bind" == "uio_pci_generic" ]; then
|
||||
|
@ -224,7 +224,7 @@ function configure_linux_pci {
|
||||
if ! $mount; then
|
||||
linux_bind_driver "$bdf" "$driver_name"
|
||||
else
|
||||
for name in ${blknames[@]}; do
|
||||
for name in "${blknames[@]}"; do
|
||||
pci_dev_echo "$bdf" "Active mountpoints on /dev/$name, so not binding PCI dev"
|
||||
done
|
||||
fi
|
||||
|
@ -45,7 +45,7 @@ function nbd_stop_disks() {
|
||||
local nbd_list=($2)
|
||||
local i
|
||||
|
||||
for i in ${nbd_list[@]}; do
|
||||
for i in "${nbd_list[@]}"; do
|
||||
$rootdir/scripts/rpc.py -s $rpc_server nbd_stop_disk $i
|
||||
waitfornbd_exit $(basename $i)
|
||||
done
|
||||
@ -69,12 +69,12 @@ function nbd_dd_data_verify() {
|
||||
if [ "$operation" = "write" ]; then
|
||||
# data write
|
||||
dd if=/dev/urandom of=$tmp_file bs=4096 count=256
|
||||
for i in ${nbd_list[@]}; do
|
||||
for i in "${nbd_list[@]}"; do
|
||||
dd if=$tmp_file of=$i bs=4096 count=256 oflag=direct
|
||||
done
|
||||
elif [ "$operation" = "verify" ]; then
|
||||
# data read and verify
|
||||
for i in ${nbd_list[@]}; do
|
||||
for i in "${nbd_list[@]}"; do
|
||||
cmp -b -n 1M $tmp_file $i
|
||||
done
|
||||
rm $tmp_file
|
||||
|
@ -31,7 +31,7 @@ else
|
||||
$rootdir/scripts/gen_ftl.sh -a $device -n nvme0 -l 0-3 -u $uuid > $FTL_BDEV_CONF
|
||||
fi
|
||||
|
||||
for test in ${tests[@]}; do
|
||||
for test in "${tests[@]}"; do
|
||||
timing_enter $test
|
||||
fio_bdev $testdir/config/fio/$test.fio
|
||||
timing_exit $test
|
||||
|
@ -39,7 +39,7 @@ else
|
||||
exit 1
|
||||
fi
|
||||
|
||||
for transport in ${allowed_transports[@]}; do
|
||||
for transport in "${allowed_transports[@]}"; do
|
||||
if [ $transport == "$TEST_TRANSPORT" ]; then
|
||||
bad_transport=false
|
||||
fi
|
||||
|
@ -73,11 +73,11 @@ function confirm_deps() {
|
||||
done
|
||||
IFS=$'\n'
|
||||
# Ignore any event_* dependencies. Those are based on the subsystem configuration and not readelf.
|
||||
lib_make_deps=( $(printf "%s\n" ${lib_make_deps[@]} | sort | grep -v "event_") )
|
||||
lib_make_deps=( $(printf "%s\n" "${lib_make_deps[@]}" | sort | grep -v "event_") )
|
||||
# Ignore the env_dpdk readelf dependency. We don't want people explicitly linking against it.
|
||||
dep_names=( $(printf "%s\n" ${dep_names[@]} | sort | uniq | grep -v "env_dpdk") )
|
||||
dep_names=( $(printf "%s\n" "${dep_names[@]}" | sort | uniq | grep -v "env_dpdk") )
|
||||
unset IFS
|
||||
diff=$(echo ${dep_names[@]} ${lib_make_deps[@]} | tr ' ' '\n' | sort | uniq -u)
|
||||
diff=$(echo "${dep_names[@]}" "${lib_make_deps[@]}" | tr ' ' '\n' | sort | uniq -u)
|
||||
if [ "$diff" != "" ]; then
|
||||
touch $fail_file
|
||||
echo "there was a dependency mismatch in the library $lib_shortname"
|
||||
@ -86,7 +86,7 @@ function confirm_deps() {
|
||||
echo "---------------------------------------------------------------------"
|
||||
elif [ ${#missing_syms[@]} -ne 0 ]; then
|
||||
echo "There are still undefined symbols in the library $lib_shortname"
|
||||
printf "%s\n" ${missing_syms[@]}
|
||||
printf "%s\n" "${missing_syms[@]}"
|
||||
echo "---------------------------------------------------------------------"
|
||||
fi
|
||||
}
|
||||
|
@ -261,7 +261,7 @@ function nvme_connect()
|
||||
local init_count
|
||||
init_count=$(nvme list | wc -l)
|
||||
|
||||
if ! nvme connect $@; then return $?; fi
|
||||
if ! nvme connect "$@"; then return $?; fi
|
||||
|
||||
for i in $(seq 1 10); do
|
||||
if [ $(nvme list | wc -l) -gt $init_count ]; then
|
||||
|
@ -74,8 +74,8 @@ if [ $RUN_NIGHTLY -eq 1 ]; then
|
||||
# Test perf as host with different io_size and qd_depth in nightly
|
||||
qd_depth=("1" "128")
|
||||
io_size=("512" "131072")
|
||||
for qd in ${qd_depth[@]}; do
|
||||
for o in ${io_size[@]}; do
|
||||
for qd in "${qd_depth[@]}"; do
|
||||
for o in "${io_size[@]}"; do
|
||||
$rootdir/examples/nvme/perf/perf -q $qd -o $o -w randrw -M 50 -t 10 -r "trtype:$TEST_TRANSPORT adrfam:IPv4 traddr:$NVMF_FIRST_TARGET_IP trsvcid:$NVMF_PORT"
|
||||
done
|
||||
done
|
||||
|
@ -7,7 +7,7 @@ plugindir=$rootdir/examples/bdev/fio_plugin
|
||||
source $rootdir/test/common/autotest_common.sh
|
||||
|
||||
function fio_verify(){
|
||||
fio_bdev $curdir/test.fio --aux-path=/tmp/ --ioengine=spdk_bdev $@
|
||||
fio_bdev $curdir/test.fio --aux-path=/tmp/ --ioengine=spdk_bdev "$@"
|
||||
}
|
||||
|
||||
function cleanup(){
|
||||
|
@ -7,9 +7,9 @@ source $rootdir/test/common/autotest_common.sh
|
||||
|
||||
function suite()
|
||||
{
|
||||
timing_enter $(basename $@)
|
||||
timing_enter $(basename "$@")
|
||||
run_test suite "$@"
|
||||
timing_exit $(basename $@)
|
||||
timing_exit $(basename "$@")
|
||||
}
|
||||
|
||||
timing_enter ocf
|
||||
|
@ -245,7 +245,7 @@ function vhost_rpc
|
||||
fi
|
||||
shift
|
||||
|
||||
$rootdir/scripts/rpc.py -s $(get_vhost_dir $vhost_name)/rpc.sock $@
|
||||
$rootdir/scripts/rpc.py -s $(get_vhost_dir $vhost_name)/rpc.sock "$@"
|
||||
}
|
||||
|
||||
###
|
||||
@ -854,7 +854,7 @@ function vm_run()
|
||||
vms_to_run="$(vm_list_all)"
|
||||
else
|
||||
shift $((OPTIND-1))
|
||||
for vm in $@; do
|
||||
for vm in "$@"; do
|
||||
vm_num_is_valid $1 || return 1
|
||||
if [[ ! -x $VM_DIR/$vm/run.sh ]]; then
|
||||
error "VM$vm not defined - setup it first"
|
||||
@ -927,7 +927,7 @@ function vm_wait_for_boot()
|
||||
local vms_to_check="$VM_DIR/[0-9]*"
|
||||
else
|
||||
local vms_to_check=""
|
||||
for vm in $@; do
|
||||
for vm in "$@"; do
|
||||
vms_to_check+=" $VM_DIR/$vm"
|
||||
done
|
||||
fi
|
||||
@ -992,7 +992,7 @@ function vm_start_fio_server()
|
||||
done
|
||||
|
||||
shift $(( OPTIND - 1 ))
|
||||
for vm_num in $@; do
|
||||
for vm_num in "$@"; do
|
||||
notice "Starting fio server on VM$vm_num"
|
||||
if [[ $fio_bin != "" ]]; then
|
||||
cat $fio_bin | vm_exec $vm_num 'cat > /root/fio; chmod +x /root/fio'
|
||||
@ -1056,7 +1056,7 @@ function run_fio()
|
||||
local vm
|
||||
local run_server_mode=true
|
||||
|
||||
for arg in $@; do
|
||||
for arg in "$@"; do
|
||||
case "$arg" in
|
||||
--job-file=*) local job_file="${arg#*=}" ;;
|
||||
--fio-bin=*) local fio_bin="${arg#*=}" ;;
|
||||
@ -1087,7 +1087,7 @@ function run_fio()
|
||||
local job_fname
|
||||
job_fname=$(basename "$job_file")
|
||||
# prepare job file for each VM
|
||||
for vm in ${vms[@]}; do
|
||||
for vm in "${vms[@]}"; do
|
||||
local vm_num=${vm%%:*}
|
||||
local vmdisks=${vm#*:}
|
||||
|
||||
|
@ -96,7 +96,7 @@ notice ""
|
||||
|
||||
rpc_py="$rootdir/scripts/rpc.py -s $(get_vhost_dir 0)/rpc.sock"
|
||||
|
||||
for vm_conf in ${vms[@]}; do
|
||||
for vm_conf in "${vms[@]}"; do
|
||||
IFS=',' read -ra conf <<< "$vm_conf"
|
||||
if [[ x"${conf[0]}" == x"" ]] || ! assert_number ${conf[0]}; then
|
||||
fail "invalid VM configuration syntax $vm_conf"
|
||||
@ -155,7 +155,7 @@ vm_run $used_vms
|
||||
vm_wait_for_boot 300 $used_vms
|
||||
|
||||
if [[ $test_type == "spdk_vhost_scsi" ]]; then
|
||||
for vm_conf in ${vms[@]}; do
|
||||
for vm_conf in "${vms[@]}"; do
|
||||
IFS=',' read -ra conf <<< "$vm_conf"
|
||||
while IFS=':' read -ra disks; do
|
||||
for disk in "${disks[@]}"; do
|
||||
@ -232,7 +232,7 @@ if ! $no_shutdown; then
|
||||
sleep 2
|
||||
if [[ $test_type =~ "spdk_vhost" ]]; then
|
||||
notice "Removing vhost devices & controllers via RPC ..."
|
||||
for vm_conf in ${vms[@]}; do
|
||||
for vm_conf in "${vms[@]}"; do
|
||||
IFS=',' read -ra conf <<< "$vm_conf"
|
||||
|
||||
while IFS=':' read -ra disks; do
|
||||
|
@ -82,7 +82,7 @@ function print_test_fio_header() {
|
||||
}
|
||||
|
||||
function vms_setup() {
|
||||
for vm_conf in ${vms[@]}; do
|
||||
for vm_conf in "${vms[@]}"; do
|
||||
IFS=',' read -ra conf <<< "$vm_conf"
|
||||
if [[ x"${conf[0]}" == x"" ]] || ! assert_number ${conf[0]}; then
|
||||
fail "invalid VM configuration syntax $vm_conf"
|
||||
@ -105,13 +105,13 @@ function vms_setup() {
|
||||
}
|
||||
|
||||
function vm_run_with_arg() {
|
||||
vm_run $@
|
||||
vm_wait_for_boot 300 $@
|
||||
vm_run "$@"
|
||||
vm_wait_for_boot 300 "$@"
|
||||
}
|
||||
|
||||
function vms_setup_and_run() {
|
||||
vms_setup
|
||||
vm_run_with_arg $@
|
||||
vm_run_with_arg "$@"
|
||||
}
|
||||
|
||||
function vms_prepare() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user