ZTS: Don't use lsblk on FreeBSD

These tests use lsblk to find the sector size of a disk.
FreeBSD doesn't have lsblk.

Use diskinfo -v to get sector size on FreeBSD.

Reviewed-by: George Melikov <mail@gmelikov.ru>
Reviewed-by: Igor Kozhukhov <igor@dilos.org>\
Reviewed-by: John Kennedy <john.kennedy@delphix.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Ryan Moeller <ryan@iXsystems.com>
Closes #10033
This commit is contained in:
Ryan Moeller 2020-02-21 11:38:34 -05:00 committed by GitHub
parent ca7ea23f8a
commit 6a60841631
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 2 deletions

View File

@ -61,7 +61,11 @@ poolexists "$TESTPOOL" && log_must_busy zpool destroy "$TESTPOOL"
# that small test disks may fill before creating small volumes. However, # that small test disks may fill before creating small volumes. However,
# testing 512b and 1K blocks on ashift=9 pools is an ok approximation for # testing 512b and 1K blocks on ashift=9 pools is an ok approximation for
# testing the problems that arise from 4K and 8K blocks on ashift=12 pools. # testing the problems that arise from 4K and 8K blocks on ashift=12 pools.
if is_freebsd; then
bps=$(diskinfo -v ${alldisks[0]} | awk '/sectorsize/ { print $1 }')
elif is_linux; then
bps=$(lsblk -nrdo min-io /dev/${alldisks[0]}) bps=$(lsblk -nrdo min-io /dev/${alldisks[0]})
fi
case "$bps" in case "$bps" in
512) 512)
allshifts=(9 10 17) allshifts=(9 10 17)

View File

@ -63,7 +63,11 @@ poolexists "$TESTPOOL" && log_must_busy zpool destroy "$TESTPOOL"
# that small test disks may fill before creating small volumes. However, # that small test disks may fill before creating small volumes. However,
# testing 512b and 1K blocks on ashift=9 pools is an ok approximation for # testing 512b and 1K blocks on ashift=9 pools is an ok approximation for
# testing the problems that arise from 4K and 8K blocks on ashift=12 pools. # testing the problems that arise from 4K and 8K blocks on ashift=12 pools.
if is_freebsd; then
bps=$(diskinfo -v ${alldisks[0]} | awk '/sectorsize/ { print $1 }')
elif is_linux; then
bps=$(lsblk -nrdo min-io /dev/${alldisks[0]}) bps=$(lsblk -nrdo min-io /dev/${alldisks[0]})
fi
log_must test "$bps" -eq 512 -o "$bps" -eq 4096 log_must test "$bps" -eq 512 -o "$bps" -eq 4096
case "$bps" in case "$bps" in
512) 512)