[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [Libguestfs] [nbdkit PATCH] tests: Accommodate qemu-img 4.1 output change



On Tue, Jul 30, 2019 at 04:04:14PM -0500, Eric Blake wrote:
> Where qemu-img 4.0 used to say 'virtual size: 100M', the 4.1 release
> now says 'virtual size: 100 MiB'.  Similarly, '5.0G' turned into '5
> GiB'. Update expected test output to tolerate either version of qemu.

This patch is fine and less invasive than I feared.  I don't know if
you want to do a second version using ‘--output=json’ and ‘jq’ to make
it more future-proof.

ACK

Rich.

> Signed-off-by: Eric Blake <eblake redhat com>
> ---
> 
> I already know I want to send a v2; on IRC, Rich pointed out that
> 'qemu-img info --output=json' is less prone to fickle changes, and we
> already depend on jq elsewhere in the testsuite.  But since I'd
> already got this written up, I'm at least posting it (if nothing else,
> to have a list archive to point to when someone else complains about
> qemu-img changing output).
> 
>  tests/test-ip.sh          | 4 ++--
>  tests/test-nbd-tls-psk.sh | 2 +-
>  tests/test-nbd-tls.sh     | 2 +-
>  tests/test-tls-psk.sh     | 2 +-
>  tests/test-tls.sh         | 2 +-
>  tests/test-truncate3.sh   | 2 +-
>  6 files changed, 7 insertions(+), 7 deletions(-)
> 
> diff --git a/tests/test-ip.sh b/tests/test-ip.sh
> index 636d3d3f..60f2e066 100755
> --- a/tests/test-ip.sh
> +++ b/tests/test-ip.sh
> @@ -59,7 +59,7 @@ ipv4_lo="$(ip -o -4 addr show scope host)"
>  if test -n "$ipv4_lo"; then
>      qemu-img info --image-opts "file.driver=nbd,file.host=127.0.0.1,file.port=$port" > ipv4.out
>      cat ipv4.out
> -    grep -sq "^virtual size: 100M" ipv4.out
> +    grep -sq "^virtual size: 100 *M" ipv4.out
>  fi
> 
>  # Check we can connect over the IPv6 loopback interface.
> @@ -67,5 +67,5 @@ ipv6_lo="$(ip -o -6 addr show scope host)"
>  if test -n "$ipv6_lo"; then
>      qemu-img info --image-opts "file.driver=nbd,file.host=::1,file.port=$port" > ipv6.out
>      cat ipv6.out
> -    grep -sq "^virtual size: 100M" ipv6.out
> +    grep -sq "^virtual size: 100 *M" ipv6.out
>  fi
> diff --git a/tests/test-nbd-tls-psk.sh b/tests/test-nbd-tls-psk.sh
> index d0bbc468..e07d553b 100755
> --- a/tests/test-nbd-tls-psk.sh
> +++ b/tests/test-nbd-tls-psk.sh
> @@ -78,4 +78,4 @@ LANG=C qemu-img info -f raw "nbd+unix:///?socket=$sock2" > nbd-tls-psk.out
>  cat nbd-tls-psk.out
> 
>  grep -sq "^file format: raw" nbd-tls-psk.out
> -grep -sq "^virtual size: 100M" nbd-tls-psk.out
> +grep -sq "^virtual size: 100 *M" nbd-tls-psk.out
> diff --git a/tests/test-nbd-tls.sh b/tests/test-nbd-tls.sh
> index af824d23..11fdea22 100755
> --- a/tests/test-nbd-tls.sh
> +++ b/tests/test-nbd-tls.sh
> @@ -79,4 +79,4 @@ LANG=C qemu-img info -f raw "nbd+unix:///?socket=$sock2" > nbd-tls.out
>  cat nbd-tls.out
> 
>  grep -sq "^file format: raw" nbd-tls.out
> -grep -sq "^virtual size: 100M" nbd-tls.out
> +grep -sq "^virtual size: 100 *M" nbd-tls.out
> diff --git a/tests/test-tls-psk.sh b/tests/test-tls-psk.sh
> index 393f5893..c0f03487 100755
> --- a/tests/test-tls-psk.sh
> +++ b/tests/test-tls-psk.sh
> @@ -80,4 +80,4 @@ qemu-img info \
>  cat tls-psk.out
> 
>  grep -sq "^file format: raw" tls-psk.out
> -grep -sq "^virtual size: 100M" tls-psk.out
> +grep -sq "^virtual size: 100 *M" tls-psk.out
> diff --git a/tests/test-tls.sh b/tests/test-tls.sh
> index 70d40aea..5936f9fa 100755
> --- a/tests/test-tls.sh
> +++ b/tests/test-tls.sh
> @@ -73,4 +73,4 @@ qemu-img info \
>  cat tls.out
> 
>  grep -sq "^file format: raw" tls.out
> -grep -sq "^virtual size: 100M" tls.out
> +grep -sq "^virtual size: 100 *M" tls.out
> diff --git a/tests/test-truncate3.sh b/tests/test-truncate3.sh
> index 0a7fba8b..396fd253 100755
> --- a/tests/test-truncate3.sh
> +++ b/tests/test-truncate3.sh
> @@ -51,7 +51,7 @@ start_nbdkit -P truncate3.pid -U $sock \
>         round-up=512
> 
>  LANG=C qemu-img info nbd:unix:$sock > truncate3.out
> -if ! grep "virtual size: 5.0G" truncate3.out; then
> +if ! grep "virtual size:.*(5368709120 " truncate3.out; then
>      echo "$0: unexpected output from truncate3 regression test:"
>      cat truncate3.out
>      exit 1
> -- 
> 2.20.1
> 
> _______________________________________________
> Libguestfs mailing list
> Libguestfs redhat com
> https://www.redhat.com/mailman/listinfo/libguestfs

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
libguestfs lets you edit virtual machines.  Supports shell scripting,
bindings from many languages.  http://libguestfs.org


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]