Skip to content

Commit

Permalink
ZTS Remove some path workarounds for FreeBSD
Browse files Browse the repository at this point in the history
These are no longer needed after fixing device name matching for whole
disks in libzutil on FreeBSD.

Signed-off-by: Ryan Moeller <ryan@ixsystems.com>
  • Loading branch information
Ryan Moeller committed Jan 14, 2020
1 parent 61152d1 commit d0673c7
Showing 1 changed file with 5 additions and 16 deletions.
21 changes: 5 additions & 16 deletions tests/zfs-tests/tests/functional/cli_root/zdb/zdb_004_pos.ksh
Expand Up @@ -40,12 +40,12 @@ function cleanup
for DISK in $DISKS; do
zpool labelclear -f $DEV_RDSKDIR/$DISK
done
if is_freebsd ; then
if is_freebsd; then
log_must sysctl kern.geom.debugflags=$saved_debugflags
fi
}

if is_freebsd ; then
if is_freebsd; then
# FreeBSD won't allow writing to an in-use device without this set
saved_debugflags=$(sysctl -n kern.geom.debugflags)
log_must sysctl kern.geom.debugflags=16
Expand All @@ -54,32 +54,21 @@ fi
verify_runnable "global"
verify_disk_count "$DISKS" 2
set -A DISK $DISKS
if is_freebsd ; then
WHOLE_DISK=/dev/${DISK[0]}
else
WHOLE_DISK=${DISK[0]}
fi

default_mirror_setup_noexit $DISKS
DEVS=$(get_pool_devices ${TESTPOOL} ${DEV_RDSKDIR})
[[ -n $DEVS ]] && set -A DISK $DEVS

log_must zpool offline $TESTPOOL ${WHOLE_DISK}
log_must zpool offline $TESTPOOL ${DISK[0]}
log_must dd if=/dev/urandom of=$TESTDIR/testfile bs=1K count=2
log_must zpool export $TESTPOOL

log_must dd if=$DEV_RDSKDIR/${DISK[0]} of=$DEV_RDSKDIR/${DISK[1]} bs=1K count=256 conv=notrunc

if is_freebsd; then
DISK1="/dev/${DISK[1]}"
else
DISK1="${DISK[1]}"
fi

ubs=$(zdb -lu ${DISK1} | grep -e LABEL -e Uberblock -e 'labels = ')
ubs=$(zdb -lu ${DISK[1]} | grep -e LABEL -e Uberblock -e 'labels = ')
log_note "vdev 1: ubs $ubs"

ub_dump_counts=$(zdb -lu ${DISK1} | \
ub_dump_counts=$(zdb -lu ${DISK[1]} | \
awk ' /LABEL/ {label=$NF; blocks[label]=0};
/Uberblock/ {blocks[label]++};
END {print blocks[0],blocks[1],blocks[2],blocks[3]}')
Expand Down

0 comments on commit d0673c7

Please sign in to comment.