From 4b3a6e876c814b2e55f9053094ef435d8bd37363 Mon Sep 17 00:00:00 2001 From: Maciej Wawryk Date: Thu, 10 Oct 2019 07:37:35 +0200 Subject: [PATCH] test: Shellcheck - correct rule: Useless echo Correct shellcheck rule SC2005: Useless echo? Instead of echo $(cmd), just use cmd Signed-off-by: Maciej Wawryk Change-Id: I60c05915691a339cced6d4e3694514857b2d1c4e Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/470899 Tested-by: SPDK CI Jenkins Reviewed-by: Tomasz Zawadzki Reviewed-by: Jim Harris Reviewed-by: Ben Walker Reviewed-by: Karol Latecki Reviewed-by: Shuhei Matsumoto --- scripts/check_format.sh | 2 +- test/ftl/common.sh | 4 ++-- test/nvme/perf/common.sh | 12 ++++++------ 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/scripts/check_format.sh b/scripts/check_format.sh index 351ec753f..281262073 100755 --- a/scripts/check_format.sh +++ b/scripts/check_format.sh @@ -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="SC1001,SC1003,\ -SC1083,SC1113,SC2001,SC2002,SC2003,SC2004,SC2005,\ +SC1083,SC1113,SC2001,SC2002,SC2003,SC2004,\ SC2010,SC2012,SC2013,SC2016,\ SC2034,SC2045,SC2046,\ SC2068,SC2086,SC2089,SC2090,\ diff --git a/test/ftl/common.sh b/test/ftl/common.sh index 9c4193a90..cea25a154 100644 --- a/test/ftl/common.sh +++ b/test/ftl/common.sh @@ -1,8 +1,8 @@ # Common utility functions to be sourced by the libftl test scripts function get_chunk_size() { - echo $($rootdir/examples/nvme/identify/identify -r "trtype:PCIe traddr:$1" | \ - grep 'Logical blks per chunk' | sed 's/[^0-9]//g') + $rootdir/examples/nvme/identify/identify -r "trtype:PCIe traddr:$1" | + grep 'Logical blks per chunk' | sed 's/[^0-9]//g' } function has_separate_md() { diff --git a/test/nvme/perf/common.sh b/test/nvme/perf/common.sh index d832334cc..7dd102557 100755 --- a/test/nvme/perf/common.sh +++ b/test/nvme/perf/common.sh @@ -43,7 +43,7 @@ function get_cores(){ function get_cores_numa_node(){ local cores=$1 for core in $cores; do - echo $(lscpu -p=cpu,node | grep "^$core\b" | awk -F ',' '{print $2}') + lscpu -p=cpu,node | grep "^$core\b" | awk -F ',' '{print $2}' done } @@ -55,20 +55,20 @@ function get_numa_node(){ 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) + cat /sys/bus/pci/devices/$bdf/numa_node fi done elif [ "$plugin" = "bdev" ] || [ "$plugin" = "bdevperf" ]; then local bdevs=$(discover_bdevs $ROOT_DIR $BASE_DIR/bdev.conf) for name in $disks; do local bdev_bdf=$(jq -r ".[] | select(.name==\"$name\").driver_specific.nvme.pci_address" <<< $bdevs) - echo $(cat /sys/bus/pci/devices/$bdev_bdf/numa_node) + cat /sys/bus/pci/devices/$bdev_bdf/numa_node done else # Only target not mounted NVMes for bdf in $(iter_pci_class_code 01 08 02); do if is_bdf_not_mounted $bdf; then - echo $(cat /sys/bus/pci/devices/$bdf/numa_node) + cat /sys/bus/pci/devices/$bdf/numa_node fi done fi @@ -85,7 +85,7 @@ function get_disks(){ done elif [ "$plugin" = "bdev" ] || [ "$plugin" = "bdevperf" ]; then local bdevs=$(discover_bdevs $ROOT_DIR $BASE_DIR/bdev.conf) - echo $(jq -r '.[].name' <<< $bdevs) + jq -r '.[].name' <<< $bdevs else # Only target not mounted NVMes for bdf in $(iter_pci_class_code 01 08 02); do @@ -297,7 +297,7 @@ function run_nvme_fio(){ function run_bdevperf(){ echo "** Running bdevperf test, this can take a while, depending on the run-time setting." - echo $($BDEVPERF_DIR/bdevperf -c $BASE_DIR/bdev.conf -q $IODEPTH -o $BLK_SIZE -w $RW -M $MIX -t $RUNTIME) + $BDEVPERF_DIR/bdevperf -c $BASE_DIR/bdev.conf -q $IODEPTH -o $BLK_SIZE -w $RW -M $MIX -t $RUNTIME sleep 1 }