svn commit: r292368 - in projects/zfsd/head/tests/sys/cddl/zfs: include tests/cli_root/zpool_clear
Alan Somers
asomers at FreeBSD.org
Wed Dec 16 21:03:54 UTC 2015
Author: asomers
Date: Wed Dec 16 21:03:52 2015
New Revision: 292368
URL: https://svnweb.freebsd.org/changeset/base/292368
Log:
Account for the fact that zpool clear can race error stat bumps.
tests/sys/cddl/zfs/include/libtest.kshlib
tests/sys/cddl/zfs/tests/cli_root/zpool_clear/zpool_clear_001_pos.ksh
zfs_ioc_clear resets error counts, but background processes may
re-increment them. For the purposes of this test, it only
fails if the test doesn't reset.
Submitted by: Will
Sponsored by: Spectra Logic Corp
Modified:
projects/zfsd/head/tests/sys/cddl/zfs/include/libtest.kshlib
projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zpool_clear/zpool_clear_001_pos.ksh
Modified: projects/zfsd/head/tests/sys/cddl/zfs/include/libtest.kshlib
==============================================================================
--- projects/zfsd/head/tests/sys/cddl/zfs/include/libtest.kshlib Wed Dec 16 20:56:10 2015 (r292367)
+++ projects/zfsd/head/tests/sys/cddl/zfs/include/libtest.kshlib Wed Dec 16 21:03:52 2015 (r292368)
@@ -1744,6 +1744,18 @@ function pool_has_errors # pool [errors]
}
#
+# Returns whether clearing $pool at $vdev (if given) succeeds.
+#
+function pool_clear_succeeds
+{
+ typeset pool="$1"
+ typeset vdev=$2
+
+ $ZPOOL clear $pool $vdev
+ ! pool_has_errors $pool
+}
+
+#
# Return whether the pool is healthy
#
function is_pool_healthy # pool
Modified: projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zpool_clear/zpool_clear_001_pos.ksh
==============================================================================
--- projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zpool_clear/zpool_clear_001_pos.ksh Wed Dec 16 20:56:10 2015 (r292367)
+++ projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zpool_clear/zpool_clear_001_pos.ksh Wed Dec 16 21:03:52 2015 (r292368)
@@ -88,8 +88,9 @@ function test_clear
wait_for 20 1 is_pool_scrubbed $TESTPOOL1
log_must pool_has_errors $TESTPOOL1
- log_must $ZPOOL clear $TESTPOOL1 $vdev_arg
- log_mustnot pool_has_errors $TESTPOOL1
+ # zpool clear races with things that set error counts; try several
+ # times in case that race is hit.
+ wait_for 10 1 pool_clear_succeeds $TESTPOOL1 $vdev_arg
}
for devconf in "${poolconf[@]}"; do
More information about the svn-src-projects
mailing list