test/nvme: only run setup.sh test on Linux

For now, our scripts don't support detecting mounted filesystems on NVMe
devices on FreeBSD, so only run those tests on Linux.

Change-Id: I558715bf4e95eaad2dd2d8a546626269c0837edb
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/393420
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
Daniel Verkamp 2018-01-02 14:52:43 -07:00 committed by Jim Harris
parent 71db3a0870
commit 581107c77a

View File

@ -31,19 +31,20 @@ function get_nvme_name_from_bdf {
timing_enter nvme
# check that our setup.sh script does not bind NVMe devices to uio/vfio if they
# have an active mountpoint
$rootdir/scripts/setup.sh reset
# give kernel nvme driver some time to create the block devices before we start looking for them
sleep 1
blkname=''
# first, find an NVMe device that does not have an active mountpoint already;
# this covers rare case where someone is running this test script on a system
# that has a mounted NVMe filesystem
#
# note: more work probably needs to be done to properly handle devices with multiple
# namespaces
for bdf in $(linux_iter_pci 0108); do
if [ `uname` = Linux ]; then
# check that our setup.sh script does not bind NVMe devices to uio/vfio if they
# have an active mountpoint
$rootdir/scripts/setup.sh reset
# give kernel nvme driver some time to create the block devices before we start looking for them
sleep 1
blkname=''
# first, find an NVMe device that does not have an active mountpoint already;
# this covers rare case where someone is running this test script on a system
# that has a mounted NVMe filesystem
#
# note: more work probably needs to be done to properly handle devices with multiple
# namespaces
for bdf in $(linux_iter_pci 0108); do
get_nvme_name_from_bdf "$bdf" blkname
if [ "$blkname" != "" ]; then
mountpoints=$(lsblk /dev/$blkname --output MOUNTPOINT -n | wc -w)
@ -53,11 +54,11 @@ for bdf in $(linux_iter_pci 0108); do
blkname=''
fi
fi
done
done
# if we found an NVMe block device without an active mountpoint, create and mount
# a filesystem on it for purposes of testing the setup.sh script
if [ "$blkname" != "" ]; then
# if we found an NVMe block device without an active mountpoint, create and mount
# a filesystem on it for purposes of testing the setup.sh script
if [ "$blkname" != "" ]; then
parted -s /dev/$blkname mklabel gpt
# just create a 100MB partition - this tests our ability to detect mountpoints
# on partitions of the device, not just the device itself; it also is faster
@ -83,8 +84,9 @@ if [ "$blkname" != "" ]; then
if [ "$driver" = "nvme" ]; then
exit 1
fi
else
else
$rootdir/scripts/setup.sh
fi
fi
if [ `uname` = Linux ]; then