Pino Toscano
2017-Oct-09 07:27 UTC
[Libguestfs] [PATCH nbdkit] tests/tls: fix qemu-img check
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
Richard W.M. Jones
2017-Oct-09 08:30 UTC
Re: [Libguestfs] [PATCH nbdkit] tests/tls: fix qemu-img check
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.6ACK .. 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
Seemingly Similar Threads
- [nbdkit PATCH] tests: Accommodate qemu-img 4.1 output change
- [nbdkit PATCH v2] tests: Accommodate qemu-img 4.1 output change
- [PATCH v2 nbdkit] tls: Implement Pre-Shared Keys (PSK)
- [nbdkit PATCH] tests: Swap nbdkit process order in test-nbd-tls-psk.sh
- Re: nbdkit & qemu 2.12: qemu-img: Protocol error: simple reply when structured reply chunk was expected