[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 28/73] tests: Use "command -v" instead of which(1) in
From: |
Kevin Wolf |
Subject: |
[Qemu-devel] [PULL 28/73] tests: Use "command -v" instead of which(1) in shell scripts |
Date: |
Wed, 10 Dec 2014 11:33:54 +0100 |
From: Fam Zheng <address@hidden>
When which(1) is not installed, we would complain "perl not found"
because it's the first set_prog_path check. The error message is
wrong.
Fix it by using "command -v", a native way to query the existence of a
command.
Suggested-by: Eric Blake <address@hidden>
Signed-off-by: Fam Zheng <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Message-id: address@hidden
Signed-off-by: Stefan Hajnoczi <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>
---
tests/qemu-iotests/common | 8 ++++----
tests/qemu-iotests/common.config | 2 +-
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/tests/qemu-iotests/common b/tests/qemu-iotests/common
index 9e12bec..bc27f6a 100644
--- a/tests/qemu-iotests/common
+++ b/tests/qemu-iotests/common
@@ -289,10 +289,10 @@ testlist options
if [ ! -z "$DISPLAY" ]
then
- which xdiff >/dev/null 2>&1 && diff=xdiff
- which gdiff >/dev/null 2>&1 && diff=gdiff
- which tkdiff >/dev/null 2>&1 && diff=tkdiff
- which xxdiff >/dev/null 2>&1 && diff=xxdiff
+ command -v xdiff >/dev/null 2>&1 && diff=xdiff
+ command -v gdiff >/dev/null 2>&1 && diff=gdiff
+ command -v tkdiff >/dev/null 2>&1 && diff=tkdiff
+ command -v xxdiff >/dev/null 2>&1 && diff=xxdiff
fi
;;
diff --git a/tests/qemu-iotests/common.config b/tests/qemu-iotests/common.config
index bd6790b..91a5ef6 100644
--- a/tests/qemu-iotests/common.config
+++ b/tests/qemu-iotests/common.config
@@ -47,7 +47,7 @@ export PWD=`pwd`
# $1 = prog to look for, $2* = default pathnames if not found in $PATH
set_prog_path()
{
- p=`which $1 2> /dev/null`
+ p=`command -v $1 2> /dev/null`
if [ -n "$p" -a -x "$p" ]; then
echo $p
return 0
--
1.8.3.1
- [Qemu-devel] [PULL 17/73] monitor: Fix HMP tab completion, (continued)
- [Qemu-devel] [PULL 17/73] monitor: Fix HMP tab completion, Kevin Wolf, 2014/12/10
- [Qemu-devel] [PULL 21/73] ahci: replace SATA FIS type magic numbers with constants, Kevin Wolf, 2014/12/10
- [Qemu-devel] [PULL 23/73] block: Add AioContextNotifier functions to BB, Kevin Wolf, 2014/12/10
- [Qemu-devel] [PULL 19/73] iotests: Plain blkdebug filename generation, Kevin Wolf, 2014/12/10
- [Qemu-devel] [PULL 20/73] ahci: avoid #ifdef DEBUG_AHCI bitrot, Kevin Wolf, 2014/12/10
- [Qemu-devel] [PULL 22/73] block: Lift more functions into BlockBackend, Kevin Wolf, 2014/12/10
- [Qemu-devel] [PULL 24/73] block: Add blk_add_close_notifier() for BB, Kevin Wolf, 2014/12/10
- [Qemu-devel] [PULL 25/73] nbd: Change external interface to BlockBackend, Kevin Wolf, 2014/12/10
- [Qemu-devel] [PULL 26/73] nbd: Use BlockBackend internally, Kevin Wolf, 2014/12/10
- [Qemu-devel] [PULL 27/73] qemu-nbd: Use BlockBackend where reasonable, Kevin Wolf, 2014/12/10
- [Qemu-devel] [PULL 28/73] tests: Use "command -v" instead of which(1) in shell scripts,
Kevin Wolf <=
- [Qemu-devel] [PULL 30/73] qemu-iotests: Use qemu-io -f $IMGFMT, Kevin Wolf, 2014/12/10
- [Qemu-devel] [PULL 31/73] qemu-iotests: Add qemu-io format option in Python tests, Kevin Wolf, 2014/12/10
- [Qemu-devel] [PULL 29/73] qemu-io: Allow explicitly specifying format, Kevin Wolf, 2014/12/10
- [Qemu-devel] [PULL 32/73] qtests: Specify image format explicitly, Kevin Wolf, 2014/12/10
- [Qemu-devel] [PULL 34/73] block: Read only one sector for format probing, Kevin Wolf, 2014/12/10
- [Qemu-devel] [PULL 37/73] qemu-iotests: Test writing non-raw image headers to raw image, Kevin Wolf, 2014/12/10
- [Qemu-devel] [PULL 36/73] qemu-iotests: Fix stderr handling in common.qemu, Kevin Wolf, 2014/12/10
- [Qemu-devel] [PULL 35/73] raw: Prohibit dangerous writes for probed images, Kevin Wolf, 2014/12/10
- [Qemu-devel] [PULL 40/73] blockdev: acquire AioContext in QMP 'transaction' actions, Kevin Wolf, 2014/12/10
- [Qemu-devel] [PULL 42/73] qcow2: Fix header extension size check, Kevin Wolf, 2014/12/10