From fb9c4ee6513b5070bbf49e40d4d75bfc50996975 Mon Sep 17 00:00:00 2001 From: Karol Latecki Date: Wed, 12 Jun 2019 09:48:32 +0200 Subject: [PATCH] test: replace backticks with dollar-parenthesis syntax Scripts were using a mix of two approaches, lets unify that so just dollar-parenthesis syntax is used. Change-Id: Id093b6c82d1f766ba6af13bed720977eceaa7ffc Signed-off-by: Karol Latecki Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/457744 Tested-by: SPDK CI Jenkins Reviewed-by: Darek Stojaczyk Reviewed-by: Pawel Kaminski Reviewed-by: Shuhei Matsumoto --- test/bdev/blockdev.sh | 2 +- test/bdev/nbd_common.sh | 10 +++++----- test/blobfs/rocksdb/run_tests.sh | 4 ++-- test/blobstore/blob_io_wait/blob_io_wait.sh | 2 +- test/blobstore/blobstore.sh | 2 +- test/common/autotest_common.sh | 10 +++++----- test/common/config/vm_setup.sh | 2 +- test/env/env.sh | 4 ++-- test/iscsi_tgt/ext4test/ext4test.sh | 2 +- test/nvme/hotplug.sh | 2 +- test/nvme/nvme.sh | 8 ++++---- test/nvme/perf/common.sh | 4 ++-- test/nvme/spdk_nvme_cli.sh | 4 ++-- test/nvmf/common.sh | 8 ++++---- test/nvmf/target/filesystem.sh | 2 +- test/nvmf/target/multiconnection.sh | 6 +++--- test/nvmf/target/rpc.sh | 4 ++-- test/nvmf/target/shutdown.sh | 2 +- test/vhost/hotplug/common.sh | 2 +- test/vhost/manual.sh | 2 +- test/vhost/perf_bench/vhost_perf.sh | 4 ++-- 21 files changed, 43 insertions(+), 43 deletions(-) diff --git a/test/bdev/blockdev.sh b/test/bdev/blockdev.sh index eaf7f6b0f2..193776a2bd 100755 --- a/test/bdev/blockdev.sh +++ b/test/bdev/blockdev.sh @@ -25,7 +25,7 @@ function nbd_function_test() { local rpc_server=/var/tmp/spdk-nbd.sock local conf=$1 local nbd_num=6 - local nbd_all=(`ls /dev/nbd* | grep -v p`) + local nbd_all=($(ls /dev/nbd* | grep -v p)) local bdev_all=($bdevs_name) local nbd_list=(${nbd_all[@]:0:$nbd_num}) local bdev_list=(${bdev_all[@]:0:$nbd_num}) diff --git a/test/bdev/nbd_common.sh b/test/bdev/nbd_common.sh index 4612a8f8e1..428dea314e 100644 --- a/test/bdev/nbd_common.sh +++ b/test/bdev/nbd_common.sh @@ -55,9 +55,9 @@ function nbd_get_count() { # return = count of spdk nbd devices local rpc_server=$1 - nbd_disks_json=`$rootdir/scripts/rpc.py -s $rpc_server get_nbd_disks` - nbd_disks_name=`echo "${nbd_disks_json}" | jq -r '.[] | .nbd_device'` - count=`echo "${nbd_disks_name}" | grep -c /dev/nbd || true` + nbd_disks_json=$($rootdir/scripts/rpc.py -s $rpc_server get_nbd_disks) + nbd_disks_name=$(echo "${nbd_disks_json}" | jq -r '.[] | .nbd_device') + count=$(echo "${nbd_disks_name}" | grep -c /dev/nbd || true) echo $count } @@ -110,8 +110,8 @@ function nbd_rpc_start_stop_verify() { nbd_start_disks_without_nbd_idx $rpc_server "${bdev_list[*]}" - nbd_disks_json=`$rootdir/scripts/rpc.py -s $rpc_server get_nbd_disks` - nbd_disks_name=(`echo "${nbd_disks_json}" | jq -r '.[] | .nbd_device'`) + nbd_disks_json=$($rootdir/scripts/rpc.py -s $rpc_server get_nbd_disks) + nbd_disks_name=($(echo "${nbd_disks_json}" | jq -r '.[] | .nbd_device')) nbd_stop_disks $rpc_server "${nbd_disks_name[*]}" count=$(nbd_get_count $rpc_server) diff --git a/test/blobfs/rocksdb/run_tests.sh b/test/blobfs/rocksdb/run_tests.sh index d65d3b101f..d89f7fc0e8 100755 --- a/test/blobfs/rocksdb/run_tests.sh +++ b/test/blobfs/rocksdb/run_tests.sh @@ -30,7 +30,7 @@ if ls $TESTDIR/results/testrun_* &> /dev/null; then fi if [ -z "$RESULTS_DIR" ]; then - RESULTS_DIR=$TESTDIR/results/testrun_`date +%Y%m%d_%H%M%S` + RESULTS_DIR=$TESTDIR/results/testrun_$(date +%Y%m%d_%H%M%S) mkdir -p $RESULTS_DIR rm -f $TESTDIR/results/last ln -s $RESULTS_DIR $TESTDIR/results/last @@ -157,7 +157,7 @@ run_step() { echo -n Generating perf report for $1 test phase... sudo perf report -f -n | sed '/#/d' | sed '/%/!d' | sort -r > $1.perf.txt sudo rm perf.data - $TESTDIR/postprocess.py `pwd` $1 > $1_summary.txt + $TESTDIR/postprocess.py $(pwd) $1 > $1_summary.txt echo done. fi } diff --git a/test/blobstore/blob_io_wait/blob_io_wait.sh b/test/blobstore/blob_io_wait/blob_io_wait.sh index 8ce3cc878c..74f4b26be1 100755 --- a/test/blobstore/blob_io_wait/blob_io_wait.sh +++ b/test/blobstore/blob_io_wait/blob_io_wait.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash -SYSTEM=`uname -s` +SYSTEM=$(uname -s) if [ $SYSTEM = "FreeBSD" ] ; then echo "blob_io_wait.sh cannot run on FreeBSD currently." exit 0 diff --git a/test/blobstore/blobstore.sh b/test/blobstore/blobstore.sh index 4ae413a1a0..81846f6bde 100755 --- a/test/blobstore/blobstore.sh +++ b/test/blobstore/blobstore.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash -SYSTEM=`uname -s` +SYSTEM=$(uname -s) if [ $SYSTEM = "FreeBSD" ] ; then echo "blobstore.sh cannot run on FreeBSD currently." exit 0 diff --git a/test/common/autotest_common.sh b/test/common/autotest_common.sh index 7f5a095698..eb58fb695e 100644 --- a/test/common/autotest_common.sh +++ b/test/common/autotest_common.sh @@ -140,7 +140,7 @@ if [ -d ${DEPENDENCY_DIR}/vtune_codes ]; then fi if [ -d /usr/include/iscsi ]; then - libiscsi_version=`grep LIBISCSI_API_VERSION /usr/include/iscsi/iscsi.h | head -1 | awk '{print $3}' | awk -F '(' '{print $2}' | awk -F ')' '{print $1}'` + libiscsi_version=$(grep LIBISCSI_API_VERSION /usr/include/iscsi/iscsi.h | head -1 | awk '{print $3}' | awk -F '(' '{print $2}' | awk -F ')' '{print $1}') if [ $libiscsi_version -ge 20150621 ]; then config_params+=' --with-iscsi-initiator' fi @@ -414,7 +414,7 @@ function waitfornbd() { # need to check the size of the output file instead. for ((i=1; i<=20; i++)); do dd if=/dev/$nbd_name of=/tmp/nbdtest bs=4096 count=1 iflag=direct - size=`stat -c %s /tmp/nbdtest` + size=$(stat -c %s /tmp/nbdtest) rm -f /tmp/nbdtest if [ "$size" != "0" ]; then return 0 @@ -609,9 +609,9 @@ function part_dev_by_gpt () { parted -s $nbd_path mklabel gpt mkpart first '0%' '50%' mkpart second '50%' '100%' # change the GUID to SPDK GUID value - SPDK_GPT_GUID=`grep SPDK_GPT_PART_TYPE_GUID $rootdir/lib/bdev/gpt/gpt.h \ + SPDK_GPT_GUID=$(grep SPDK_GPT_PART_TYPE_GUID $rootdir/lib/bdev/gpt/gpt.h \ | awk -F "(" '{ print $2}' | sed 's/)//g' \ - | awk -F ", " '{ print $1 "-" $2 "-" $3 "-" $4 "-" $5}' | sed 's/0x//g'` + | awk -F ", " '{ print $1 "-" $2 "-" $3 "-" $4 "-" $5}' | sed 's/0x//g') sgdisk -t 1:$SPDK_GPT_GUID $nbd_path sgdisk -t 2:$SPDK_GPT_GUID $nbd_path elif [ "$operation" = reset ]; then @@ -823,7 +823,7 @@ function autotest_cleanup() function freebsd_update_contigmem_mod() { - if [ `uname` = FreeBSD ]; then + if [ $(uname) = FreeBSD ]; then kldunload contigmem.ko || true if [ ! -z "$WITH_DPDK_DIR" ]; then echo "Warning: SPDK only works on FreeBSD with patches that only exist in SPDK's dpdk submodule" diff --git a/test/common/config/vm_setup.sh b/test/common/config/vm_setup.sh index a23de6629c..6de47734e5 100755 --- a/test/common/config/vm_setup.sh +++ b/test/common/config/vm_setup.sh @@ -75,7 +75,7 @@ function install_iscsi_adm() git -C open-iscsi-install/open-iscsi config user.email none git -C open-iscsi-install/open-iscsi checkout 86e8892 - for patch in `ls open-iscsi-install/patches`; do + for patch in $(ls open-iscsi-install/patches); do git -C open-iscsi-install/open-iscsi am ../patches/$patch done sed -i '427s/.*/-1);/' open-iscsi-install/open-iscsi/usr/session_info.c diff --git a/test/env/env.sh b/test/env/env.sh index e79fcf0bfd..9d27accc58 100755 --- a/test/env/env.sh +++ b/test/env/env.sh @@ -22,7 +22,7 @@ timing_exit pci timing_enter env_dpdk_post_init argv="-c 0x1 " -if [ `uname` = Linux ]; then +if [ $(uname) = Linux ]; then # The default base virtaddr falls into a region reserved by ASAN. # DPDK will try to find the nearest available address space by # trying to do mmap over and over, which will take ages to finish. @@ -34,7 +34,7 @@ fi $testdir/env_dpdk_post_init/env_dpdk_post_init $argv timing_exit env_dpdk_post_init -if [ `uname` = Linux ]; then +if [ $(uname) = Linux ]; then # This tests the --match-allocations DPDK parameter which is only # supported on Linux timing_enter mem_callbacks diff --git a/test/iscsi_tgt/ext4test/ext4test.sh b/test/iscsi_tgt/ext4test/ext4test.sh index 7350ec1ebf..0e3893b744 100755 --- a/test/iscsi_tgt/ext4test/ext4test.sh +++ b/test/iscsi_tgt/ext4test/ext4test.sh @@ -43,7 +43,7 @@ sleep 1 iscsiadm -m discovery -t sendtargets -p $TARGET_IP:$ISCSI_PORT iscsiadm -m node --login -p $TARGET_IP:$ISCSI_PORT -trap 'for new_dir in `dir -d /mnt/*dir`; do umount $new_dir; rm -rf $new_dir; done; \ +trap 'for new_dir in $(dir -d /mnt/*dir); do umount $new_dir; rm -rf $new_dir; done; \ iscsicleanup; killprocess $pid; iscsitestfini $1 $2; exit 1' SIGINT SIGTERM EXIT sleep 1 diff --git a/test/nvme/hotplug.sh b/test/nvme/hotplug.sh index dfe5d17bad..2350a8f0b9 100755 --- a/test/nvme/hotplug.sh +++ b/test/nvme/hotplug.sh @@ -139,7 +139,7 @@ timing_exit wait_for_example trap - SIGINT SIGTERM EXIT -qemupid=`cat "$qemu_pidfile" | awk '{printf $0}'` +qemupid=$(cat "$qemu_pidfile" | awk '{printf $0}') kill -9 $qemupid rm "$qemu_pidfile" rm "$test_img" diff --git a/test/nvme/nvme.sh b/test/nvme/nvme.sh index 755d7d1537..e8e1d2606d 100755 --- a/test/nvme/nvme.sh +++ b/test/nvme/nvme.sh @@ -28,7 +28,7 @@ function get_nvme_name_from_bdf { timing_enter nvme -if [ `uname` = Linux ]; then +if [ $(uname) = Linux ]; then # check that our setup.sh script does not bind NVMe devices to uio/vfio if they # have an active mountpoint $rootdir/scripts/setup.sh reset @@ -87,7 +87,7 @@ if [ `uname` = Linux ]; then fi fi -if [ `uname` = Linux ]; then +if [ $(uname) = Linux ]; then start_stub "-s 4096 -i 0 -m 0xF" trap "kill_stub -9; exit 1" SIGINT SIGTERM EXIT fi @@ -144,7 +144,7 @@ timing_enter arbitration $rootdir/examples/nvme/arbitration/arbitration -t 3 -i 0 timing_exit arbitration -if [ `uname` = Linux ]; then +if [ $(uname) = Linux ]; then timing_enter multi_secondary $rootdir/examples/nvme/perf/perf -i 0 -q 16 -w read -o 4096 -t 3 -c 0x1 & pid0=$! @@ -157,7 +157,7 @@ if [ `uname` = Linux ]; then timing_exit multi_secondary fi -if [ `uname` = Linux ]; then +if [ $(uname) = Linux ]; then trap - SIGINT SIGTERM EXIT kill_stub fi diff --git a/test/nvme/perf/common.sh b/test/nvme/perf/common.sh index a51c606cad..c60d7d8919 100755 --- a/test/nvme/perf/common.sh +++ b/test/nvme/perf/common.sh @@ -44,7 +44,7 @@ function get_numa_node(){ local disks=$2 if [ "$plugin" = "nvme" ]; then for bdf in $disks; do - local driver=`grep DRIVER /sys/bus/pci/devices/$bdf/uevent |awk -F"=" '{print $2}'` + local driver=$(grep DRIVER /sys/bus/pci/devices/$bdf/uevent |awk -F"=" '{print $2}') # Use this check to ommit blacklisted devices ( not binded to driver with setup.sh script ) if [ "$driver" = "vfio-pci" ] || [ "$driver" = "uio_pci_generic" ]; then echo $(cat /sys/bus/pci/devices/$bdf/numa_node) @@ -67,7 +67,7 @@ function get_disks(){ local plugin=$1 if [ "$plugin" = "nvme" ]; then for bdf in $(iter_pci_class_code 01 08 02); do - driver=`grep DRIVER /sys/bus/pci/devices/$bdf/uevent |awk -F"=" '{print $2}'` + driver=$(grep DRIVER /sys/bus/pci/devices/$bdf/uevent |awk -F"=" '{print $2}') if [ "$driver" = "vfio-pci" ] || [ "$driver" = "uio_pci_generic" ]; then echo "$bdf" fi diff --git a/test/nvme/spdk_nvme_cli.sh b/test/nvme/spdk_nvme_cli.sh index bf53cc6eb5..d1cb5f5b66 100755 --- a/test/nvme/spdk_nvme_cli.sh +++ b/test/nvme/spdk_nvme_cli.sh @@ -21,7 +21,7 @@ fi timing_enter nvme_cli -if [ `uname` = Linux ]; then +if [ $(uname) = Linux ]; then start_stub "-s 2048 -i 0 -m 0xF" trap "kill_stub; exit 1" SIGINT SIGTERM EXIT fi @@ -49,7 +49,7 @@ sed -i 's/shm_id=.*/shm_id=0/g' spdk.conf ./nvme get-feature $bdf -n 1 -f 1 -s 1 -l 100 ./nvme get-log $bdf -n 1 -i 1 -l 100 ./nvme reset $bdf -if [ `uname` = Linux ]; then +if [ $(uname) = Linux ]; then trap - SIGINT SIGTERM EXIT kill_stub fi diff --git a/test/nvmf/common.sh b/test/nvmf/common.sh index c7c01c4148..8227ef1680 100755 --- a/test/nvmf/common.sh +++ b/test/nvmf/common.sh @@ -12,7 +12,7 @@ have_pci_nics=0 function load_ib_rdma_modules() { - if [ `uname` != Linux ]; then + if [ $(uname) != Linux ]; then return 0 fi @@ -53,7 +53,7 @@ function detect_nics_and_probe_drivers() NIC_VENDOR="$1" NIC_CLASS="$2" - nvmf_nic_bdfs=`lspci | grep Ethernet | grep "$NIC_VENDOR" | grep "$NIC_CLASS" | awk -F ' ' '{print "0000:"$1}'` + nvmf_nic_bdfs=$(lspci | grep Ethernet | grep "$NIC_VENDOR" | grep "$NIC_CLASS" | awk -F ' ' '{print "0000:"$1}') if [ -z "$nvmf_nic_bdfs" ]; then return 0 @@ -123,8 +123,8 @@ function get_available_rdma_ips() function get_rdma_if_list() { - for nic_type in `ls /sys/class/infiniband`; do - for nic_name in `ls /sys/class/infiniband/${nic_type}/device/net`; do + for nic_type in $(ls /sys/class/infiniband); do + for nic_name in $(ls /sys/class/infiniband/${nic_type}/device/net); do echo "$nic_name" done done diff --git a/test/nvmf/target/filesystem.sh b/test/nvmf/target/filesystem.sh index 5ea8c5583a..2e11c55762 100755 --- a/test/nvmf/target/filesystem.sh +++ b/test/nvmf/target/filesystem.sh @@ -32,7 +32,7 @@ for incapsule in 0 4096; do mkdir -p /mnt/device - devs=`lsblk -l -o NAME | grep nvme` + devs=$(lsblk -l -o NAME | grep nvme) for dev in $devs; do timing_enter parted diff --git a/test/nvmf/target/multiconnection.sh b/test/nvmf/target/multiconnection.sh index c3a6efe103..1ca6cbba49 100755 --- a/test/nvmf/target/multiconnection.sh +++ b/test/nvmf/target/multiconnection.sh @@ -28,7 +28,7 @@ fi $rpc_py nvmf_create_transport -t $TEST_TRANSPORT -u 8192 -for i in `seq 1 $NVMF_SUBSYS` +for i in $(seq 1 $NVMF_SUBSYS) do $rpc_py construct_malloc_bdev $MALLOC_BDEV_SIZE $MALLOC_BLOCK_SIZE -b Malloc$i $rpc_py nvmf_subsystem_create nqn.2016-06.io.spdk:cnode$i -a -s SPDK$i @@ -36,7 +36,7 @@ do $rpc_py nvmf_subsystem_add_listener nqn.2016-06.io.spdk:cnode$i -t $TEST_TRANSPORT -a $NVMF_FIRST_TARGET_IP -s $NVMF_PORT done -for i in `seq 1 $NVMF_SUBSYS`; do +for i in $(seq 1 $NVMF_SUBSYS); do k=$[$i-1] nvme connect -t $TEST_TRANSPORT -n "nqn.2016-06.io.spdk:cnode${i}" -a "$NVMF_FIRST_TARGET_IP" -s "$NVMF_PORT" @@ -47,7 +47,7 @@ $rootdir/scripts/fio.py -p nvmf -i 262144 -d 64 -t read -r 10 $rootdir/scripts/fio.py -p nvmf -i 262144 -d 64 -t randwrite -r 10 sync -for i in `seq 1 $NVMF_SUBSYS`; do +for i in $(seq 1 $NVMF_SUBSYS); do nvme disconnect -n "nqn.2016-06.io.spdk:cnode${i}" || true $rpc_py delete_nvmf_subsystem nqn.2016-06.io.spdk:cnode${i} done diff --git a/test/nvmf/target/rpc.sh b/test/nvmf/target/rpc.sh index a51c24566a..96a91cb2e6 100755 --- a/test/nvmf/target/rpc.sh +++ b/test/nvmf/target/rpc.sh @@ -55,7 +55,7 @@ nvme disconnect -n nqn.2016-06.io.spdk:cnode1 $rpc_py delete_nvmf_subsystem nqn.2016-06.io.spdk:cnode1 # do frequent add delete of namespaces with different nsid. -for i in `seq 1 $times` +for i in $(seq 1 $times) do $rpc_py nvmf_subsystem_create nqn.2016-06.io.spdk:cnode1 -s SPDK00000000000001 $rpc_py nvmf_subsystem_add_listener nqn.2016-06.io.spdk:cnode1 -t $TEST_TRANSPORT -a $NVMF_FIRST_TARGET_IP -s $NVMF_PORT @@ -75,7 +75,7 @@ done nvmfcleanup # do frequent add delete. -for i in `seq 1 $times` +for i in $(seq 1 $times) do $rpc_py nvmf_subsystem_create nqn.2016-06.io.spdk:cnode1 -s SPDK00000000000001 $rpc_py nvmf_subsystem_add_listener nqn.2016-06.io.spdk:cnode1 -t $TEST_TRANSPORT -a $NVMF_FIRST_TARGET_IP -s $NVMF_PORT diff --git a/test/nvmf/target/shutdown.sh b/test/nvmf/target/shutdown.sh index 26d098ee38..320c284273 100755 --- a/test/nvmf/target/shutdown.sh +++ b/test/nvmf/target/shutdown.sh @@ -56,7 +56,7 @@ echo "[Nvme]" > $testdir/bdevperf.conf timing_enter create_subsystems # Create subsystems rm -rf $testdir/rpcs.txt -for i in `seq 1 $num_subsystems` +for i in $(seq 1 $num_subsystems) do echo construct_malloc_bdev $MALLOC_BDEV_SIZE $MALLOC_BLOCK_SIZE -b Malloc$i >> $testdir/rpcs.txt echo nvmf_subsystem_create nqn.2016-06.io.spdk:cnode$i -a -s SPDK$i >> $testdir/rpcs.txt diff --git a/test/vhost/hotplug/common.sh b/test/vhost/hotplug/common.sh index 690cb306ad..1f094fb768 100644 --- a/test/vhost/hotplug/common.sh +++ b/test/vhost/hotplug/common.sh @@ -158,7 +158,7 @@ function check_fio_retcode() { function wait_for_finish() { local wait_for_pid=$1 local sequence=${2:-30} - for i in `seq 1 $sequence`; do + for i in $(seq 1 $sequence); do if kill -0 $wait_for_pid; then sleep 0.5 continue diff --git a/test/vhost/manual.sh b/test/vhost/manual.sh index fb105b3ffa..03d441d695 100755 --- a/test/vhost/manual.sh +++ b/test/vhost/manual.sh @@ -49,7 +49,7 @@ if [[ ! -r "${VM_IMAGE}" ]]; then exit 1 fi -DISKS_NUMBER=`lspci -mm -n | grep 0108 | tr -d '"' | awk -F " " '{print "0000:"$1}'| wc -l` +DISKS_NUMBER=$(lspci -mm -n | grep 0108 | tr -d '"' | awk -F " " '{print "0000:"$1}'| wc -l) WORKDIR=$(readlink -f $(dirname $0)) diff --git a/test/vhost/perf_bench/vhost_perf.sh b/test/vhost/perf_bench/vhost_perf.sh index 340bbc450f..26f3ee3074 100755 --- a/test/vhost/perf_bench/vhost_perf.sh +++ b/test/vhost/perf_bench/vhost_perf.sh @@ -175,11 +175,11 @@ if [[ $vm_count -le $max_disks ]]; then done else #Calculate least minimum number of splits on each disks - for i in `seq 0 $((max_disks - 1))`; do + for i in $(seq 0 $((max_disks - 1))); do splits+=( $((vm_count / max_disks)) ) done # Split up the remainder - for i in `seq 0 $((vm_count % max_disks - 1))`; do + for i in $(seq 0 $((vm_count % max_disks - 1))); do (( splits[i]++ )) done fi