From d352c44ad0a8eeac3fd760c16f1cdec7bd3727c1 Mon Sep 17 00:00:00 2001 From: Maciej Wawryk Date: Tue, 5 Nov 2019 14:21:11 +0100 Subject: [PATCH] test: Shellcheck - correct rule: Consider using grep -c Correct shellcheck rule SC2126: Consider using grep -c instead of grep|wc. Signed-off-by: Maciej Wawryk Change-Id: Iceeef8b4fae984a95543d8d4b9fcbf90e9c073aa Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/473289 Tested-by: SPDK CI Jenkins Reviewed-by: Jim Harris Reviewed-by: Ben Walker --- scripts/check_format.sh | 2 +- test/iscsi_tgt/common.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/check_format.sh b/scripts/check_format.sh index 4e6470360..a64a24603 100755 --- a/scripts/check_format.sh +++ b/scripts/check_format.sh @@ -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,SC2126,SC2128,\ +SC2097,SC2098,SC2119,SC2120,SC2128,\ SC2129,SC2140,SC2142,SC2143,SC2154,SC2155,\ SC2162" # SPDK fails some error checks which have been deprecated in later versions of shellcheck. diff --git a/test/iscsi_tgt/common.sh b/test/iscsi_tgt/common.sh index f7e6f3aa6..d1c2c95d3 100644 --- a/test/iscsi_tgt/common.sh +++ b/test/iscsi_tgt/common.sh @@ -79,7 +79,7 @@ function waitforiscsidevices() { local num=$1 for ((i=1; i<=20; i++)); do - n=$( iscsiadm -m session -P 3 | grep "Attached scsi disk sd[a-z]*" | wc -l ) + n=$( iscsiadm -m session -P 3 | grep -c "Attached scsi disk sd[a-z]*" || true) if [ $n -ne $num ]; then sleep 0.1 else