summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorIgor Kozhukhov <[email protected]>2016-06-09 16:38:35 -0400
committerBrian Behlendorf <[email protected]>2017-02-13 11:49:09 -0800
commit0dc8347c30475c9b50061343e15bab428a2005ee (patch)
treefa517b663df33ec909f4f25097a317453e45cf82 /tests
parent37bb2fc7dc794536dbdad0375557cdb48924519b (diff)
OpenZFS 7036 - zvol_swap_004_pos test failed
Authored by: Igor Kozhukhov <[email protected]> Reviewed by: - John Kennedy <[email protected]> Approved by: - Dan McDonald <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Ported-by: George Melikov <[email protected]> OpenZFS-issue: https://www.illumos.org/issues/7036 OpenZFS-commit: https://github.com/openzfs/openzfs/commit/3f85b2a Closes #5783
Diffstat (limited to 'tests')
-rwxr-xr-xtests/zfs-tests/tests/functional/zvol/zvol_swap/zvol_swap_004_pos.ksh32
1 files changed, 12 insertions, 20 deletions
diff --git a/tests/zfs-tests/tests/functional/zvol/zvol_swap/zvol_swap_004_pos.ksh b/tests/zfs-tests/tests/functional/zvol/zvol_swap/zvol_swap_004_pos.ksh
index 5fc777a47..94e598dec 100755
--- a/tests/zfs-tests/tests/functional/zvol/zvol_swap/zvol_swap_004_pos.ksh
+++ b/tests/zfs-tests/tests/functional/zvol/zvol_swap/zvol_swap_004_pos.ksh
@@ -30,26 +30,29 @@
#
. $STF_SUITE/include/libtest.shlib
+. $STF_SUITE/tests/functional/zvol/zvol_common.shlib
#
# DESCRIPTION:
-# When a swap zvol is added it is resized to be equal to 1/4 c_max,
-# capped between 2G and 16G.
+# When a swap zvol is added its volsize does not change.
#
# STRATEGY:
# 1. Determine what 1/4 arc_c_max is.
# 2. Create a zvols in a variety of sizes.
-# 3. Add them as swap, and verify the volsize is resized correctly.
+# 3. Add them as swap, and verify the volsize is not changed.
#
verify_runnable "global"
+function cleanup
+{
+ is_swap_inuse $swapname && log_must $SWAP -d $swapname
+ datasetexists $vol && log_must $ZFS destroy $vol
+}
+
log_assert "For an added swap zvol, (2G <= volsize <= 16G)"
-typeset -i min max mem
-((mem = $($KSTAT -p ::arcstats:c_max | $AWK '{print $2}') / 4))
-((min = 2 * 1024 * 1024 * 1024))
-((max = 16 * 1024 * 1024 * 1024))
+log_onexit cleanup
for vbs in 512 1024 2048 4096 8192 16384 32768 65536 131072; do
for multiplier in 1 32 16384 131072; do
@@ -61,19 +64,8 @@ for vbs in 512 1024 2048 4096 8192 16384 32768 65536 131072; do
log_must $ZFS create -s -b $vbs -V $volsize $vol
log_must $SWAP -a $swapname
- if ((mem <= min)); then # volsize should be 2G
- new_volsize=$(get_prop volsize $vol)
- ((new_volsize == min)) || log_fail \
- "Unexpected volsize: $new_volsize"
- elif ((mem >= max)); then # volsize should be 16G
- new_volsize=$(get_prop volsize $vol)
- ((new_volsize == max)) || log_fail \
- "Unexpected volsize: $new_volsize"
- else # volsize should be 'mem'
- new_volsize=$(get_prop volsize $vol)
- ((new_volsize == mem)) || log_fail \
- "Unexpected volsize: $new_volsize"
- fi
+ new_volsize=$(get_prop volsize $vol)
+ [[ $volsize -eq $new_volsize ]] || log_fail "$volsize $new_volsize"
log_must $SWAP -d $swapname
log_must $ZFS destroy $vol