diff options
author | George Amanakis <[email protected]> | 2020-10-05 18:29:05 -0400 |
---|---|---|
committer | GitHub <[email protected]> | 2020-10-05 15:29:05 -0700 |
commit | a76e4e676180acad9e12f5a1e03f5ff48ec85983 (patch) | |
tree | 9872835cd6d2b2b3aab83b2d1f963cb4fd52faeb /tests/zfs-tests/include/libtest.shlib | |
parent | 4e84f67a96837008735e988b84309f9b292de26f (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/libtest.shlib')
-rw-r--r-- | tests/zfs-tests/include/libtest.shlib | 39 |
1 files changed, 39 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. # |