aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorнаб <[email protected]>2021-05-14 14:02:11 +0200
committerBrian Behlendorf <[email protected]>2021-05-20 08:55:23 -0700
commit6fc3099248f04591d7d7bf05078482f794b38eaa (patch)
tree6422a50bc2a6de2e3f87444ecebd01f267433868 /tests
parent2ca77988a5584440b9d322ebb26ab55c730637bf (diff)
Trim excess shellcheck annotations. Widen to all non-Korn scripts
Before, make shellcheck checked scripts/{commitcheck,make_gitrev,man-dates,paxcheck,zfs-helpers,zfs, zfs-tests,zimport,zloop}.sh cmd/zed/zed.d/{{all-debug,all-syslog,data-notify,generic-notify, resilver_finish-start-scrub,scrub_finish-notify, statechange-led,statechange-notify,trim_finish-notify, zed-functions}.sh,history_event-zfs-list-cacher.sh.in} cmd/zpool/zpool.d/{dm-deps,iostat,lsblk,media,ses,smart,upath} now it also checks contrib/dracut/{02zfsexpandknowledge/module-setup, 90zfs/{export-zfs,parse-zfs,zfs-needshutdown, zfs-load-key,zfs-lib,module-setup, mount-zfs,zfs-generator}}.sh.in cmd/zed/zed.d/{pool_import-led,vdev_attach-led, resilver_finish-notify,vdev_clear-led}.sh contrib/initramfs/{zfsunlock,hooks/zfs.in,scripts/local-top/zfs} tests/zfs-tests/tests/perf/scripts/prefetch_io.sh scripts/common.sh.in contrib/bpftrace/zfs-trace.sh autogen.sh Reviewed-by: John Kennedy <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Ahelenia Ziemiańska <[email protected]> Closes #12042
Diffstat (limited to 'tests')
-rwxr-xr-xtests/zfs-tests/tests/functional/cli_root/zpool_events/zpool_events_duplicates.ksh3
-rwxr-xr-xtests/zfs-tests/tests/perf/scripts/prefetch_io.sh38
2 files changed, 20 insertions, 21 deletions
diff --git a/tests/zfs-tests/tests/functional/cli_root/zpool_events/zpool_events_duplicates.ksh b/tests/zfs-tests/tests/functional/cli_root/zpool_events/zpool_events_duplicates.ksh
index d4194a5b8..595eacf5b 100755
--- a/tests/zfs-tests/tests/functional/cli_root/zpool_events/zpool_events_duplicates.ksh
+++ b/tests/zfs-tests/tests/functional/cli_root/zpool_events/zpool_events_duplicates.ksh
@@ -102,8 +102,7 @@ function do_dup_test
# Read the file a few times to generate some
# duplicate errors of the same blocks
- # shellcheck disable=SC2034
- for i in {1..15}; do
+ for _ in {1..15}; do
dd if=$FILEPATH of=/dev/null bs=128K > /dev/null 2>&1
done
log_must zinject -c all
diff --git a/tests/zfs-tests/tests/perf/scripts/prefetch_io.sh b/tests/zfs-tests/tests/perf/scripts/prefetch_io.sh
index b8d8ae885..d8181f2e8 100755
--- a/tests/zfs-tests/tests/perf/scripts/prefetch_io.sh
+++ b/tests/zfs-tests/tests/perf/scripts/prefetch_io.sh
@@ -1,4 +1,5 @@
#!/usr/bin/env bash
+# shellcheck disable=SC1004
#
# This file and its contents are supplied under the terms of the
@@ -24,38 +25,37 @@ zfs_kstats="/proc/spl/kstat/zfs"
function get_prefetch_ios
{
- typeset -l data_misses=`awk '$1 == "prefetch_data_misses" \
- { print $3 }' $zfs_kstats/arcstats`
- typeset -l metadata_misses=`awk '$1 == "prefetch_metadata_misses" \
- { print $3 }' $zfs_kstats/arcstats`
- typeset -l total_misses=$(( $data_misses + $metadata_misses ))
+ typeset -l data_misses="$(awk '$1 == "prefetch_data_misses" \
+ { print $3; exit }' "$zfs_kstats/arcstats")"
+ typeset -l metadata_misses="$(awk '$1 == "prefetch_metadata_misses" \
+ { print $3; exit }' "$zfs_kstats/arcstats")"
+ typeset -l total_misses=$(( data_misses + metadata_misses ))
- echo $total_misses
+ echo "$total_misses"
}
function get_prefetched_demand_reads
{
- typeset -l demand_reads=`awk '$1 == "demand_hit_predictive_prefetch" \
- { print $3 }' $zfs_kstats/arcstats`
+ typeset -l demand_reads="$(awk '$1 == "demand_hit_predictive_prefetch" \
+ { print $3; exit }' "$zfs_kstats/arcstats")"
- echo $demand_reads
+ echo "$demand_reads"
}
function get_async_upgrade_sync
{
- typeset -l sync_wait=`awk '$1 == "async_upgrade_sync" \
- { print $3 }' $zfs_kstats/arcstats`
+ typeset -l sync_wait="$(awk '$1 == "async_upgrade_sync" \
+ { print $3; exit }' "$zfs_kstats/arcstats")"
- echo $sync_wait
+ echo "$sync_wait"
}
if [ $# -ne 2 ]
then
- echo "Usage: `basename $0` <poolname> interval" >&2
+ echo "Usage: ${0##*/} poolname interval" >&2
exit 1
fi
-poolname=$1
interval=$2
prefetch_ios=$(get_prefetch_ios)
prefetched_demand_reads=$(get_prefetched_demand_reads)
@@ -64,19 +64,19 @@ async_upgrade_sync=$(get_async_upgrade_sync)
while true
do
new_prefetch_ios=$(get_prefetch_ios)
- printf "%u\n%-24s\t%u\n" $(date +%s) "prefetch_ios" \
- $(( $new_prefetch_ios - $prefetch_ios ))
+ printf "%u\n%-24s\t%u\n" "$(date +%s)" "prefetch_ios" \
+ $(( new_prefetch_ios - prefetch_ios ))
prefetch_ios=$new_prefetch_ios
new_prefetched_demand_reads=$(get_prefetched_demand_reads)
printf "%-24s\t%u\n" "prefetched_demand_reads" \
- $(( $new_prefetched_demand_reads - $prefetched_demand_reads ))
+ $(( new_prefetched_demand_reads - prefetched_demand_reads ))
prefetched_demand_reads=$new_prefetched_demand_reads
new_async_upgrade_sync=$(get_async_upgrade_sync)
printf "%-24s\t%u\n" "async_upgrade_sync" \
- $(( $new_async_upgrade_sync - $async_upgrade_sync ))
+ $(( new_async_upgrade_sync - async_upgrade_sync ))
async_upgrade_sync=$new_async_upgrade_sync
- sleep $interval
+ sleep "$interval"
done