xfs/279: skip test if we can't allocate scsi_debug device
authorDarrick J. Wong <darrick.wong@oracle.com>
Thu, 16 Jan 2020 05:11:00 +0000 (21:11 -0800)
committerEryu Guan <guaneryu@gmail.com>
Sun, 2 Feb 2020 12:46:58 +0000 (20:46 +0800)
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>
tests/xfs/279

index 7ab8bdd592c374a747a95f08212523805de79f5e..0ddc6a006f24e7e8e1a57063d6bdef2c5a800089 100755 (executable)
@@ -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