Skip to contentSkip to conversation

qemu-iotests: Fix error message if which(1) not installed

PATCH In review Fam Zheng 2 participants 2 messages Nov 18, 2014

lore
Share & tools
lore

Fam Zheng

author
#0 lore raw

PATCH 1/1 qemu-iotests: Fix error message if which(1) not installed

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.

---
 tests/qemu-iotests/common.config | 2 ++
 1 file changed, 2 insertions(+)
tests/qemu-iotests/common.config +2 -0
index bd6790b..9674f3a 100644
@@ -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"
 
Signature · 1 line
1.9.3
#1 lore raw
Quoted 4 lines · Fam Zheng

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.

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