diff mbox series

[4/7] xfs/279: skip test if we can't allocate scsi_debug device

Message ID 157915146054.2374854.14308605711454193767.stgit@magnolia (mailing list archive)
State New, archived
Headers show
Series fstests: random fixes | expand

Commit Message

Darrick J. Wong Jan. 16, 2020, 5:11 a.m. UTC
From: Darrick J. Wong <darrick.wong@oracle.com>

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>
---
 tests/xfs/279 |    3 +++
 1 file changed, 3 insertions(+)

Comments

Christoph Hellwig Jan. 16, 2020, 9:24 a.m. UTC | #1
On Wed, Jan 15, 2020 at 09:11:00PM -0800, Darrick J. Wong wrote:
> From: Darrick J. Wong <darrick.wong@oracle.com>
> 
> 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.

Looks good,

Reviewed-by: Christoph Hellwig <hch@lst.de>
diff mbox series

Patch

diff --git a/tests/xfs/279 b/tests/xfs/279
index 7ab8bdd5..0ddc6a00 100755
--- a/tests/xfs/279
+++ b/tests/xfs/279
@@ -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