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:
Ryan Moeller
2020-02-13 16:52:34 -05:00
committed by GitHub
parent 71439163bb
commit 4f4ddf98ee
12 changed files with 85 additions and 41 deletions
+36 -24
View File
@@ -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