diff --git a/scripts/check_format.sh b/scripts/check_format.sh index 8cbaeb0ad..3b3e66bc1 100755 --- a/scripts/check_format.sh +++ b/scripts/check_format.sh @@ -209,7 +209,7 @@ elif hash pep8 2>/dev/null; then PEP8=pep8 fi -if [ ! -z ${PEP8} ]; then +if [ -n "${PEP8}" ]; then echo -n "Checking Python style..." PEP8_ARGS+=" --max-line-length=140" @@ -243,11 +243,11 @@ if hash shellcheck 2>/dev/null; then SC1083,SC1087,SC1090,SC1091,SC1113,SC2001,SC2002,SC2003,SC2004,SC2005,\ SC2007,SC2009,SC2010,SC2012,SC2013,SC2015,SC2016,SC2018,SC2019,SC2022,SC2026,\ SC2027,SC2030,SC2031,SC2034,SC2035,SC2039,SC2043,SC2044,SC2045,SC2046,SC2048,\ -SC2059,SC2064,SC2068,SC2070,SC2074,SC2086,SC2088,SC2089,SC2090,SC2091,SC2094,\ +SC2059,SC2064,SC2068,SC2074,SC2086,SC2088,SC2089,SC2090,SC2091,SC2094,\ SC2097,SC2098,SC2103,SC2115,SC2116,SC2119,SC2120,SC2121,SC2124,SC2126,SC2128,\ SC2129,SC2140,SC2142,SC2143,SC2145,SC2146,SC2148,SC2152,SC2153,SC2154,SC2155,\ SC2162,SC2164,SC2165,SC2166,SC2167,SC2174,SC2178,SC2181,SC2191,SC2192,SC2195,\ -SC2199,SC2206,SC2207,SC2209,SC2214,SC2219,SC2220,SC2223,SC2230,SC2231,SC2233,SC2235,SC2236" +SC2199,SC2206,SC2207,SC2209,SC2214,SC2219,SC2220,SC2223,SC2230,SC2231,SC2233,SC2235" SHCK_FORMAT="diff" SHCK_APPLY=true diff --git a/scripts/detect_cc.sh b/scripts/detect_cc.sh index e586dc6d3..7315baaa0 100755 --- a/scripts/detect_cc.sh +++ b/scripts/detect_cc.sh @@ -120,7 +120,7 @@ if [ "$LTO" = "y" ]; then fi fi -if [ ! -z "$CROSS_PREFIX" ]; then +if [ -n "$CROSS_PREFIX" ]; then expected_prefix=$($CC -dumpmachine) if [ ! "$expected_prefix" = "$CROSS_PREFIX" ]; then @@ -182,6 +182,6 @@ echo "CCAR=$CCAR" echo "CC_TYPE=$CC_TYPE" echo "LD_TYPE=$LD_TYPE" -if [ ! -z "$CROSS_PREFIX" ]; then +if [ -n "$CROSS_PREFIX" ]; then echo "CROSS_PREFIX=$CROSS_PREFIX" fi diff --git a/scripts/qat_setup.sh b/scripts/qat_setup.sh index 622bc84a4..5491694e9 100755 --- a/scripts/qat_setup.sh +++ b/scripts/qat_setup.sh @@ -18,7 +18,7 @@ if [ ${#qat_pci_bdfs[@]} -eq 0 ]; then exit 0 fi -if [ ! -z $1 ]; then +if [ -n "$1" ]; then driver_to_bind=$1 fi diff --git a/scripts/setup.sh b/scripts/setup.sh index fff3c174e..3c7205198 100755 --- a/scripts/setup.sh +++ b/scripts/setup.sh @@ -13,7 +13,7 @@ function usage() options="[config|reset|help]" fi - [[ ! -z $2 ]] && ( echo "$2"; echo ""; ) + [[ -n $2 ]] && ( echo "$2"; echo ""; ) echo "Helper script for allocating hugepages and binding NVMe, I/OAT, VMD and Virtio devices" echo "to a generic VFIO kernel driver. If VFIO is not available on the system, this script" echo "will fall back to UIO. NVMe and Virtio devices with active mountpoints will be ignored." diff --git a/scripts/vagrant/create_openstack_vm.sh b/scripts/vagrant/create_openstack_vm.sh index 9607555ac..a747b2808 100755 --- a/scripts/vagrant/create_openstack_vm.sh +++ b/scripts/vagrant/create_openstack_vm.sh @@ -15,7 +15,7 @@ mkdir -vp "${VAGRANT_TARGET}/${VAGRANT_DISTRO}" cp "${testdir}/Vagrantfile_openstack_vm" "${VAGRANT_TARGET}/${VAGRANT_DISTRO}/Vagrantfile" pushd "${VAGRANT_TARGET}/${VAGRANT_DISTRO}" -if [ ! -z "${http_proxy}" ]; then +if [ -n "${http_proxy}" ]; then export http_proxy fi diff --git a/scripts/vagrant/create_vbox.sh b/scripts/vagrant/create_vbox.sh index 7bfd89a24..0476ae141 100755 --- a/scripts/vagrant/create_vbox.sh +++ b/scripts/vagrant/create_vbox.sh @@ -207,7 +207,7 @@ if [ ${DRY_RUN} != 1 ]; then mkdir -vp "${VAGRANT_TARGET}/${SPDK_VAGRANT_DISTRO}-${SPDK_VAGRANT_PROVIDER}" cp ${DIR}/Vagrantfile ${VAGRANT_TARGET}/${SPDK_VAGRANT_DISTRO}-${SPDK_VAGRANT_PROVIDER} pushd "${VAGRANT_TARGET}/${SPDK_VAGRANT_DISTRO}-${SPDK_VAGRANT_PROVIDER}" - if [ ! -z "${http_proxy}" ]; then + if [ -n "${http_proxy}" ]; then export http_proxy export https_proxy if vagrant plugin list | grep -q vagrant-proxyconf; then diff --git a/scripts/vagrant/create_vhost_vm.sh b/scripts/vagrant/create_vhost_vm.sh index e87faa6cd..a64b3d420 100755 --- a/scripts/vagrant/create_vhost_vm.sh +++ b/scripts/vagrant/create_vhost_vm.sh @@ -100,7 +100,7 @@ fi export SPDK_VAGRANT_SSH_KEY="${VAGRANT_TARGET}/${SPDK_VAGRANT_DISTRO}/ssh_keys/spdk_vhost_id_rsa" pushd "${VAGRANT_TARGET}/${SPDK_VAGRANT_DISTRO}" -if [ ! -z "${http_proxy}" ]; then +if [ -n "${http_proxy}" ]; then export http_proxy export https_proxy if vagrant plugin list | grep -q vagrant-proxyconf; then diff --git a/test/bdev/bdev_raid.sh b/test/bdev/bdev_raid.sh index 5c344549f..ca7914c5a 100755 --- a/test/bdev/bdev_raid.sh +++ b/test/bdev/bdev_raid.sh @@ -49,7 +49,7 @@ function raid_unmap_data_verify() { } function on_error_exit() { - if [ ! -z $raid_pid ]; then + if [ -n "$raid_pid" ]; then killprocess $raid_pid fi diff --git a/test/bdev/gen_crypto.sh b/test/bdev/gen_crypto.sh index 6ae66cb6e..fdc9b68c7 100755 --- a/test/bdev/gen_crypto.sh +++ b/test/bdev/gen_crypto.sh @@ -14,7 +14,7 @@ base_bdev2=$2 echo echo "[crypto]" -if [ -n $base_bdev ]; then +if [ -n "$base_bdev" ]; then if [ $(lspci -d:37c8 | wc -l) -eq 0 ]; then echo " CRY $base_bdev crypto_ram 0123456789123456 crypto_aesni_mb" else @@ -22,6 +22,6 @@ if [ -n $base_bdev ]; then fi fi -if [ -n $base_bdev2 ]; then +if [ -n "$base_bdev2" ]; then echo " CRY $base_bdev2 crypto_ram2 9012345678912345 crypto_aesni_mb" fi diff --git a/test/common/autotest_common.sh b/test/common/autotest_common.sh index 4170fd969..bb88a1da6 100644 --- a/test/common/autotest_common.sh +++ b/test/common/autotest_common.sh @@ -213,7 +213,7 @@ fi # By default, --with-dpdk is not set meaning the SPDK build will use the DPDK submodule. # If a DPDK installation is found in a well-known location though, WITH_DPDK_DIR will be # set which will override the default and use that DPDK installation instead. -if [ ! -z "$WITH_DPDK_DIR" ]; then +if [ -n "$WITH_DPDK_DIR" ]; then config_params+=" --with-dpdk=$WITH_DPDK_DIR" fi @@ -306,7 +306,7 @@ function process_core() { exe=$(eu-readelf -n "$core" | grep -oP -m1 "$exe.+") fi echo "exe for $core is $exe" - if [[ ! -z "$exe" ]]; then + if [[ -n "$exe" ]]; then if hash gdb &>/dev/null; then gdb -batch -ex "thread apply all bt full" $exe $core fi @@ -816,7 +816,7 @@ function freebsd_update_contigmem_mod() { if [ $(uname) = FreeBSD ]; then kldunload contigmem.ko || true - if [ ! -z "$WITH_DPDK_DIR" ]; then + if [ -n "$WITH_DPDK_DIR" ]; then echo "Warning: SPDK only works on FreeBSD with patches that only exist in SPDK's dpdk submodule" cp -f "$WITH_DPDK_DIR/kmod/contigmem.ko" /boot/modules/ cp -f "$WITH_DPDK_DIR/kmod/contigmem.ko" /boot/kernel/ diff --git a/test/common/config/vm_setup.sh b/test/common/config/vm_setup.sh index 8567e06c9..53d883fb6 100755 --- a/test/common/config/vm_setup.sh +++ b/test/common/config/vm_setup.sh @@ -354,7 +354,7 @@ while getopts 'iuht:c:-:' optchar; do esac done -if [ ! -z "$CONF_PATH" ]; then +if [ -n "$CONF_PATH" ]; then if [ ! -f "$CONF_PATH" ]; then echo Configuration file does not exist: "$CONF_PATH" exit 1 diff --git a/test/iscsi_tgt/common.sh b/test/iscsi_tgt/common.sh index 4a89f7c8e..025efa5c0 100644 --- a/test/iscsi_tgt/common.sh +++ b/test/iscsi_tgt/common.sh @@ -66,7 +66,7 @@ function cleanup_veth_interfaces() { function iscsitestinit() { if [ "$1" == "iso" ]; then $rootdir/scripts/setup.sh - if [ ! -z "$2" ]; then + if [ -n "$2" ]; then create_veth_interfaces $2 else # default to posix @@ -92,7 +92,7 @@ function waitforiscsidevices() { function iscsitestfini() { if [ "$1" == "iso" ]; then - if [ ! -z "$2" ]; then + if [ -n "$2" ]; then cleanup_veth_interfaces $2 else # default to posix diff --git a/test/iscsi_tgt/perf/iscsi_target.sh b/test/iscsi_tgt/perf/iscsi_target.sh index 040f82346..076277f96 100755 --- a/test/iscsi_tgt/perf/iscsi_target.sh +++ b/test/iscsi_tgt/perf/iscsi_target.sh @@ -22,7 +22,7 @@ ISCSI_TGT_CM=0x02 # Performance test for iscsi_tgt, run on devices with proper hardware support (target and inititator) function usage() { - [[ ! -z $2 ]] && ( echo "$2"; echo ""; ) + [[ -n $2 ]] && ( echo "$2"; echo ""; ) echo "Usage: $(basename $1) [options]" echo "-h, --help Print help and exit" echo " --fiopath=PATH Path to fio directory on initiator. [default=$FIO_PATH]" diff --git a/test/json_config/json_config.sh b/test/json_config/json_config.sh index 907d3af9e..ec719e109 100755 --- a/test/json_config/json_config.sh +++ b/test/json_config/json_config.sh @@ -104,7 +104,7 @@ function json_config_test_start_app() { local app=$1 shift - [[ ! -z "${#app_socket[$app]}" ]] # Check app type + [[ -n "${#app_socket[$app]}" ]] # Check app type [[ -z "${app_pid[$app]}" ]] # Assert if app is not running local app_extra_params="" @@ -126,8 +126,8 @@ function json_config_test_shutdown_app() { local app=$1 # Check app type && assert app was started - [[ ! -z "${#app_socket[$app]}" ]] - [[ ! -z "${app_pid[$app]}" ]] + [[ -n "${#app_socket[$app]}" ]] + [[ -n "${app_pid[$app]}" ]] # kill_instance RPC will trigger ASAN kill -SIGINT ${app_pid[$app]} @@ -140,7 +140,7 @@ function json_config_test_shutdown_app() { sleep 0.5 done - if [[ ! -z "${app_pid[$app]}" ]]; then + if [[ -n "${app_pid[$app]}" ]]; then echo "SPDK $app shutdown timeout" return 1 fi @@ -262,7 +262,7 @@ function cleanup_bdev_subsystem_config() { rm -f /tmp/sample_aio fi - if [[ $SPDK_TEST_PMDK -eq 1 && ! -z "$pmem_pool_file" && -f "$pmem_pool_file" ]]; then + if [[ $SPDK_TEST_PMDK -eq 1 && -n "$pmem_pool_file" && -f "$pmem_pool_file" ]]; then tgt_rpc delete_pmem_bdev pmem1 tgt_rpc delete_pmem_pool $pmem_pool_file rm -f $pmem_pool_file @@ -384,7 +384,7 @@ function json_config_test_fini() { timing_enter $FUNCNAME local ret=0 - if [[ ! -z "${app_pid[initiator]}" ]]; then + if [[ -n "${app_pid[initiator]}" ]]; then if ! json_config_test_shutdown_app initiator; then kill -9 ${app_pid[initiator]} app_pid[initiator]= @@ -392,7 +392,7 @@ function json_config_test_fini() { fi fi - if [[ ! -z "${app_pid[target]}" ]]; then + if [[ -n "${app_pid[target]}" ]]; then # Remove any artifacts we created (files, lvol etc) cleanup_bdev_subsystem_config @@ -412,7 +412,7 @@ function json_config_test_fini() { } function json_config_clear() { - [[ ! -z "${#app_socket[$1]}" ]] # Check app type + [[ -n "${#app_socket[$1]}" ]] # Check app type $rootdir/test/json_config/clear_config.py -s ${app_socket[$1]} clear_config # Check if config is clean. diff --git a/test/lvol/lvol.sh b/test/lvol/lvol.sh index 7999405ef..54eef1e01 100755 --- a/test/lvol/lvol.sh +++ b/test/lvol/lvol.sh @@ -12,7 +12,7 @@ x="" rpc_py="$rootdir/scripts/rpc.py " function usage() { - [[ ! -z $2 ]] && ( echo "$2"; echo ""; ) + [[ -n $2 ]] && ( echo "$2"; echo ""; ) echo "Shortcut script for doing automated lvol tests" echo "Usage: $(basename $1) [OPTIONS]" echo diff --git a/test/nvme/perf/common.sh b/test/nvme/perf/common.sh index 3dbc72ccf..a85a2dc6c 100755 --- a/test/nvme/perf/common.sh +++ b/test/nvme/perf/common.sh @@ -304,7 +304,7 @@ function run_bdevperf(){ function usage() { set +x - [[ ! -z $2 ]] && ( echo "$2"; echo ""; ) + [[ -n $2 ]] && ( echo "$2"; echo ""; ) echo "Run NVMe PMD/BDEV performance test. Change options for easier debug and setup configuration" echo "Usage: $(basename $1) [options]" echo "-h, --help Print help and exit" diff --git a/test/nvmf/target/nmic.sh b/test/nvmf/target/nmic.sh index 32eb73d9f..8c17cc73f 100755 --- a/test/nvmf/target/nmic.sh +++ b/test/nvmf/target/nmic.sh @@ -39,7 +39,7 @@ else fi echo "test case2: host connect to nvmf target in multiple paths" -if [ ! -z $NVMF_SECOND_TARGET_IP ]; then +if [ -n "$NVMF_SECOND_TARGET_IP" ]; then $rpc_py nvmf_subsystem_add_listener nqn.2016-06.io.spdk:cnode1 -t $TEST_TRANSPORT -a $NVMF_SECOND_TARGET_IP -s $NVMF_PORT nvme connect -t $TEST_TRANSPORT -n "nqn.2016-06.io.spdk:cnode1" -a "$NVMF_FIRST_TARGET_IP" -s "$NVMF_PORT" diff --git a/test/pmem/pmem.sh b/test/pmem/pmem.sh index 5eed0e6c3..4ef799bfc 100755 --- a/test/pmem/pmem.sh +++ b/test/pmem/pmem.sh @@ -21,7 +21,7 @@ bdev_name=pmem0 function usage() { - [[ ! -z $2 ]] && ( echo "$2"; echo ""; ) + [[ -n $2 ]] && ( echo "$2"; echo ""; ) echo "Shortcut script for automated RPC tests for PMEM" echo "For test details, check test_plan.md or" echo "https://review.gerrithub.io/#/c/378618/18/test/pmem/test_plan.md" diff --git a/test/spdkcli/common.sh b/test/spdkcli/common.sh index 7334c1039..0acef032e 100644 --- a/test/spdkcli/common.sh +++ b/test/spdkcli/common.sh @@ -3,16 +3,16 @@ spdk_clear_config_py="$rootdir/test/json_config/clear_config.py" function on_error_exit() { set +e - if [ ! -z $spdk_tgt_pid ]; then + if [ -n "$spdk_tgt_pid" ]; then killprocess $spdk_tgt_pid fi - if [ ! -z $nvmf_tgt_pid ]; then + if [ -n "$nvmf_tgt_pid" ]; then killprocess $nvmf_tgt_pid fi - if [ ! -z $iscsi_tgt_pid ]; then + if [ -n "$iscsi_tgt_pid" ]; then killprocess $iscsi_tgt_pid fi - if [ ! -z $vhost_tgt_pid ]; then + if [ -n "$vhost_tgt_pid" ]; then killprocess $vhost_tgt_pid fi rm -f $testdir/${MATCH_FILE} $testdir/match_files/spdkcli_details_vhost.test /tmp/sample_aio /tmp/sample_pmem diff --git a/test/spdkcli/virtio.sh b/test/spdkcli/virtio.sh index 43411557b..118ba8b3d 100755 --- a/test/spdkcli/virtio.sh +++ b/test/spdkcli/virtio.sh @@ -23,11 +23,11 @@ $spdkcli_job "'/bdevs/malloc create 32 512 Malloc0' 'Malloc0' True '/bdevs/malloc create 32 512 Malloc1' 'Malloc1' True " pci_blk=$(lspci -nn -D | grep '1af4:1001' | head -1 | awk '{print $1;}') -if [ ! -z $pci_blk ]; then +if [ -n "$pci_blk" ]; then $spdkcli_job "'/bdevs/virtioblk_disk create virtioblk_pci pci $pci_blk' 'virtioblk_pci' True" fi pci_scsi=$(lspci -nn -D | grep '1af4:1004' | head -1 | awk '{print $1;}') -if [ ! -z $pci_scsi ]; then +if [ -n "$pci_scsi" ]; then $spdkcli_job "'/bdevs/virtioscsi_disk create virtioscsi_pci pci $pci_scsi' 'virtioscsi_pci' True" fi $spdkcli_job "'/vhost/scsi create sample_scsi' 'sample_scsi' True @@ -37,7 +37,7 @@ $spdkcli_job "'/vhost/scsi create sample_scsi' 'sample_scsi' True timing_exit spdkcli_create_virtio_pci_config timing_enter spdkcli_check_match -if [ ! -z $pci_blk ] && [ ! -z $pci_scsi ]; then +if [ -n "$pci_blk" ] && [ -n "$pci_scsi" ]; then MATCH_FILE="spdkcli_virtio_pci.test" SPDKCLI_BRANCH="/bdevs" check_match @@ -64,10 +64,10 @@ $spdkcli_job "'/vhost/block delete sample_block' 'sample_block' '/vhost/scsi/sample_scsi remove_target 0' 'Malloc0' '/vhost/scsi delete sample_scsi' 'sample_scsi' " -if [ ! -z $pci_blk ]; then +if [ -n "$pci_blk" ]; then $spdkcli_job "'/bdevs/virtioblk_disk delete virtioblk_pci' 'virtioblk_pci'" fi -if [ ! -z $pci_scsi ]; then +if [ -n "$pci_scsi" ]; then $spdkcli_job "'/bdevs/virtioscsi_disk delete virtioscsi_pci' 'virtioscsi_pci'" fi $spdkcli_job "'/bdevs/malloc delete Malloc0' 'Malloc0' diff --git a/test/vhost/common.sh b/test/vhost/common.sh index d9be8cbe9..6c9b60734 100644 --- a/test/vhost/common.sh +++ b/test/vhost/common.sh @@ -438,7 +438,7 @@ function vm_kill() function vm_list_all() { local vms="$(shopt -s nullglob; echo $VM_DIR/[0-9]*)" - if [[ ! -z "$vms" ]]; then + if [[ -n "$vms" ]]; then basename --multiple $vms fi } @@ -547,7 +547,7 @@ function vm_setup() done # Find next directory we can use - if [[ ! -z $force_vm ]]; then + if [[ -n $force_vm ]]; then vm_num=$force_vm vm_num_is_valid $vm_num || return 1 @@ -571,18 +571,18 @@ function vm_setup() return 1 fi - if [[ ! -z "$vm_migrate_to" && ! -z "$vm_incoming" ]]; then + if [[ -n "$vm_migrate_to" && -n "$vm_incoming" ]]; then error "'--incoming' and '--migrate-to' cannot be used together" return 1 - elif [[ ! -z "$vm_incoming" ]]; then - if [[ ! -z "$os_mode" || ! -z "$os_img" ]]; then + elif [[ -n "$vm_incoming" ]]; then + if [[ -n "$os_mode" || -n "$os_img" ]]; then error "'--incoming' can't be used together with '--os' nor '--os-mode'" return 1 fi os_mode="original" os="$VM_DIR/$vm_incoming/os.qcow2" - elif [[ ! -z "$vm_migrate_to" ]]; then + elif [[ -n "$vm_migrate_to" ]]; then [[ "$os_mode" != "backing" ]] && warning "Using 'backing' mode for OS since '--migrate-to' is used" os_mode=backing fi @@ -666,7 +666,7 @@ function vm_setup() cmd+="-m $guest_memory --enable-kvm -cpu host -smp $cpu_num -vga std -vnc :$vnc_socket -daemonize ${eol}" cmd+="-object memory-backend-file,id=mem,size=${guest_memory}M,mem-path=/dev/hugepages,share=on,prealloc=yes,host-nodes=$node_num,policy=bind ${eol}" [[ $os_mode == snapshot ]] && cmd+="-snapshot ${eol}" - [[ ! -z "$vm_incoming" ]] && cmd+=" -incoming tcp:0:$migration_port ${eol}" + [[ -n "$vm_incoming" ]] && cmd+=" -incoming tcp:0:$migration_port ${eol}" cmd+="-monitor telnet:127.0.0.1:$monitor_port,server,nowait ${eol}" cmd+="-numa node,memdev=mem ${eol}" cmd+="-pidfile $qemu_pid_file ${eol}" @@ -697,7 +697,7 @@ function vm_setup() local raw_name="RAWSCSI" local raw_disk=$vm_dir/test.img - if [[ ! -z $disk ]]; then + if [[ -n $disk ]]; then [[ ! -b $disk ]] && touch $disk local raw_disk=$(readlink -f $disk) fi @@ -764,7 +764,7 @@ function vm_setup() return 1 fi - [[ ! -z $qemu_args ]] && cmd+=" $qemu_args ${eol}" + [[ -n $qemu_args ]] && cmd+=" $qemu_args ${eol}" # remove last $eol cmd="${cmd%\\\\\\n }" @@ -1046,7 +1046,7 @@ function run_fio() esac done - if [[ ! -z "$fio_bin" && ! -r "$fio_bin" ]]; then + if [[ -n "$fio_bin" && ! -r "$fio_bin" ]]; then error "FIO binary '$fio_bin' does not exist" return 1 fi @@ -1067,7 +1067,7 @@ function run_fio() vm_exec $vm_num cat /root/$job_fname if ! $run_server_mode; then - if [[ ! -z "$fio_bin" ]]; then + if [[ -n "$fio_bin" ]]; then cat $fio_bin | vm_exec $vm_num 'cat > /root/fio; chmod +x /root/fio' fi @@ -1083,7 +1083,7 @@ function run_fio() fi $rootdir/test/vhost/common/run_fio.py --job-file=/root/$job_fname \ - $([[ ! -z "$fio_bin" ]] && echo "--fio-bin=$fio_bin") \ + $([[ -n "$fio_bin" ]] && echo "--fio-bin=$fio_bin") \ --out=$out $json ${fio_disks%,} } diff --git a/test/vhost/fiotest/fio.sh b/test/vhost/fiotest/fio.sh index e72a4e908..322c3a6d0 100755 --- a/test/vhost/fiotest/fio.sh +++ b/test/vhost/fiotest/fio.sh @@ -18,7 +18,7 @@ x="" function usage() { - [[ ! -z $2 ]] && ( echo "$2"; echo ""; ) + [[ -n $2 ]] && ( echo "$2"; echo ""; ) echo "Shortcut script for doing automated test" echo "Usage: $(basename $1) [OPTIONS]" echo diff --git a/test/vhost/hotplug/common.sh b/test/vhost/hotplug/common.sh index 634c53426..77083414a 100644 --- a/test/vhost/hotplug/common.sh +++ b/test/vhost/hotplug/common.sh @@ -18,7 +18,7 @@ blk_hot_remove_test=0 function usage() { - [[ ! -z $2 ]] && ( echo "$2"; echo ""; ) + [[ -n $2 ]] && ( echo "$2"; echo ""; ) echo "Shortcut script for doing automated hotattach/hotdetach test" echo "Usage: $(basename $1) [OPTIONS]" echo diff --git a/test/vhost/initiator/blockdev.sh b/test/vhost/initiator/blockdev.sh index 682ff0c15..d8f925312 100755 --- a/test/vhost/initiator/blockdev.sh +++ b/test/vhost/initiator/blockdev.sh @@ -12,7 +12,7 @@ virtio_with_unmap="" function usage() { - [[ ! -z $2 ]] && ( echo "$2"; echo ""; ) + [[ -n $2 ]] && ( echo "$2"; echo ""; ) echo "Script for running vhost initiator tests." echo "Usage: $(basename $1) [-h|--help] [--fiobin=PATH]" echo "-h, --help Print help and exit" diff --git a/test/vhost/integrity/integrity_start.sh b/test/vhost/integrity/integrity_start.sh index 0f60ccdeb..9dd5d73c4 100755 --- a/test/vhost/integrity/integrity_start.sh +++ b/test/vhost/integrity/integrity_start.sh @@ -10,7 +10,7 @@ vm_fs="ext4" function usage() { - [[ ! -z $2 ]] && ( echo "$2"; echo ""; ) + [[ -n $2 ]] && ( echo "$2"; echo ""; ) echo "Shortcut script for doing automated test" echo "Usage: $(basename $1) [OPTIONS]" echo diff --git a/test/vhost/lvol/lvol_test.sh b/test/vhost/lvol/lvol_test.sh index f896b9f2d..e225cb52c 100755 --- a/test/vhost/lvol/lvol_test.sh +++ b/test/vhost/lvol/lvol_test.sh @@ -17,7 +17,7 @@ distribute_cores=false function usage() { - [[ ! -z $2 ]] && ( echo "$2"; echo ""; ) + [[ -n $2 ]] && ( echo "$2"; echo ""; ) echo "Shortcut script for doing automated test" echo "Usage: $(basename $1) [OPTIONS]" echo diff --git a/test/vhost/migration/migration-tc2.sh b/test/vhost/migration/migration-tc2.sh index dba71efa4..e7c39f7e5 100644 --- a/test/vhost/migration/migration-tc2.sh +++ b/test/vhost/migration/migration-tc2.sh @@ -9,7 +9,7 @@ function migration_tc2_cleanup_nvmf_tgt() return fi - if [[ ! -z "$1" ]]; then + if [[ -n "$1" ]]; then trap 'error_exit "${FUNCNAME}" "${LINENO}"' INT ERR EXIT pkill --signal $1 -F $nvmf_dir/nvmf_tgt.pid || true sleep 5 diff --git a/test/vhost/migration/migration-tc3a.sh b/test/vhost/migration/migration-tc3a.sh index 261e69be1..4b82d3f40 100644 --- a/test/vhost/migration/migration-tc3a.sh +++ b/test/vhost/migration/migration-tc3a.sh @@ -69,7 +69,7 @@ function check_rdma_connection() function host1_cleanup_nvmf() { notice "Shutting down nvmf_tgt on local server" - if [[ ! -z "$1" ]]; then + if [[ -n "$1" ]]; then pkill --signal $1 -F $nvmf_dir/nvmf_tgt.pid else pkill -F $nvmf_dir/nvmf_tgt.pid diff --git a/test/vhost/migration/migration.sh b/test/vhost/migration/migration.sh index 3b51ad4d6..95572b33c 100755 --- a/test/vhost/migration/migration.sh +++ b/test/vhost/migration/migration.sh @@ -20,7 +20,7 @@ RDMA_TARGET_IP="" RDMA_INITIATOR_IP="" function usage() { - [[ ! -z $2 ]] && ( echo "$2"; echo ""; ) + [[ -n $2 ]] && ( echo "$2"; echo ""; ) echo "Shortcut script for doing automated test of live migration." echo "Usage: $(basename $1) [OPTIONS]" echo @@ -58,7 +58,7 @@ done vhosttestinit -[[ ! -z "$test_cases" ]] || fail "Need '--test-cases=' parameter" +[[ -n "$test_cases" ]] || fail "Need '--test-cases=' parameter" trap 'error_exit "${FUNCNAME}" "${LINENO}"' INT ERR EXIT @@ -69,7 +69,7 @@ function vm_monitor_send() local vm_dir="$VM_DIR/$1" local vm_monitor_port=$(cat $vm_dir/monitor_port) - [[ ! -z "$vm_monitor_port" ]] || fail "No monitor port!" + [[ -n "$vm_monitor_port" ]] || fail "No monitor port!" shift 2 nc 127.0.0.1 $vm_monitor_port "$@" > $cmd_result_file diff --git a/test/vhost/other/negative.sh b/test/vhost/other/negative.sh index 539022eff..eb3ce2988 100755 --- a/test/vhost/other/negative.sh +++ b/test/vhost/other/negative.sh @@ -7,7 +7,7 @@ source $rootdir/test/vhost/common.sh function usage() { - [[ ! -z $2 ]] && ( echo "$2"; echo ""; ) + [[ -n $2 ]] && ( echo "$2"; echo ""; ) echo "Shortcut script for running vhost app." echo "Usage: $(basename $1) [-x] [-h|--help] [--clean-build]" echo "-h, --help print help and exit" diff --git a/test/vhost/perf_bench/vhost_perf.sh b/test/vhost/perf_bench/vhost_perf.sh index a5e0c949d..3fe8f89a9 100755 --- a/test/vhost/perf_bench/vhost_perf.sh +++ b/test/vhost/perf_bench/vhost_perf.sh @@ -28,7 +28,7 @@ precond_fio_bin="/usr/src/fio/fio" function usage() { - [[ ! -z $2 ]] && ( echo "$2"; echo ""; ) + [[ -n $2 ]] && ( echo "$2"; echo ""; ) echo "Shortcut script for doing automated test" echo "Usage: $(basename $1) [OPTIONS]" echo diff --git a/test/vhost/readonly/readonly.sh b/test/vhost/readonly/readonly.sh index ab6135ffd..3bb755da1 100755 --- a/test/vhost/readonly/readonly.sh +++ b/test/vhost/readonly/readonly.sh @@ -13,7 +13,7 @@ x="" function usage() { - [[ ! -z $2 ]] && ( echo "$2"; echo ""; ) + [[ -n $2 ]] && ( echo "$2"; echo ""; ) echo "Shortcut script for automated readonly test for vhost-block" echo "For test details check test_plan.md" echo diff --git a/test/vhost/vhost_boot/vhost_boot.sh b/test/vhost/vhost_boot/vhost_boot.sh index bf25d74a4..061ba2316 100755 --- a/test/vhost/vhost_boot/vhost_boot.sh +++ b/test/vhost/vhost_boot/vhost_boot.sh @@ -27,7 +27,7 @@ function err_clean function usage() { - [[ ! -z $2 ]] && ( echo "$2"; echo ""; ) + [[ -n $2 ]] && ( echo "$2"; echo ""; ) echo "Usage: $(basename $1) vm_image=PATH [-h|--help]" echo "-h, --help Print help and exit" echo " --vm_image=PATH Path to VM image used in these tests" diff --git a/test/vhost/windows/windows.sh b/test/vhost/windows/windows.sh index 3a9ded80a..e902cecf4 100755 --- a/test/vhost/windows/windows.sh +++ b/test/vhost/windows/windows.sh @@ -13,7 +13,7 @@ vm_image="/home/sys_sgsw/windows_server.qcow2" function usage() { - [[ ! -z $2 ]] && ( echo "$2"; echo ""; ) + [[ -n $2 ]] && ( echo "$2"; echo ""; ) echo "Windows Server automated test" echo "Usage: $(basename $1) [OPTIONS]" echo "--vm-ssh-pass=PASSWORD Text password for the VM" diff --git a/test/vhost/windows/windows_scsi_compliance.sh b/test/vhost/windows/windows_scsi_compliance.sh index c13973bd4..3282ce57b 100755 --- a/test/vhost/windows/windows_scsi_compliance.sh +++ b/test/vhost/windows/windows_scsi_compliance.sh @@ -18,7 +18,7 @@ rpc_py="$rootdir/scripts/rpc.py -s $(get_vhost_dir 0)/rpc.sock" function usage() { - [[ ! -z $2 ]] && ( echo "$2"; echo ""; ) + [[ -n $2 ]] && ( echo "$2"; echo ""; ) echo "Windows Server scsi compliance test" echo "Usage: $(basename $1) [OPTIONS]" echo " --vm-ssh-pass=PASSWORD Text password for the VM"