ZTS: Misc test fixes for FreeBSD
Add missing logic for FreeBSD to a few test scripts. Reviewed-by: John Kennedy <john.kennedy@delphix.com> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Ryan Moeller <ryan@iXsystems.com> Closes #9994
This commit is contained in:
parent
71439163bb
commit
4f4ddf98ee
|
@ -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
|
||||
#
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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]" | \
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -23,6 +23,11 @@
|
|||
|
||||
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
|
||||
DISK1=${DISKS%% *}
|
||||
|
||||
typeset -i max_discard=0
|
||||
|
@ -33,5 +38,6 @@ fi
|
|||
if test $max_discard -eq 0; then
|
||||
log_unsupported "DISKS do not support discard (TRIM/UNMAP)"
|
||||
fi
|
||||
fi
|
||||
|
||||
log_pass
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
||||
|
|
|
@ -26,7 +26,6 @@
|
|||
# Use is subject to license terms.
|
||||
#
|
||||
|
||||
#
|
||||
. $STF_SUITE/include/properties.shlib
|
||||
. $STF_SUITE/tests/functional/rsend/rsend.kshlib
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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,16 +427,16 @@ 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);
|
||||
}')
|
||||
else
|
||||
max_dbuf_cache_size=$(get_tunable DBUF_CACHE_MAX_BYTES)
|
||||
fi
|
||||
|
||||
[[ $? -eq 0 ]] || log_fail "get_max_dbuf_cache_size failed"
|
||||
fi
|
||||
|
||||
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
|
||||
|
|
Loading…
Reference in New Issue