From 6ed4391da97a1d183dbabcbe667026deb6678612 Mon Sep 17 00:00:00 2001 From: Ryan Moeller Date: Thu, 30 Apr 2020 20:50:16 -0400 Subject: [PATCH] ZTS: Count CKSUM for all vdevs in verify_pool The verify_pool function should detect checksum errors on any vdev, but it was only checking at the root of the pool. Accumulate the errors for all vdevs to obtain the correct count. Reviewed-by: John Kennedy Reviewed-by: Brian Behlendorf Signed-off-by: Ryan Moeller Closes #10271 --- tests/zfs-tests/include/libtest.shlib | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tests/zfs-tests/include/libtest.shlib b/tests/zfs-tests/include/libtest.shlib index f917c58129af..9fbcc37c610c 100644 --- a/tests/zfs-tests/include/libtest.shlib +++ b/tests/zfs-tests/include/libtest.shlib @@ -2029,7 +2029,12 @@ function verify_pool log_must zpool scrub $pool log_must wait_scrubbed $pool - cksum=$(zpool status $pool | awk 'L{print $NF;L=0} /CKSUM$/{L=1}') + typeset -i cksum=$(zpool status $pool | awk ' + !NF { isvdev = 0 } + isvdev { errors += $NF } + /CKSUM$/ { isvdev = 1 } + END { print errors } + ') if [[ $cksum != 0 ]]; then log_must zpool status -v log_fail "Unexpected CKSUM errors found on $pool ($cksum)"