qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] qemu-iotests: Fix error message if which(1) not installed
@ 2014-11-18  2:49 Fam Zheng
  2014-11-18  4:40 ` Eric Blake
  0 siblings, 1 reply; 2+ messages in thread
From: Fam Zheng @ 2014-11-18  2:49 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-trivial, kwolf, mjt, stefanha, mreitz

When which(1) is not installed, we complain "perl not found" because
it's the first set_prog_path check. The error message is misleading.

Fix it by adding a check for which(1) in the beginning.

Signed-off-by: Fam Zheng <famz@redhat.com>
---
 tests/qemu-iotests/common.config | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tests/qemu-iotests/common.config b/tests/qemu-iotests/common.config
index bd6790b..9674f3a 100644
--- a/tests/qemu-iotests/common.config
+++ b/tests/qemu-iotests/common.config
@@ -73,6 +73,8 @@ _fatal()
     exit 1
 }
 
+which -v &>/dev/null || _fatal "which not found"
+
 export PERL_PROG="`set_prog_path perl`"
 [ "$PERL_PROG" = "" ] && _fatal "perl not found"
 
-- 
1.9.3

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [Qemu-devel] [PATCH] qemu-iotests: Fix error message if which(1) not installed
  2014-11-18  2:49 [Qemu-devel] [PATCH] qemu-iotests: Fix error message if which(1) not installed Fam Zheng
@ 2014-11-18  4:40 ` Eric Blake
  0 siblings, 0 replies; 2+ messages in thread
From: Eric Blake @ 2014-11-18  4:40 UTC (permalink / raw)
  To: Fam Zheng, qemu-devel; +Cc: qemu-trivial, kwolf, mjt, stefanha, mreitz

[-- Attachment #1: Type: text/plain, Size: 557 bytes --]

On 11/17/2014 07:49 PM, Fam Zheng wrote:
> When which(1) is not installed, we complain "perl not found" because
> it's the first set_prog_path check. The error message is misleading.
> 
> Fix it by adding a check for which(1) in the beginning.

Why not instead change set_prog_path to use 'command -v' instead of
'which'?  As this is a bash script, we shouldn't need to shell out to an
optional package for something we can do natively.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 539 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-11-18  4:40 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-11-18  2:49 [Qemu-devel] [PATCH] qemu-iotests: Fix error message if which(1) not installed Fam Zheng
2014-11-18  4:40 ` Eric Blake

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).