summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRyan Moeller <[email protected]>2020-02-13 16:52:34 -0500
committerGitHub <[email protected]>2020-02-13 13:52:34 -0800
commit4f4ddf98eeb3cf4a7b4f7a28188f24cb13074d1a (patch)
treecc94262aa09a2f09964c7f896d96cf8572be4ff3
parent71439163bb62ea1a931f8b359ded6c5b438f4baa (diff)
ZTS: Misc test fixes for FreeBSD
Add missing logic for FreeBSD to a few test scripts. Reviewed-by: John Kennedy <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Ryan Moeller <[email protected]> Closes #9994
-rw-r--r--tests/zfs-tests/tests/functional/cli_root/zfs_rollback/zfs_rollback_common.kshlib2
-rwxr-xr-xtests/zfs-tests/tests/functional/cli_root/zpool/zpool_003_pos.ksh11
-rwxr-xr-xtests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_012_neg.ksh4
-rwxr-xr-xtests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_015_neg.ksh7
-rwxr-xr-xtests/zfs-tests/tests/functional/cli_root/zpool_trim/setup.ksh20
-rwxr-xr-xtests/zfs-tests/tests/functional/pool_checkpoint/checkpoint_capacity.ksh2
-rwxr-xr-xtests/zfs-tests/tests/functional/rsend/rsend_012_pos.ksh1
-rwxr-xr-xtests/zfs-tests/tests/functional/rsend/send_realloc_encrypted_files.ksh9
-rwxr-xr-xtests/zfs-tests/tests/functional/rsend/send_realloc_files.ksh7
-rwxr-xr-xtests/zfs-tests/tests/functional/trim/setup.ksh1
-rw-r--r--tests/zfs-tests/tests/functional/zvol/zvol_misc/zvol_misc_common.kshlib2
-rw-r--r--tests/zfs-tests/tests/perf/perf.shlib60
12 files changed, 85 insertions, 41 deletions
diff --git a/tests/zfs-tests/tests/functional/cli_root/zfs_rollback/zfs_rollback_common.kshlib b/tests/zfs-tests/tests/functional/cli_root/zfs_rollback/zfs_rollback_common.kshlib
index fa494f9cb..f9512a480 100644
--- a/tests/zfs-tests/tests/functional/cli_root/zfs_rollback/zfs_rollback_common.kshlib
+++ b/tests/zfs-tests/tests/functional/cli_root/zfs_rollback/zfs_rollback_common.kshlib
@@ -116,7 +116,7 @@ function setup_snap_env
if datasetnonexists $snap; then
log_must cp /etc/passwd $fname
- if is_linux; then
+ if is_linux || is_freebsd; then
log_must sync
else
#
diff --git a/tests/zfs-tests/tests/functional/cli_root/zpool/zpool_003_pos.ksh b/tests/zfs-tests/tests/functional/cli_root/zpool/zpool_003_pos.ksh
index 5b9adf609..d51633745 100755
--- a/tests/zfs-tests/tests/functional/cli_root/zpool/zpool_003_pos.ksh
+++ b/tests/zfs-tests/tests/functional/cli_root/zpool/zpool_003_pos.ksh
@@ -42,9 +42,17 @@
# 3. Verify it run successfully.
#
+function cleanup
+{
+ if is_freebsd && [ -n "$old_corefile" ]; then
+ sysctl kern.corefile=$old_corefile
+ fi
+}
+
verify_runnable "both"
log_assert "Debugging features of zpool should succeed."
+log_onexit cleanup
log_must zpool -? > /dev/null 2>&1
@@ -67,7 +75,8 @@ if is_linux; then
export ASAN_OPTIONS="abort_on_error=1:disable_coredump=0"
elif is_freebsd; then
ulimit -c unlimited
- log_must sysctl kern.corefile=$corepath/core.zpool
+ old_corefile=$(sysctl -n kern.corefile)
+ log_must sysctl kern.corefile=core
export ASAN_OPTIONS="abort_on_error=1:disable_coredump=0"
fi
diff --git a/tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_012_neg.ksh b/tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_012_neg.ksh
index f90186d94..36888e497 100755
--- a/tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_012_neg.ksh
+++ b/tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_012_neg.ksh
@@ -50,7 +50,9 @@ function cleanup
poolexists $TESTPOOL && destroy_pool $TESTPOOL
}
-if is_linux; then
+if is_freebsd; then
+ typeset swap_disks=$(swapinfo -l | grep "/dev" | awk '{print $1}')
+elif is_linux; then
typeset swap_disks=`swapon -s | grep "/dev" | awk '{print $1}'`
else
typeset swap_disks=`swap -l | grep "c[0-9].*d[0-9].*s[0-9]" | \
diff --git a/tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_015_neg.ksh b/tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_015_neg.ksh
index 34e85e092..da6d00059 100755
--- a/tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_015_neg.ksh
+++ b/tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_015_neg.ksh
@@ -81,7 +81,12 @@ log_must zfs create -V 100m $vol_name
block_device_wait
swap_setup ${ZVOL_DEVDIR}/$vol_name
-for opt in "-n" "" "-f"; do
+if is_freebsd; then
+ typeset -a opts=("" "-f")
+else
+ typeset -a opts=("-n" "" "-f")
+fi
+for opt in "${opts[@]}"; do
log_mustnot zpool create $opt $TESTPOOL1 ${ZVOL_DEVDIR}/${vol_name}
done
diff --git a/tests/zfs-tests/tests/functional/cli_root/zpool_trim/setup.ksh b/tests/zfs-tests/tests/functional/cli_root/zpool_trim/setup.ksh
index d524c0005..09489600b 100755
--- a/tests/zfs-tests/tests/functional/cli_root/zpool_trim/setup.ksh
+++ b/tests/zfs-tests/tests/functional/cli_root/zpool_trim/setup.ksh
@@ -23,15 +23,21 @@
verify_runnable "global"
-DISK1=${DISKS%% *}
+if is_freebsd; then
+ log_unsupported "FreeBSD has no hole punching mechanism for the time being."
+ diskinfo -v $DISKS | grep -qE 'No.*# TRIM/UNMAP support' &&
+ log_unsupported "DISKS do not support discard (TRIM/UNMAP)"
+else
+ DISK1=${DISKS%% *}
-typeset -i max_discard=0
-if is_disk_device $DEV_RDSKDIR/$DISK1; then
- max_discard=$(lsblk -Dbn $DEV_RDSKDIR/$DISK1 | awk '{ print $4; exit }')
-fi
+ typeset -i max_discard=0
+ if is_disk_device $DEV_RDSKDIR/$DISK1; then
+ max_discard=$(lsblk -Dbn $DEV_RDSKDIR/$DISK1 | awk '{ print $4; exit }')
+ fi
-if test $max_discard -eq 0; then
- log_unsupported "DISKS do not support discard (TRIM/UNMAP)"
+ if test $max_discard -eq 0; then
+ log_unsupported "DISKS do not support discard (TRIM/UNMAP)"
+ fi
fi
log_pass
diff --git a/tests/zfs-tests/tests/functional/pool_checkpoint/checkpoint_capacity.ksh b/tests/zfs-tests/tests/functional/pool_checkpoint/checkpoint_capacity.ksh
index 6dd88f72d..15afc4adf 100755
--- a/tests/zfs-tests/tests/functional/pool_checkpoint/checkpoint_capacity.ksh
+++ b/tests/zfs-tests/tests/functional/pool_checkpoint/checkpoint_capacity.ksh
@@ -46,7 +46,7 @@
function test_cleanup
{
poolexists $NESTEDPOOL && destroy_pool $NESTEDPOOL
- log_must set_tunable32 SPA_ASIZE_INFLATION 24
+ set_tunable32 SPA_ASIZE_INFLATION 24
cleanup_test_pool
}
diff --git a/tests/zfs-tests/tests/functional/rsend/rsend_012_pos.ksh b/tests/zfs-tests/tests/functional/rsend/rsend_012_pos.ksh
index 24b1ed7e0..0441f7ff3 100755
--- a/tests/zfs-tests/tests/functional/rsend/rsend_012_pos.ksh
+++ b/tests/zfs-tests/tests/functional/rsend/rsend_012_pos.ksh
@@ -26,7 +26,6 @@
# Use is subject to license terms.
#
-#
. $STF_SUITE/include/properties.shlib
. $STF_SUITE/tests/functional/rsend/rsend.kshlib
diff --git a/tests/zfs-tests/tests/functional/rsend/send_realloc_encrypted_files.ksh b/tests/zfs-tests/tests/functional/rsend/send_realloc_encrypted_files.ksh
index 65fb35908..a653f8b3f 100755
--- a/tests/zfs-tests/tests/functional/rsend/send_realloc_encrypted_files.ksh
+++ b/tests/zfs-tests/tests/functional/rsend/send_realloc_encrypted_files.ksh
@@ -16,8 +16,8 @@
# Use is subject to license terms.
#
-. $STF_SUITE/include/properties.shlib
. $STF_SUITE/include/libtest.shlib
+. $STF_SUITE/include/properties.shlib
. $STF_SUITE/tests/functional/rsend/rsend.kshlib
#
@@ -67,10 +67,15 @@ log_must eval "zfs recv $POOL/newfs < $BACKDIR/fs@snap${last_snap}"
# Set atime=off to prevent the recursive_cksum from modifying newfs.
log_must zfs set atime=off $POOL/newfs
-# Due to reduced performance on debug kernels use fewer files by default.
if is_kmemleak; then
+ # Use fewer files and passes on debug kernels
+ # to avoid timeout due to reduced performance.
nr_files=100
passes=2
+elif is_freebsd; then
+ # Use fewer files and passes on FreeBSD to avoid timeout.
+ nr_files=500
+ passes=2
else
nr_files=1000
passes=3
diff --git a/tests/zfs-tests/tests/functional/rsend/send_realloc_files.ksh b/tests/zfs-tests/tests/functional/rsend/send_realloc_files.ksh
index 8e9db969b..083a2bec9 100755
--- a/tests/zfs-tests/tests/functional/rsend/send_realloc_files.ksh
+++ b/tests/zfs-tests/tests/functional/rsend/send_realloc_files.ksh
@@ -59,10 +59,15 @@ log_must eval "zfs recv $POOL/newfs < $BACKDIR/fs@snap${last_snap}"
# Set atime=off to prevent the recursive_cksum from modifying newfs.
log_must zfs set atime=off $POOL/newfs
-# Due to reduced performance on debug kernels use fewer files by default.
if is_kmemleak; then
+ # Use fewer files and passes on debug kernels
+ # to avoid timeout due to reduced performance.
nr_files=100
passes=2
+elif is_freebsd; then
+ # Use fewer passes and files on FreeBSD to avoid timeout.
+ nr_files=500
+ passes=2
else
nr_files=1000
passes=3
diff --git a/tests/zfs-tests/tests/functional/trim/setup.ksh b/tests/zfs-tests/tests/functional/trim/setup.ksh
index 52d57a766..09489600b 100755
--- a/tests/zfs-tests/tests/functional/trim/setup.ksh
+++ b/tests/zfs-tests/tests/functional/trim/setup.ksh
@@ -24,6 +24,7 @@
verify_runnable "global"
if is_freebsd; then
+ log_unsupported "FreeBSD has no hole punching mechanism for the time being."
diskinfo -v $DISKS | grep -qE 'No.*# TRIM/UNMAP support' &&
log_unsupported "DISKS do not support discard (TRIM/UNMAP)"
else
diff --git a/tests/zfs-tests/tests/functional/zvol/zvol_misc/zvol_misc_common.kshlib b/tests/zfs-tests/tests/functional/zvol/zvol_misc/zvol_misc_common.kshlib
index 505e76ca5..8fc6089b7 100644
--- a/tests/zfs-tests/tests/functional/zvol/zvol_misc/zvol_misc_common.kshlib
+++ b/tests/zfs-tests/tests/functional/zvol/zvol_misc/zvol_misc_common.kshlib
@@ -131,7 +131,7 @@ function verify_partition # device
log_fail "$device is not a block device"
fi
# create a small dummy partition
- set_partition 0 1 1m $device
+ set_partition 0 "" 1m $device
# verify we can access the partition on the device
devname="$(readlink -f "$device")"
if is_linux || is_freebsd; then
diff --git a/tests/zfs-tests/tests/perf/perf.shlib b/tests/zfs-tests/tests/perf/perf.shlib
index 78e6140c6..1c498607e 100644
--- a/tests/zfs-tests/tests/perf/perf.shlib
+++ b/tests/zfs-tests/tests/perf/perf.shlib
@@ -383,14 +383,18 @@ function get_directory
function get_min_arc_size
{
- if is_linux; then
- typeset -l min_arc_size=`awk '$1 == "c_min" { print $3 }' \
- /proc/spl/kstat/zfs/arcstats`
- else
- typeset -l min_arc_size=$(dtrace -qn 'BEGIN {
+ typeset -l min_arc_size
+
+ if is_freebsd; then
+ min_arc_size=$(sysctl -n kstat.zfs.misc.arcstats.c_min)
+ elif is_illumos; then
+ min_arc_size=$(dtrace -qn 'BEGIN {
printf("%u\n", `arc_stats.arcstat_c_min.value.ui64);
exit(0);
}')
+ elif is_linux; then
+ min_arc_size=`awk '$1 == "c_min" { print $3 }' \
+ /proc/spl/kstat/zfs/arcstats`
fi
[[ $? -eq 0 ]] || log_fail "get_min_arc_size failed"
@@ -400,14 +404,18 @@ function get_min_arc_size
function get_max_arc_size
{
- if is_linux; then
- typeset -l max_arc_size=`awk '$1 == "c_max" { print $3 }' \
- /proc/spl/kstat/zfs/arcstats`
- else
- typeset -l max_arc_size=$(dtrace -qn 'BEGIN {
+ typeset -l max_arc_size
+
+ if is_freebsd; then
+ max_arc_size=$(sysctl -n kstat.zfs.misc.arcstats.c_max)
+ elif is_illumos; then
+ max_arc_size=$(dtrace -qn 'BEGIN {
printf("%u\n", `arc_stats.arcstat_c_max.value.ui64);
exit(0);
}')
+ elif is_linux; then
+ max_arc_size=`awk '$1 == "c_max" { print $3 }' \
+ /proc/spl/kstat/zfs/arcstats`
fi
[[ $? -eq 0 ]] || log_fail "get_max_arc_size failed"
@@ -419,17 +427,17 @@ function get_max_dbuf_cache_size
{
typeset -l max_dbuf_cache_size
- if is_linux; then
- max_dbuf_cache_size=$(get_tunable DBUF_CACHE_MAX_BYTES)
- else
+ if is_illumos; then
max_dbuf_cache_size=$(dtrace -qn 'BEGIN {
printf("%u\n", `dbuf_cache_max_bytes);
exit(0);
}')
-
- [[ $? -eq 0 ]] || log_fail "get_max_dbuf_cache_size failed"
+ else
+ max_dbuf_cache_size=$(get_tunable DBUF_CACHE_MAX_BYTES)
fi
+ [[ $? -eq 0 ]] || log_fail "get_max_dbuf_cache_size failed"
+
echo $max_dbuf_cache_size
}
@@ -531,14 +539,7 @@ function pool_to_lun_list
typeset ctd ctds devname lun
typeset lun_list=':'
- if is_linux; then
- ctds=$(zpool list -HLv $pool | \
- awk '/sd[a-z]*|loop[0-9]*|dm-[0-9]*/ {print $1}')
-
- for ctd in $ctds; do
- lun_list="$lun_list$ctd:"
- done
- else
+ if is_illumos; then
ctds=$(zpool list -v $pool |
awk '/c[0-9]*t[0-9a-fA-F]*d[0-9]*/ {print $1}')
@@ -550,7 +551,18 @@ function pool_to_lun_list
# number to the list for comparison with dev_statname.
lun=$(sed 's/"//g' /etc/path_to_inst | grep \
$devname | awk '{print $3$2}')
- un_list="$lun_list$lun:"
+ lun_list="$lun_list$lun:"
+ done
+ elif is_freebsd; then
+ lun_list+=$(zpool list -HLv $pool | \
+ awk '/a?da[0-9]+|md[0-9]+|mfid[0-9]+|nda[0-9]+|nvd[0-9]+|vtbd[0-9]+/
+ { printf "%s:", $1 }')
+ elif is_linux; then
+ ctds=$(zpool list -HLv $pool | \
+ awk '/sd[a-z]*|loop[0-9]*|dm-[0-9]*/ {print $1}')
+
+ for ctd in $ctds; do
+ lun_list="$lun_list$ctd:"
done
fi
echo $lun_list