xfs/279: skip test if we can't allocate scsi_debug device

Due to the unique structure of xfs/279 running _get_scsi_debug_dev from
a backtick from inside subshell, the "could not get scsi_debug device"
checks do not actually stop the test when modprobe scsi_debug fails.

Therefore, check the value of SCSI_DEBUG_DEV from the subshell and
_notrun the test if we couldn't get memory.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
This commit is contained in:
Darrick J. Wong
2020-01-15 21:11:00 -08:00
committed by Eryu Guan
parent 6478e33438
commit e002de2e5b
+3
View File
@@ -65,6 +65,7 @@ _check_mkfs()
echo "==================="
echo "4k physical 512b logical aligned"
SCSI_DEBUG_DEV=`_get_scsi_debug_dev 4096 512 0 128`
test -b "$SCSI_DEBUG_DEV" || _notrun "Could not get scsi_debug device"
# sector size should default to 4k
_check_mkfs $SCSI_DEBUG_DEV
# blocksize smaller than physical sectorsize should revert to logical sectorsize
@@ -77,6 +78,7 @@ _put_scsi_debug_dev
echo "==================="
echo "4k physical 512b logical unaligned"
SCSI_DEBUG_DEV=`_get_scsi_debug_dev 4096 512 1 128`
test -b "$SCSI_DEBUG_DEV" || _notrun "Could not get scsi_debug device"
# should fail on misalignment
_check_mkfs $SCSI_DEBUG_DEV
# should fall back to logical sector size with force
@@ -93,6 +95,7 @@ _put_scsi_debug_dev
echo "==================="
echo "hard 4k physical / 4k logical"
SCSI_DEBUG_DEV=`_get_scsi_debug_dev 4096 4096 0 128`
test -b "$SCSI_DEBUG_DEV" || _notrun "Could not get scsi_debug device"
# block size smaller than sector size should fail
_check_mkfs -b size=2048 $SCSI_DEBUG_DEV
# sector size smaller than physical sector size should fail