generic/108: Fix return value check from _get_scsi_debug_dev
authorNikolay Borisov <nborisov@suse.com>
Thu, 25 May 2017 09:08:46 +0000 (12:08 +0300)
committerEryu Guan <eguan@redhat.com>
Thu, 25 May 2017 09:11:55 +0000 (17:11 +0800)
_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@suse.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
tests/generic/108

index cc8d70384d1cb5a1ce97d6ce86165e86a70763a8..1525dfb64a4755b8a44ba6af4dea970786147b8c 100755 (executable)
@@ -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