From: Andreas Gruenbacher Date: Thu, 14 May 2015 10:27:54 +0000 (+1000) Subject: generic: Fix _is_block_dev quoting X-Git-Tag: v2022.05.01~2880 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=35a192a3a9e288bb73bbffb0d8002d779bb18855;p=xfstests-dev.git generic: Fix _is_block_dev quoting Add more quoting so that test cases that don't require a SCRATCH_DEV won't fail. Signed-off-by: Andreas Gruenbacher Reviewed-by: Dave Chinner Signed-off-by: Dave Chinner --- diff --git a/common/rc b/common/rc index 242dedb0..c3f60902 100644 --- a/common/rc +++ b/common/rc @@ -970,11 +970,11 @@ _is_block_dev() _dev=$1 if [ -L "${_dev}" ]; then - _dev=`readlink -f ${_dev}` + _dev=`readlink -f "${_dev}"` fi if [ -b "${_dev}" ]; then - src/lstat64 ${_dev} | $AWK_PROG '/Device type:/ { print $9 }' + src/lstat64 "${_dev}" | $AWK_PROG '/Device type:/ { print $9 }' fi } @@ -1108,11 +1108,11 @@ _require_scratch_nocheck() fi ;; *) - if [ -z "$SCRATCH_DEV" -o "`_is_block_dev $SCRATCH_DEV`" = "" ] + if [ -z "$SCRATCH_DEV" -o "`_is_block_dev "$SCRATCH_DEV"`" = "" ] then _notrun "this test requires a valid \$SCRATCH_DEV" fi - if [ "`_is_block_dev $SCRATCH_DEV`" = "`_is_block_dev $TEST_DEV`" ] + if [ "`_is_block_dev "$SCRATCH_DEV"`" = "`_is_block_dev "$TEST_DEV"`" ] then _notrun "this test requires a valid \$SCRATCH_DEV" fi @@ -1182,11 +1182,11 @@ _require_test() fi ;; *) - if [ -z "$TEST_DEV" -o "`_is_block_dev $TEST_DEV`" = "" ] + if [ -z "$TEST_DEV" ] || [ "`_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`" ] + if [ "`_is_block_dev "$SCRATCH_DEV"`" = "`_is_block_dev "$TEST_DEV"`" ] then _notrun "this test requires a valid \$TEST_DEV" fi @@ -2285,10 +2285,10 @@ _require_scratch_dev_pool() esac for i in $SCRATCH_DEV_POOL; do - if [ "`_is_block_dev $i`" = "" ]; then + if [ "`_is_block_dev "$i"`" = "" ]; then _notrun "this test requires valid block disk $i" fi - if [ "`_is_block_dev $i`" = "`_is_block_dev $TEST_DEV`" ]; then + if [ "`_is_block_dev "$i"`" = "`_is_block_dev "$TEST_DEV"`" ]; then _notrun "$i is part of TEST_DEV, this test requires unique disks" fi if _mount | grep -q $i; then