[PATCH] generic/108: Fix return value check from _get_scsi_debug_dev

[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]



_get_scsi_debug_dev is supposed to return a "/dev/$device".
However, in case the scsi device is not mapped to a disk, hence
/dev/sd* doesn't exist, then get_scsi_debug_dev would return only the
"/dev/" string. In generic/108 we check whether return value is ""
and only then consider it a failure. This behavior allows the
test to erroneously consider _get_scsi_debug_dev succeeded even
if it returned a malformed string. Fix this by correctly checking
whether the return value is "/dev/"

Signed-off-by: Nikolay Borisov <nborisov@xxxxxxxx>
---
 tests/generic/108 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/generic/108 b/tests/generic/108
index cc8d7038..1525dfb6 100755
--- a/tests/generic/108
+++ b/tests/generic/108
@@ -64,7 +64,7 @@ rm -f $seqres.full
 
 # _get_scsi_debug_dev returns a scsi debug device with 128M in size by default
 SCSI_DEBUG_DEV=`_get_scsi_debug_dev`
-if [ "$SCSI_DEBUG_DEV" == "" ]; then
+if [ "$SCSI_DEBUG_DEV" == "/dev/" ]; then
 	_fail "Failed to initialize scsi debug device"
 fi
 echo "SCSI debug device $SCSI_DEBUG_DEV" >>$seqres.full
-- 
2.12.3

--
To unsubscribe from this list: send the line "unsubscribe fstests" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Filesystems Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux