From b60e465b8d43cffbcb2f5478e92cf891c9d330d4 Mon Sep 17 00:00:00 2001 From: Arshad Hussain Date: Wed, 16 Mar 2022 12:53:13 +0530 Subject: [PATCH] LU-15626 tests: Fix "error" reported by shellcheck(2) 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 Change-Id: I4d129f26493bc17ee6d5988ae234dace149dfdd3 Reviewed-on: https://review.whamcloud.com/46814 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Andreas Dilger Reviewed-by: James Nunez Reviewed-by: Oleg Drokin --- lustre/tests/large-scale.sh | 4 ++-- lustre/tests/lnet-selftest.sh | 16 ++++++++-------- lustre/tests/oos2.sh | 8 ++++---- lustre/tests/racer.sh | 4 ++-- lustre/tests/sanity-scrub.sh | 20 ++++++++++---------- 5 files changed, 26 insertions(+), 26 deletions(-) diff --git a/lustre/tests/large-scale.sh b/lustre/tests/large-scale.sh index ff913b7..0eede94 100644 --- a/lustre/tests/large-scale.sh +++ b/lustre/tests/large-scale.sh @@ -8,7 +8,7 @@ CLEANUP=${CLEANUP:-""} LUSTRE=${LUSTRE:-$(dirname $0)/..} . $LUSTRE/tests/test-framework.sh -init_test_env $@ +init_test_env "$@" init_logging ALWAYS_EXCEPT="$LARGE_SCALE_EXCEPT " @@ -56,7 +56,7 @@ test_3a() { 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" diff --git a/lustre/tests/lnet-selftest.sh b/lustre/tests/lnet-selftest.sh index 8e25ed4..dd3ec2b 100755 --- a/lustre/tests/lnet-selftest.sh +++ b/lustre/tests/lnet-selftest.sh @@ -2,7 +2,7 @@ LUSTRE=${LUSTRE:-$(dirname $0)/..} . $LUSTRE/tests/test-framework.sh -init_test_env $@ +init_test_env "$@" 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="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 - [ $smoke_DURATION -le 300 ] || smoke_DURATION=300 + [ $smoke_DURATION -le 300 ] || smoke_DURATION=300 fi lst_TESTS=${lst_TESTS:-"write read ping"} @@ -89,9 +89,9 @@ if is_mounted $MOUNT2; then 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 diff --git a/lustre/tests/oos2.sh b/lustre/tests/oos2.sh index d96f934..5e3d3bb 100644 --- a/lustre/tests/oos2.sh +++ b/lustre/tests/oos2.sh @@ -4,7 +4,7 @@ set -e LUSTRE=${LUSTRE:-$(dirname $0)/..} . $LUSTRE/tests/test-framework.sh -init_test_env $@ +init_test_env "$@" MOUNT=${MOUNT:-$1} MOUNT=${MOUNT:-/mnt/lustre} @@ -62,13 +62,13 @@ if ! oos_full; then 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 - 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 diff --git a/lustre/tests/racer.sh b/lustre/tests/racer.sh index b1c07c3..2a13c65 100644 --- a/lustre/tests/racer.sh +++ b/lustre/tests/racer.sh @@ -5,7 +5,7 @@ ONLY=${ONLY:-"$*"} LUSTRE=${LUSTRE:-$(dirname $0)/..} . $LUSTRE/tests/test-framework.sh -init_test_env $@ +init_test_env "$@" 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 - echo Victim facets ${victims[@]} + echo Victim facets "${victims[@]}" fi if ((MDSCOUNT > 1)); then diff --git a/lustre/tests/sanity-scrub.sh b/lustre/tests/sanity-scrub.sh index b6fbd57..8796cb4 100644 --- a/lustre/tests/sanity-scrub.sh +++ b/lustre/tests/sanity-scrub.sh @@ -10,7 +10,7 @@ ONLY=${ONLY:-"$*"} LUSTRE=${LUSTRE:-$(dirname $0)/..} . $LUSTRE/tests/test-framework.sh -init_test_env $@ +init_test_env "$@" 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 -[[ $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 @@ -924,7 +924,7 @@ test_9() { 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 @@ -946,14 +946,14 @@ test_9() { # 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 - 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 }') -- 1.8.3.1