qemu-iotests: Fix error message if which(1) not installed
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.
Signed-off-by Fam Zheng <[email protected]>
--- tests/qemu-iotests/common.config | 2 ++ 1 file changed, 2 insertions(+)
tests/qemu-iotests/common.config +2 -0
@@ -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
Quoted 4 lines · Fam Zheng
When which(1) is not installed, we complain "perl not found" because it's the first
set_prog_pathcheck. 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