common: fix "utility required warning" with empty utility name
authorZhao Lei <zhaolei@cn.fujitsu.com>
Wed, 18 Mar 2015 04:00:23 +0000 (15:00 +1100)
committerDave Chinner <david@fromorbit.com>
Wed, 18 Mar 2015 04:00:23 +0000 (15:00 +1100)
In generic/019, if we hadn't install fio, we will get following output:

 generic/019      [not run]  utility required, skipped this test <- *
 Not run: generic/019
 Passed all 0 tests

When fio is not installed, "$FIO_PROG" is set to blank, and
_require_fio() call _require_command() with none arguments.

This patch fixed all misuse of _require_command(), add 2nd argument
to let _require_command() output right message, and add quotes to
first argument to avoid argument shifting.

Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
12 files changed:
common/defrag
common/rc
tests/btrfs/003
tests/btrfs/004
tests/btrfs/011
tests/btrfs/012
tests/btrfs/079
tests/ext4/004
tests/xfs/094
tests/xfs/103
tests/xfs/122
tests/xfs/195

index f5e36fb25c088fe94e32ec6cdccf8ad8f147f1fd..f923dc014d72221e8ceac62099465ee5cd940e8c 100644 (file)
@@ -37,7 +37,7 @@ _require_defrag()
        ;;
     esac
 
-    _require_command $DEFRAG_PROG
+    _require_command "$DEFRAG_PROG" defragment
     _require_xfs_io_command "fiemap"
 }
 
index 7e76d7215169d0c0193979b175df100879dd58d7..857308a80139fc16ddc0b2db04498c2a31d0d295 100644 (file)
--- a/common/rc
+++ b/common/rc
@@ -1299,7 +1299,7 @@ _require_dm_flakey()
 {
     # require SCRATCH_DEV to be a valid block device
     _require_block_device $SCRATCH_DEV
-    _require_command $DMSETUP_PROG
+    _require_command "$DMSETUP_PROG" dmsetup
 
     modprobe dm-flakey >/dev/null 2>&1
     $DMSETUP_PROG targets | grep flakey >/dev/null 2>&1
@@ -2289,7 +2289,7 @@ _require_deletable_scratch_dev_pool()
 _require_btrfs()
 {
        cmd=$1
-       _require_command $BTRFS_UTIL_PROG btrfs
+       _require_command "$BTRFS_UTIL_PROG" btrfs
        if [ -z "$1" ]; then
                return 1;
        fi
@@ -2302,7 +2302,7 @@ _require_fio()
 {
        job=$1
 
-       _require_command $FIO_PROG
+       _require_command "$FIO_PROG" fio
        if [ -z "$1" ]; then
                return 1;
        fi
index d559f8ed1df9145486458bfb67c07f79cc4ff8c6..9b60ea554614aa5e07b87f066fb8656dc6366b9e 100755 (executable)
@@ -51,7 +51,7 @@ _supported_os Linux
 _require_scratch
 _require_scratch_dev_pool 4
 _require_deletable_scratch_dev_pool
-_require_command $WIPEFS_PROG
+_require_command "$WIPEFS_PROG" wipefs
 
 rm -f $seqres.full
 
index 1d5b816bda266c9c8f9406d84000cc14590ef7f7..b5489140146cabf4389a4c1d0fcd552ba5dafcfc 100755 (executable)
@@ -53,7 +53,7 @@ _supported_os Linux
 _require_scratch
 _require_no_large_scratch_dev
 _require_btrfs inspect-internal
-_require_command "/usr/sbin/filefrag"
+_require_command "/usr/sbin/filefrag" filefrag
 
 rm -f $seqres.full
 
index 02070578f535f7234d566b4581edb6428d95ee46..f4f2fbed68d87e2a0a8975dc705c36fd073b37ca 100755 (executable)
@@ -63,7 +63,7 @@ _need_to_be_root
 _supported_fs btrfs
 _require_scratch_nocheck
 _require_scratch_dev_pool 4
-_require_command $BTRFS_SHOW_SUPER_PROG btrfs-show-super
+_require_command "$BTRFS_SHOW_SUPER_PROG" btrfs-show-super
 
 rm -f $seqres.full
 rm -f $tmp.tmp
index 9e3f991291d05e43b9ecf1b71ec6674c41c0b660..d5137595949c9c93c1289ff767be2519351cd83a 100755 (executable)
@@ -57,9 +57,9 @@ _require_scratch_nocheck
 BTRFS_CONVERT_PROG="`set_prog_path btrfs-convert`"
 E2FSCK_PROG="`set_prog_path e2fsck`"
 
-_require_command $BTRFS_CONVERT_PROG btrfs-convert
-_require_command $MKFS_EXT4_PROG mkfs.ext4
-_require_command $E2FSCK_PROG e2fsck
+_require_command "$BTRFS_CONVERT_PROG" btrfs-convert
+_require_command "$MKFS_EXT4_PROG" mkfs.ext4
+_require_command "$E2FSCK_PROG" e2fsck
 
 rm -f $seqres.full
 
index 202d3e6e4d759414a09dcf3e41488ef4178fa388..4f59ff96a0957acf97724fb949fb3c4714e25ac1 100755 (executable)
@@ -61,7 +61,7 @@ _require_scratch
 _need_to_be_root
 # Since xfs_io's fiemap always use SYNC flag and can't be unset,
 # we must use filefrag to call fiemap without SYNC flag.
-_require_command "/usr/sbin/filefrag"
+_require_command "/usr/sbin/filefrag" filefrag
 _require_xfs_io_command "falloc"
 
 filesize=$((10 * 1024 * 1024 * 1024)) #10G size
index 68f02b6e4b31291ea9e93087c86e8f2a2226f808..595cd7c46d688a189f7e4a262cb40b5d579c70e7 100755 (executable)
@@ -72,8 +72,8 @@ _supported_os Linux
 _require_test
 _require_scratch
 
-_require_command $DUMP_PROG
-_require_command $RESTORE_PROG
+_require_command "$DUMP_PROG" dump
+_require_command "$RESTORE_PROG" restore
 
 rm -f $seqres.full
 echo "Silence is golden"
index cb27559cdf55f1612b8a8a271af39741ced45b97..cee42d65893dc7486ed959356bffc7430c125205 100755 (executable)
@@ -46,7 +46,7 @@ _supported_fs xfs
 _supported_os IRIX Linux
 _require_realtime
 _require_scratch
-_require_command $XFS_IO_PROG xfs_io
+_require_command "$XFS_IO_PROG" xfs_io
 
 _filter_realtime_flag()
 {
index 113f6436f25c3187bc25391720315915c5feb550..cbe884f385bdceec8df144579c94c533f976886e 100755 (executable)
@@ -66,7 +66,7 @@ _filter_noymlinks_flag()
 # real QA test starts here
 _supported_os Linux IRIX
 _supported_fs xfs
-_require_command $XFS_IO_PROG xfs_io
+_require_command "$XFS_IO_PROG" xfs_io
 _require_scratch
 
 _create_scratch
index 8f1d5b4ea83c6dd294222ad2d0d3ed156c0e80c6..682ffb4a63976cfef85f6e188cca7b5f253a5ab0 100755 (executable)
@@ -39,7 +39,7 @@ trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15
 # real QA test starts here
 _supported_fs xfs
 _supported_os Linux
-_require_command $INDENT_PROG "indent"
+_require_command "$INDENT_PROG" indent
 
 # filter out known changes to xfs type sizes
 _type_size_filter()
index 76f130ebdf66b99a09055b84030d8298e9e430ce..21fcb00336549d767d84a76620ecf48b926c0148 100755 (executable)
@@ -65,7 +65,7 @@ _supported_os Linux
 
 _require_test
 _require_user
-_require_command $XFSDUMP_PROG xfsdump
+_require_command "$XFSDUMP_PROG" xfsdump
 
 echo "Preparing subtree"
 mkdir $TEST_DIR/d