aboutsummaryrefslogtreecommitdiffstats
path: root/tests/zfs-tests/include
diff options
context:
space:
mode:
authorGeorge Amanakis <[email protected]>2020-10-05 18:29:05 -0400
committerGitHub <[email protected]>2020-10-05 15:29:05 -0700
commita76e4e676180acad9e12f5a1e03f5ff48ec85983 (patch)
tree9872835cd6d2b2b3aab83b2d1f963cb4fd52faeb /tests/zfs-tests/include
parent4e84f67a96837008735e988b84309f9b292de26f (diff)
Make L2ARC tests more robust
Instead of relying on arbitrary timers after pool export/import or cache device off/online rely on arcstats. This makes the L2ARC tests more robust. Also cleanup some functions related to persistent L2ARC. Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: Adam Moss <[email protected]> Signed-off-by: George Amanakis <[email protected]> Closes #10983
Diffstat (limited to 'tests/zfs-tests/include')
-rw-r--r--tests/zfs-tests/include/libtest.shlib39
-rw-r--r--tests/zfs-tests/include/tunables.cfg1
2 files changed, 40 insertions, 0 deletions
diff --git a/tests/zfs-tests/include/libtest.shlib b/tests/zfs-tests/include/libtest.shlib
index 1618c92bd..9898bada9 100644
--- a/tests/zfs-tests/include/libtest.shlib
+++ b/tests/zfs-tests/include/libtest.shlib
@@ -4174,6 +4174,45 @@ function get_arcstat # stat
}
#
+# Wait for the specified arcstat to reach non-zero quiescence.
+# If echo is 1 echo the value after reaching quiescence, otherwise
+# if echo is 0 print the arcstat we are waiting on.
+#
+function arcstat_quiescence # stat echo
+{
+ typeset stat=$1
+ typeset echo=$2
+ typeset do_once=true
+
+ if [[ $echo -eq 0 ]]; then
+ echo "Waiting for arcstat $1 quiescence."
+ fi
+
+ while $do_once || [ $stat1 -ne $stat2 ] || [ $stat2 -eq 0 ]; do
+ typeset stat1=$(get_arcstat $stat)
+ sleep 2
+ typeset stat2=$(get_arcstat $stat)
+ do_once=false
+ done
+
+ if [[ $echo -eq 1 ]]; then
+ echo $stat2
+ fi
+}
+
+function arcstat_quiescence_noecho # stat
+{
+ typeset stat=$1
+ arcstat_quiescence $stat 0
+}
+
+function arcstat_quiescence_echo # stat
+{
+ typeset stat=$1
+ arcstat_quiescence $stat 1
+}
+
+#
# Given an array of pids, wait until all processes
# have completed and check their return status.
#
diff --git a/tests/zfs-tests/include/tunables.cfg b/tests/zfs-tests/include/tunables.cfg
index 248a9fb3a..b9e7fe2df 100644
--- a/tests/zfs-tests/include/tunables.cfg
+++ b/tests/zfs-tests/include/tunables.cfg
@@ -59,6 +59,7 @@ MULTIHOST_HISTORY multihost.history zfs_multihost_history
MULTIHOST_IMPORT_INTERVALS multihost.import_intervals zfs_multihost_import_intervals
MULTIHOST_INTERVAL multihost.interval zfs_multihost_interval
OVERRIDE_ESTIMATE_RECORDSIZE send.override_estimate_recordsize zfs_override_estimate_recordsize
+PREFETCH_DISABLE prefetch.disable zfs_prefetch_disable
REMOVAL_SUSPEND_PROGRESS removal_suspend_progress zfs_removal_suspend_progress
REMOVE_MAX_SEGMENT remove_max_segment zfs_remove_max_segment
RESILVER_MIN_TIME_MS resilver_min_time_ms zfs_resilver_min_time_ms