[Libguestfs] [PATCH nbdkit] tests/tls: fix qemu-img check

Richard W.M. Jones rjones at redhat.com
Mon Oct 9 08:30:05 UTC 2017


On Mon, Oct 09, 2017 at 09:27:44AM +0200, Pino Toscano wrote:
> Old qemu-img versions return 1 instead of 0 for --help, failing the
> presence check: hence, which to `command` for checking the presence of
> qemu-img.
> 
> Also, check that qemu-img actually has the --object option, since the
> test uses it.
> ---
>  tests/test-tls.sh | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/tests/test-tls.sh b/tests/test-tls.sh
> index 73d44fa..7a6c949 100755
> --- a/tests/test-tls.sh
> +++ b/tests/test-tls.sh
> @@ -40,10 +40,14 @@ if ! ss --version; then
>      echo "$0: 'ss' command not available"
>      exit 77
>  fi
> -if ! qemu-img --help; then
> +if ! command -v qemu-img > /dev/null; then
>      echo "$0: 'qemu-img' command not available"
>      exit 77
>  fi
> +if ! qemu-img --help | grep -- --object; then
> +    echo "$0: 'qemu-img' command does not have the --object option"
> +    exit 77
> +fi
>  
>  # Does the nbdkit binary support TLS?
>  if ! nbdkit --dump-config | grep -sq tls=yes; then
> -- 
> 2.13.6

ACK .. didn't know about ‘command’ before ...

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-builder quickly builds VMs from scratch
http://libguestfs.org/virt-builder.1.html




More information about the Libguestfs mailing list