[PATCH] Fix warning of "Usage: _is_block_dev dev"

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



From: Zhao Lei <zhaolei@xxxxxxxxxxxxxx>

_is_block_dev() will show above warning when "$dev" is not exist.
It happened when user hadn't set $SCRATCH_DEV(optional) and check
$TEST_DEV.

Signed-off-by: Zhao Lei <zhaolei@xxxxxxxxxxxxxx>
---
 common/rc | 23 +++++++++++++----------
 1 file changed, 13 insertions(+), 10 deletions(-)

diff --git a/common/rc b/common/rc
index 5377ba0..d9815c7 100644
--- a/common/rc
+++ b/common/rc
@@ -1167,19 +1167,22 @@ _require_test()
 		fi
 		;;
 	*)
-		 if [ -z "$TEST_DEV" -o "`_is_block_dev $TEST_DEV`" = "" ]
-		 then
-		     _notrun "this test requires a valid \$TEST_DEV"
-		 fi
-		 if [ "`_is_block_dev $SCRATCH_DEV`" = "`_is_block_dev $TEST_DEV`" ]
-		 then
-		     _notrun "this test requires a valid \$TEST_DEV"
-		 fi
+		if [ -z "$TEST_DEV" -o "`_is_block_dev $TEST_DEV`" = "" ]
+		then
+		    _notrun "this test requires a valid \$TEST_DEV"
+		fi
+		if [ -n "$SCRATCH_DEV" ]
+		then
+		    if [ "`_is_block_dev $SCRATCH_DEV`" = "`_is_block_dev $TEST_DEV`" ]
+		    then
+			_notrun "this test requires a valid \$TEST_DEV"
+		    fi
+		fi
 		if [ ! -d "$TEST_DIR" ]
 		then
-		     _notrun "this test requires a valid \$TEST_DIR"
+		    _notrun "this test requires a valid \$TEST_DIR"
 		fi
-		 ;;
+		;;
     esac
 
     # mounted?
-- 
1.8.5.1

--
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