Commit 25f601cf authored by Maciej Wawryk's avatar Maciej Wawryk Committed by Tomasz Zawadzki
Browse files

test: Shellcheck - correct rule: Expanding an array



Correct shellcheck rule SC2128: Expanding an array without an index only gives the first element.

Signed-off-by: default avatarMaciej Wawryk <maciejx.wawryk@intel.com>
Change-Id: I0e7c335af678114dc78dfb12a02369a69158e435
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/474989


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Reviewed-by: default avatarSeth Howell <seth.howell@intel.com>
Reviewed-by: default avatarKarol Latecki <karol.latecki@intel.com>
parent 97b0f773
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -242,7 +242,7 @@ if hash shellcheck 2>/dev/null; then
	# 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,\
SC2097,SC2098,SC2119,SC2120,SC2128"
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
	# so that we can still run with older versions of shellcheck.
+2 −2
Original line number Diff line number Diff line
@@ -264,7 +264,7 @@ function configure_linux_pci {
			fi
			blknames=()
			get_virtio_names_from_bdf "$bdf" blknames
			for blkname in $blknames; do
			for blkname in "${blknames[@]}"; do
				if [ "$(lsblk /dev/$blkname --output MOUNTPOINT -n | wc -w)" != "0" ]; then
					pci_dev_echo "$bdf" "Active mountpoints on /dev/$blkname, so not binding"
					continue 2
@@ -612,7 +612,7 @@ function status_linux {
			vendor=$(cat /sys/bus/pci/devices/$bdf/vendor)
			blknames=()
			get_virtio_names_from_bdf "$bdf" blknames
			echo -e "$bdf\t${vendor#0x}\t${device#0x}\t$node\t\t${driver:--}\t\t$blknames"
			echo -e "$bdf\t${vendor#0x}\t${device#0x}\t$node\t\t${driver:--}\t\t" "${blknames[@]}"
		done
	done

+1 −1
Original line number Diff line number Diff line
@@ -132,7 +132,7 @@ shift "$((OPTIND-1))" # Discard the options and sentinel --

SPDK_VAGRANT_DISTRO=( "$@" )

case "$SPDK_VAGRANT_DISTRO" in
case "${SPDK_VAGRANT_DISTRO[0]}" in
	centos7)
		export SPDK_VAGRANT_DISTRO
	;;
+2 −1
Original line number Diff line number Diff line
@@ -70,9 +70,10 @@ export INSTALL_DEPS


shift "$((OPTIND-1))"   # Discard the options and sentinel --

SPDK_VAGRANT_DISTRO=( "$@" )

case "$SPDK_VAGRANT_DISTRO" in
case "${SPDK_VAGRANT_DISTRO[0]}" in
	ubuntu16)
		export SPDK_VAGRANT_DISTRO
	;;
+19 −19
Original line number Diff line number Diff line
@@ -42,7 +42,7 @@ RE_UUID="[[:alnum:]-]+"
last_event_id=0

function tgt_check_notification_types() {
	timing_enter $FUNCNAME
	timing_enter "${FUNCNAME[0]}"

	local ret=0
	local enabled_types="bdev_register
@@ -54,7 +54,7 @@ function tgt_check_notification_types() {
		ret=1
	fi

	timing_exit $FUNCNAME
	timing_exit "${FUNCNAME[0]}"
	return $ret
}

@@ -147,7 +147,7 @@ function json_config_test_shutdown_app() {
}

function create_bdev_subsystem_config() {
	timing_enter $FUNCNAME
	timing_enter "${FUNCNAME[0]}"

	local expected_notifications=()

@@ -159,7 +159,7 @@ function create_bdev_subsystem_config() {
				echo "WARNING: No NVMe drive found. Using '$lvol_store_base_bdev' instead."
			else
				echo "ERROR: No NVMe drive found and bdev_aio is not supported on $(uname -s)."
				timing_exit $FUNCNAME
				timing_exit "${FUNCNAME[0]}"
				return 1
			fi
		fi
@@ -243,11 +243,11 @@ function create_bdev_subsystem_config() {

	tgt_check_notifications "${expected_notifications[@]}"

	timing_exit $FUNCNAME
	timing_exit "${FUNCNAME[0]}"
}

function cleanup_bdev_subsystem_config() {
	timing_enter $FUNCNAME
	timing_enter "${FUNCNAME[0]}"

	if [[ $SPDK_TEST_BLOCKDEV -eq 1 ]]; then
		tgt_rpc bdev_lvol_delete     lvs_test/clone0
@@ -270,11 +270,11 @@ function cleanup_bdev_subsystem_config() {
		rbd_cleanup
	fi

	timing_exit $FUNCNAME
	timing_exit "${FUNCNAME[0]}"
}

function create_vhost_subsystem_config() {
	timing_enter $FUNCNAME
	timing_enter "${FUNCNAME[0]}"

	tgt_rpc bdev_malloc_create 64 1024 --name MallocForVhost0
	tgt_rpc bdev_split_create MallocForVhost0 8
@@ -290,20 +290,20 @@ function create_vhost_subsystem_config() {
#	tgt_rpc vhost_create_nvme_controller   VhostNvmeCtrlr0 16
#	tgt_rpc vhost_nvme_controller_add_ns                 VhostNvmeCtrlr0 MallocForVhost0p6

	timing_exit $FUNCNAME
	timing_exit "${FUNCNAME[0]}"
}

function create_iscsi_subsystem_config() {
	timing_enter $FUNCNAME
	timing_enter "${FUNCNAME[0]}"
	tgt_rpc bdev_malloc_create 64 1024 --name MallocForIscsi0
	tgt_rpc iscsi_create_portal_group $PORTAL_TAG 127.0.0.1:$ISCSI_PORT
	tgt_rpc iscsi_create_initiator_group $INITIATOR_TAG $INITIATOR_NAME $NETMASK
	tgt_rpc iscsi_create_target_node Target3 Target3_alias 'MallocForIscsi0:0' $PORTAL_TAG:$INITIATOR_TAG 64 -d
	timing_exit $FUNCNAME
	timing_exit "${FUNCNAME[0]}"
}

function create_nvmf_subsystem_config() {
	timing_enter $FUNCNAME
	timing_enter "${FUNCNAME[0]}"

	RDMA_IP_LIST=$(get_available_rdma_ips)
	NVMF_FIRST_TARGET_IP=$(echo "$RDMA_IP_LIST" | head -n 1)
@@ -321,21 +321,21 @@ function create_nvmf_subsystem_config() {
	tgt_rpc nvmf_subsystem_add_ns       nqn.2016-06.io.spdk:cnode1 MallocForNvmf1
	tgt_rpc nvmf_subsystem_add_listener nqn.2016-06.io.spdk:cnode1 -t RDMA -a $NVMF_FIRST_TARGET_IP -s "$NVMF_PORT"

	timing_exit $FUNCNAME
	timing_exit "${FUNCNAME[0]}"
}

function create_virtio_initiator_config() {
	timing_enter $FUNCNAME
	timing_enter "${FUNCNAME[0]}"
	initiator_rpc bdev_virtio_attach_controller -t user -a /var/tmp/VhostScsiCtrlr0 -d scsi VirtioScsiCtrlr0
	initiator_rpc bdev_virtio_attach_controller -t user -a /var/tmp/VhostBlkCtrlr0  -d blk  VirtioBlk0
	# TODO: initiator_rpc bdev_virtio_attach_controller -t user -a /var/tmp/VhostNvmeCtrlr0 -d nvme VirtioNvme0
	timing_exit $FUNCNAME
	timing_exit "${FUNCNAME[0]}"
}


function json_config_test_init()
{
	timing_enter $FUNCNAME
	timing_enter "${FUNCNAME[0]}"
	timing_enter json_config_setup_target

	json_config_test_start_app target --wait-for-rpc
@@ -375,11 +375,11 @@ function json_config_test_init()

	tgt_rpc bdev_malloc_create 8 512 --name MallocBdevForConfigChangeCheck

	timing_exit $FUNCNAME
	timing_exit "${FUNCNAME[0]}"
}

function json_config_test_fini() {
	timing_enter $FUNCNAME
	timing_enter "${FUNCNAME[0]}"
	local ret=0

	if [[ -n "${app_pid[initiator]}" ]]; then
@@ -396,7 +396,7 @@ function json_config_test_fini() {
	fi

	rm -f "${configs_path[@]}"
	timing_exit $FUNCNAME
	timing_exit "${FUNCNAME[0]}"
	return $ret
}

Loading