Whamcloud - gitweb
LU-15626 tests: Fix "error" reported by shellcheck(2) 14/46814/3
authorArshad Hussain <arshad.hussain@aeoncomputing.com>
Wed, 16 Mar 2022 07:23:13 +0000 (12:53 +0530)
committerOleg Drokin <green@whamcloud.com>
Sat, 11 Jun 2022 05:50:55 +0000 (05:50 +0000)
This patch fixes "error" issues reported by shellcheck
for *.sh files. This patch also moves spaces to tabs.

Test-Parameters: trivial
Test-Parameters: testlist=sanity-scrub,sanity-dom
Test-Parameters: testlist=large-scale
Test-Parameters: testlist=lnet-selftest
Signed-off-by: Arshad Hussain <arshad.hussain@aeoncomputing.com>
Change-Id: I4d129f26493bc17ee6d5988ae234dace149dfdd3
Reviewed-on: https://review.whamcloud.com/46814
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: James Nunez <jnunez@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/tests/large-scale.sh
lustre/tests/lnet-selftest.sh
lustre/tests/oos2.sh
lustre/tests/racer.sh
lustre/tests/sanity-scrub.sh

index ff913b7..0eede94 100644 (file)
@@ -8,7 +8,7 @@ CLEANUP=${CLEANUP:-""}
 
 LUSTRE=${LUSTRE:-$(dirname $0)/..}
 . $LUSTRE/tests/test-framework.sh
 
 LUSTRE=${LUSTRE:-$(dirname $0)/..}
 . $LUSTRE/tests/test-framework.sh
-init_test_env $@
+init_test_env "$@"
 init_logging
 
 ALWAYS_EXCEPT="$LARGE_SCALE_EXCEPT "
 init_logging
 
 ALWAYS_EXCEPT="$LARGE_SCALE_EXCEPT "
@@ -56,7 +56,7 @@ test_3a() {
        chmod 0777 $dir
 
        while [ $num -le $CLIENTCOUNT ]; do
        chmod 0777 $dir
 
        while [ $num -le $CLIENTCOUNT ]; do
-               list=$(comma_list ${nodes[@]:0:$num})
+               list=$(comma_list "${nodes[@]:0:$num}")
 
                generate_machine_file $list $MACHINEFILE ||
                        error "can not generate machinefile"
 
                generate_machine_file $list $MACHINEFILE ||
                        error "can not generate machinefile"
index 8e25ed4..dd3ec2b 100755 (executable)
@@ -2,7 +2,7 @@
 
 LUSTRE=${LUSTRE:-$(dirname $0)/..}
 . $LUSTRE/tests/test-framework.sh
 
 LUSTRE=${LUSTRE:-$(dirname $0)/..}
 . $LUSTRE/tests/test-framework.sh
-init_test_env $@
+init_test_env "$@"
 init_logging
 
 ALWAYS_EXCEPT="$LNET_SELFTEST_EXCEPT"
 init_logging
 
 ALWAYS_EXCEPT="$LNET_SELFTEST_EXCEPT"
@@ -16,14 +16,14 @@ lst_LOOP=${lst_LOOP:-100000}
 lst_CONCR=${lst_CONCR:-"1 2 4 8"}
 lst_SIZES=${lst_SIZES:-"4k 8k 256k 1M"}
 if [ "$SLOW" = no ]; then
 lst_CONCR=${lst_CONCR:-"1 2 4 8"}
 lst_SIZES=${lst_SIZES:-"4k 8k 256k 1M"}
 if [ "$SLOW" = no ]; then
-    lst_CONCR="1 8"
-    lst_SIZES="4k 1M"
-    lst_LOOP=1000
+       lst_CONCR="1 8"
+       lst_SIZES="4k 1M"
+       lst_LOOP=1000
 fi
 
 smoke_DURATION=${smoke_DURATION:-1800}
 if [ "$SLOW" = no ]; then
 fi
 
 smoke_DURATION=${smoke_DURATION:-1800}
 if [ "$SLOW" = no ]; then
-    [ $smoke_DURATION -le 300 ] || smoke_DURATION=300
+       [ $smoke_DURATION -le 300 ] || smoke_DURATION=300
 fi
 
 lst_TESTS=${lst_TESTS:-"write read ping"}
 fi
 
 lst_TESTS=${lst_TESTS:-"write read ping"}
@@ -89,9 +89,9 @@ if is_mounted $MOUNT2; then
 fi
 
 lst_prepare () {
 fi
 
 lst_prepare () {
-    # Workaround for bug 15619
-    lst_cleanup_all
-    lst_setup_all
+       # Workaround for bug 15619
+       lst_cleanup_all
+       lst_setup_all
 }
 
 # make batch
 }
 
 # make batch
index d96f934..5e3d3bb 100644 (file)
@@ -4,7 +4,7 @@ set -e
 
 LUSTRE=${LUSTRE:-$(dirname $0)/..}
 . $LUSTRE/tests/test-framework.sh
 
 LUSTRE=${LUSTRE:-$(dirname $0)/..}
 . $LUSTRE/tests/test-framework.sh
-init_test_env $@
+init_test_env "$@"
 
 MOUNT=${MOUNT:-$1}
 MOUNT=${MOUNT:-/mnt/lustre}
 
 MOUNT=${MOUNT:-$1}
 MOUNT=${MOUNT:-/mnt/lustre}
@@ -62,13 +62,13 @@ if ! oos_full; then
        SUCCESS=0
 fi
 
        SUCCESS=0
 fi
 
-RECORDSOUT=$((`grep "records out" $LOG | cut -d+ -f 1` + \
+RECORDSOUT=$((`grep "records out" $LOG | cut -d+ -f 1` +
               `grep "records out" $LOG2 | cut -d+ -f 1`))
 
 FILESIZE=$((`ls -l $OOS | awk '{print $5}'` + `ls -l $OOS2 | awk '{print $5}'`))
 if [ "$RECORDSOUT" -ne $(($FILESIZE / 1024)) ]; then
               `grep "records out" $LOG2 | cut -d+ -f 1`))
 
 FILESIZE=$((`ls -l $OOS | awk '{print $5}'` + `ls -l $OOS2 | awk '{print $5}'`))
 if [ "$RECORDSOUT" -ne $(($FILESIZE / 1024)) ]; then
-        echo "ERROR: blocks written by dd not equal to the size of file"
-        SUCCESS=0
+       echo "ERROR: blocks written by dd not equal to the size of file"
+       SUCCESS=0
 fi
 
 echo LOG LOG2 file
 fi
 
 echo LOG LOG2 file
index b1c07c3..2a13c65 100644 (file)
@@ -5,7 +5,7 @@ ONLY=${ONLY:-"$*"}
 
 LUSTRE=${LUSTRE:-$(dirname $0)/..}
 . $LUSTRE/tests/test-framework.sh
 
 LUSTRE=${LUSTRE:-$(dirname $0)/..}
 . $LUSTRE/tests/test-framework.sh
-init_test_env $@
+init_test_env "$@"
 init_logging
 
 build_test_filter
 init_logging
 
 build_test_filter
@@ -35,7 +35,7 @@ if $RACER_FAILOVER; then
        for target in $FAIL_TARGETS; do
                victims=(${victims[@]} $(get_facets $target))
        done
        for target in $FAIL_TARGETS; do
                victims=(${victims[@]} $(get_facets $target))
        done
-       echo Victim facets ${victims[@]}
+       echo Victim facets "${victims[@]}"
 fi
 
 if ((MDSCOUNT > 1)); then
 fi
 
 if ((MDSCOUNT > 1)); then
index b6fbd57..8796cb4 100644 (file)
@@ -10,7 +10,7 @@ ONLY=${ONLY:-"$*"}
 
 LUSTRE=${LUSTRE:-$(dirname $0)/..}
 . $LUSTRE/tests/test-framework.sh
 
 LUSTRE=${LUSTRE:-$(dirname $0)/..}
 . $LUSTRE/tests/test-framework.sh
-init_test_env $@
+init_test_env "$@"
 init_logging
 
 ALWAYS_EXCEPT="$SANITY_SCRUB_EXCEPT"
 init_logging
 
 ALWAYS_EXCEPT="$SANITY_SCRUB_EXCEPT"
@@ -38,8 +38,8 @@ SAVED_OSTCOUNT=${OSTCOUNT}
 # use small MDS + OST size to speed formatting time
 # do not use too small MDSSIZE/OSTSIZE, which affect the default journal size
 # 400M MDT device can guarantee uninitialized groups during the OI scrub
 # use small MDS + OST size to speed formatting time
 # do not use too small MDSSIZE/OSTSIZE, which affect the default journal size
 # 400M MDT device can guarantee uninitialized groups during the OI scrub
-[[ $MDSSIZE < 400000 || "$mds1_FSTYPE" == ldiskfs ]] && MDSSIZE=400000
-[[ $OSTSIZE < 400000 || "$ost1_FSTYPE" == ldiskfs ]] && OSTSIZE=400000
+[[ $MDSSIZE -lt 400000 || "$mds1_FSTYPE" == ldiskfs ]] && MDSSIZE=400000
+[[ $OSTSIZE -lt 400000 || "$ost1_FSTYPE" == ldiskfs ]] && OSTSIZE=400000
 
 # no need too many OSTs, to reduce the format/start/stop overhead
 [ $OSTCOUNT -gt 4 ] && OSTCOUNT=4
 
 # no need too many OSTs, to reduce the format/start/stop overhead
 [ $OSTCOUNT -gt 4 ] && OSTCOUNT=4
@@ -924,7 +924,7 @@ test_9() {
        local PRE_FETCHED=1024
        local TIME_DIFF=2
        # MAX_MARGIN = 1.2 = 12 / 10
        local PRE_FETCHED=1024
        local TIME_DIFF=2
        # MAX_MARGIN = 1.2 = 12 / 10
-       local MAX_SPEED=$(((PRE_FETCHED + BASE_SPEED1 * \
+       local MAX_SPEED=$(((PRE_FETCHED + BASE_SPEED1 *
                (RUN_TIME1 + TIME_DIFF)) / RUN_TIME1 * 12 / 10))
        local n
        for n in $(seq $MDSCOUNT); do
                (RUN_TIME1 + TIME_DIFF)) / RUN_TIME1 * 12 / 10))
        local n
        for n in $(seq $MDSCOUNT); do
@@ -946,14 +946,14 @@ test_9() {
 
        # 30% margin
        local MARGIN=3
 
        # 30% margin
        local MARGIN=3
-       local MIN_SPEED=$(((PRE_FETCHED + \
-                           BASE_SPEED1 * (RUN_TIME1 - TIME_DIFF) + \
-                           BASE_SPEED2 * (RUN_TIME2 - TIME_DIFF)) / \
+       local MIN_SPEED=$(((PRE_FETCHED +
+                           BASE_SPEED1 * (RUN_TIME1 - TIME_DIFF) +
+                           BASE_SPEED2 * (RUN_TIME2 - TIME_DIFF)) /
                           (RUN_TIME1 + RUN_TIME2) * (10 - MARGIN) / 10))
        # MAX_MARGIN = 1.2 = 12 / 10
                           (RUN_TIME1 + RUN_TIME2) * (10 - MARGIN) / 10))
        # MAX_MARGIN = 1.2 = 12 / 10
-       MAX_SPEED=$(((PRE_FETCHED + \
-                     BASE_SPEED1 * (RUN_TIME1 + TIME_DIFF) + \
-                     BASE_SPEED2 * (RUN_TIME2 + TIME_DIFF)) / \
+       MAX_SPEED=$(((PRE_FETCHED +
+                     BASE_SPEED1 * (RUN_TIME1 + TIME_DIFF) +
+                     BASE_SPEED2 * (RUN_TIME2 + TIME_DIFF)) /
                     (RUN_TIME1 + RUN_TIME2) * (10 + MARGIN) / 10))
        for n in $(seq $MDSCOUNT); do
                SPEED=$(scrub_status $n | awk '/^average_speed/ { print $2 }')
                     (RUN_TIME1 + RUN_TIME2) * (10 + MARGIN) / 10))
        for n in $(seq $MDSCOUNT); do
                SPEED=$(scrub_status $n | awk '/^average_speed/ { print $2 }')