ZTS: Misc fixes for FreeBSD
* Set geom debug flags in corrupt_blocks_at_level * Use the right time zone for history tests * Add missing commands.cfg entry for diskinfo * Rewrite get_last_txg_synced to use zdb * Don't check ulimits for sparse files * Suspend removal before removing a vdev, not after Reviewed-by: John Kennedy <john.kennedy@delphix.com> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Ryan Moeller <ryan@iXsystems.com> Closes #10054
This commit is contained in:
parent
ab9646166d
commit
3d5ba1cf29
|
@ -577,6 +577,11 @@ function corrupt_blocks_at_level # input_file corrupt_level
|
|||
|
||||
[[ -f $input_file ]] || log_fail "Couldn't find $input_file"
|
||||
|
||||
if is_freebsd; then
|
||||
# Temporarily allow corrupting an inuse device.
|
||||
debugflags=$(sysctl -n kern.geom.debugflags)
|
||||
sysctl kern.geom.debugflags=16
|
||||
fi
|
||||
|
||||
log_must list_file_blocks $input_file | \
|
||||
while read level path offset length; do
|
||||
|
@ -586,6 +591,10 @@ function corrupt_blocks_at_level # input_file corrupt_level
|
|||
fi
|
||||
done
|
||||
|
||||
if is_freebsd; then
|
||||
sysctl kern.geom.debugflags=$debugflags
|
||||
fi
|
||||
|
||||
# This is necessary for pools made of loop devices.
|
||||
sync
|
||||
}
|
||||
|
|
|
@ -113,6 +113,7 @@ export SYSTEM_FILES_COMMON='arp
|
|||
|
||||
export SYSTEM_FILES_FREEBSD='chflags
|
||||
compress
|
||||
diskinfo
|
||||
dumpon
|
||||
env
|
||||
fsck
|
||||
|
|
|
@ -54,9 +54,7 @@ verify_runnable "both"
|
|||
|
||||
function cleanup
|
||||
{
|
||||
echo cleanup
|
||||
[[ -e $TESTDIR ]] && \
|
||||
log_must rm -rf $TESTDIR/* > /dev/null 2>&1
|
||||
rm -fr $TESTDIR/*
|
||||
}
|
||||
|
||||
log_assert "Create and read back files with using different checksum algorithms"
|
||||
|
|
|
@ -60,7 +60,7 @@ ZFS_TXG_TIMEOUT=""
|
|||
function custom_cleanup
|
||||
{
|
||||
# Revert zfs_txg_timeout to defaults
|
||||
[[ -n ZFS_TXG_TIMEOUT ]] &&
|
||||
[[ -n $ZFS_TXG_TIMEOUT ]] &&
|
||||
log_must set_zfs_txg_timeout $ZFS_TXG_TIMEOUT
|
||||
log_must rm -rf $BACKUP_DEVICE_DIR
|
||||
log_must set_tunable32 SCAN_SUSPEND_PROGRESS 0
|
||||
|
|
|
@ -346,42 +346,11 @@ function set_zfs_max_missing_tvds
|
|||
}
|
||||
|
||||
#
|
||||
# Use mdb to find the last txg that was synced in an active pool.
|
||||
# Use zdb to find the last txg that was synced in an active pool.
|
||||
#
|
||||
function get_last_txg_synced
|
||||
{
|
||||
typeset pool=$1
|
||||
|
||||
if is_linux; then
|
||||
txg=$(tail "/proc/spl/kstat/zfs/$pool/txgs" |
|
||||
awk '$3=="C" {print $1}' | tail -1)
|
||||
[[ "$txg" ]] || txg=0
|
||||
echo $txg
|
||||
return 0
|
||||
fi
|
||||
|
||||
typeset spas
|
||||
spas=$(mdb -k -e "::spa")
|
||||
[[ $? -ne 0 ]] && return 1
|
||||
|
||||
typeset spa=""
|
||||
print "$spas\n" | while read line; do
|
||||
typeset poolname=$(echo "$line" | awk '{print $3}')
|
||||
typeset addr=$(echo "$line" | awk '{print $1}')
|
||||
if [[ $poolname == $pool ]]; then
|
||||
spa=$addr
|
||||
break
|
||||
fi
|
||||
done
|
||||
if [[ -z $spa ]]; then
|
||||
log_fail "Couldn't find pool '$pool'"
|
||||
return 1
|
||||
fi
|
||||
typeset mdbcmd="$spa::print spa_t spa_ubsync.ub_txg | ::eval '.=E'"
|
||||
typeset -i txg
|
||||
txg=$(mdb -k -e "$mdbcmd")
|
||||
[[ $? -ne 0 ]] && return 1
|
||||
|
||||
echo $txg
|
||||
return 0
|
||||
zdb -u $pool | awk '$1 == "txg" { print $3 }' | sort -n | tail -n 1
|
||||
}
|
||||
|
|
|
@ -37,7 +37,11 @@ export TMP_HISTORY=$TEST_BASE_DIR/tmp_history.$$
|
|||
export NEW_HISTORY=$TEST_BASE_DIR/new_history.$$
|
||||
|
||||
export MIGRATEDPOOLNAME=${MIGRATEDPOOLNAME:-history_pool}
|
||||
if is_freebsd; then
|
||||
export TIMEZONE=${TIMEZONE:-America/Denver}
|
||||
else
|
||||
export TIMEZONE=${TIMEZONE:-US/Mountain}
|
||||
fi
|
||||
|
||||
export HIST_USER="huser"
|
||||
export HIST_GROUP="hgroup"
|
||||
|
|
|
@ -49,7 +49,11 @@ log_must rm $TESTDIR/ulimit_write_file $TESTDIR/ulimit_trunc_file
|
|||
# Verify 'ulimit -f <size>' works
|
||||
log_must ulimit -f 1024
|
||||
log_mustnot sh -c 'dd if=/dev/zero of=$TESTDIR/ulimit_write_file bs=1M count=2'
|
||||
log_must rm $TESTDIR/ulimit_write_file
|
||||
# FreeBSD allows the sparse file because space has not been allocated.
|
||||
if !is_freebsd; then
|
||||
log_mustnot sh -c 'truncate -s2M $TESTDIR/ulimit_trunc_file'
|
||||
log_must rm $TESTDIR/ulimit_write_file $TESTDIR/ulimit_trunc_file
|
||||
log_must rm $TESTDIR/ulimit_trunc_file
|
||||
fi
|
||||
|
||||
log_pass "Successfully enforced 'ulimit -f' maximum file size"
|
||||
|
|
|
@ -66,21 +66,16 @@ log_must randwritecomp $SAMPLEFILE 25000
|
|||
#
|
||||
log_must zpool add -f $TESTPOOL $NOTREMOVEDISK
|
||||
|
||||
#
|
||||
# Start removal.
|
||||
#
|
||||
log_must zpool remove $TESTPOOL $REMOVEDISK
|
||||
|
||||
#
|
||||
# Sleep a bit and hopefully allow removal to copy some data.
|
||||
#
|
||||
log_must sleep 1
|
||||
|
||||
#
|
||||
# Block removal.
|
||||
#
|
||||
log_must set_tunable32 REMOVAL_SUSPEND_PROGRESS 1
|
||||
|
||||
#
|
||||
# Start removal.
|
||||
#
|
||||
log_must zpool remove $TESTPOOL $REMOVEDISK
|
||||
|
||||
#
|
||||
# Only for debugging purposes in test logs.
|
||||
#
|
||||
|
|
|
@ -70,9 +70,10 @@ function verify_restarts # <msg> <cnt> <defer>
|
|||
[[ -z "$defer" ]] && return
|
||||
|
||||
# use zdb to find which vdevs have the resilver defer flag
|
||||
VDEV_DEFERS=$(zdb -C $TESTPOOL | \
|
||||
sed -n -e '/^ *children\[[0-9]\].*$/{h}' \
|
||||
-e '/ *com.datto:resilver_defer$/{g;p}')
|
||||
VDEV_DEFERS=$(zdb -C $TESTPOOL | awk '
|
||||
/children/ { gsub(/[^0-9]/, ""); child = $0 }
|
||||
/com\.datto:resilver_defer$/ { print child }
|
||||
')
|
||||
|
||||
if [[ "$defer" == "-" ]]
|
||||
then
|
||||
|
@ -81,7 +82,7 @@ function verify_restarts # <msg> <cnt> <defer>
|
|||
return
|
||||
fi
|
||||
|
||||
[[ "x${VDEV_DEFERS}x" =~ "x +children[$defer]:x" ]] ||
|
||||
[[ $VDEV_DEFERS -eq $defer ]] ||
|
||||
log_fail "resilver deferred set on unexpected vdev: $VDEV_DEFERS"
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue