From 6a608416315ab9a109b948baa02a90171b09a337 Mon Sep 17 00:00:00 2001 From: Ryan Moeller Date: Fri, 21 Feb 2020 11:38:34 -0500 Subject: [PATCH] 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 Reviewed-by: Igor Kozhukhov \ Reviewed-by: John Kennedy Reviewed-by: Brian Behlendorf Signed-off-by: Ryan Moeller Closes #10033 --- .../tests/functional/refreserv/refreserv_multi_raidz.ksh | 6 +++++- .../tests/functional/refreserv/refreserv_raidz.ksh | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/tests/zfs-tests/tests/functional/refreserv/refreserv_multi_raidz.ksh b/tests/zfs-tests/tests/functional/refreserv/refreserv_multi_raidz.ksh index c904a807f..ff79764ba 100755 --- a/tests/zfs-tests/tests/functional/refreserv/refreserv_multi_raidz.ksh +++ b/tests/zfs-tests/tests/functional/refreserv/refreserv_multi_raidz.ksh @@ -61,7 +61,11 @@ poolexists "$TESTPOOL" && log_must_busy zpool destroy "$TESTPOOL" # 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 the problems that arise from 4K and 8K blocks on ashift=12 pools. -bps=$(lsblk -nrdo min-io /dev/${alldisks[0]}) +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]}) +fi case "$bps" in 512) allshifts=(9 10 17) diff --git a/tests/zfs-tests/tests/functional/refreserv/refreserv_raidz.ksh b/tests/zfs-tests/tests/functional/refreserv/refreserv_raidz.ksh index 9f25242de..22891ef1d 100755 --- a/tests/zfs-tests/tests/functional/refreserv/refreserv_raidz.ksh +++ b/tests/zfs-tests/tests/functional/refreserv/refreserv_raidz.ksh @@ -63,7 +63,11 @@ poolexists "$TESTPOOL" && log_must_busy zpool destroy "$TESTPOOL" # 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 the problems that arise from 4K and 8K blocks on ashift=12 pools. -bps=$(lsblk -nrdo min-io /dev/${alldisks[0]}) +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]}) +fi log_must test "$bps" -eq 512 -o "$bps" -eq 4096 case "$bps" in 512)