[PATCH] tests/qemu-iotests: Use "gsed" for expressions that require GNU sed

Thomas Huth posted 1 patch 3 weeks, 3 days ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20260113141415.97281-1-thuth@redhat.com
Maintainers: Kevin Wolf <kwolf@redhat.com>, Hanna Reitz <hreitz@redhat.com>
tests/qemu-iotests/286       | 2 +-
tests/qemu-iotests/common.rc | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
[PATCH] tests/qemu-iotests: Use "gsed" for expressions that require GNU sed
Posted by Thomas Huth 3 weeks, 3 days ago
From: Thomas Huth <thuth@redhat.com>

A bunch of tests are currently failing e.g. on FreeBSD like this:

 082   fail       [13:38:58] [13:38:59]   0.5s                 output
  mismatch (see .../build/tests/qemu-iotests/scratch/qcow2-file-082/082.out.bad)
 --- .../src/tests/qemu-iotests/082.out
 +++ .../build/tests/qemu-iotests/scratch/qcow2-file-082/082.out.bad
 @@ -17,7 +17,7 @@
  cluster_size: 4096
  Format specific information:
      compat: 1.1
 -    compression type: COMPRESSION_TYPE
 +    compression type: zlib
      lazy refcounts: true
      refcount bits: 16
      corrupt: false

This happens because the sed statements require GNU sed. Let's use
gsed in these spots to get it fixed.

Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 tests/qemu-iotests/286       | 2 +-
 tests/qemu-iotests/common.rc | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/tests/qemu-iotests/286 b/tests/qemu-iotests/286
index 38216c2a0e2..cc6aacf0228 100755
--- a/tests/qemu-iotests/286
+++ b/tests/qemu-iotests/286
@@ -62,7 +62,7 @@ wait=yes _cleanup_qemu
 
 echo 'Output structure:'
 $QEMU_IMG snapshot -l "$TEST_IMG" | tail -n 1 | tr -s ' ' \
-    | sed -e 's/\S\+/./g' \
+    | gsed -e 's/\S\+/./g' \
     | sed -e 's/\./(snapshot ID)/' \
           -e 's/\./(snapshot name)/' \
           -e 's/\./(VM state size value)/' \
diff --git a/tests/qemu-iotests/common.rc b/tests/qemu-iotests/common.rc
index c0f8f0f8dfa..731e4b2b998 100644
--- a/tests/qemu-iotests/common.rc
+++ b/tests/qemu-iotests/common.rc
@@ -719,7 +719,7 @@ _img_info()
     regex_json_spec_start='^ *"format-specific": \{'
     regex_json_child_start='^ *"children": \['
     $QEMU_IMG info $QEMU_IMG_EXTRA_ARGS "$@" "$TEST_IMG" 2>&1 | \
-        sed -e "s#$REMOTE_TEST_DIR#TEST_DIR#g" \
+        gsed -e "s#$REMOTE_TEST_DIR#TEST_DIR#g" \
             -e "s#$IMGPROTO:$TEST_DIR#TEST_DIR#g" \
             -e "s#$TEST_DIR#TEST_DIR#g" \
             -e "s#$SOCK_DIR/fuse-#TEST_DIR/#g" \
-- 
2.52.0
Re: [PATCH] tests/qemu-iotests: Use "gsed" for expressions that require GNU sed
Posted by Eric Blake 3 weeks, 2 days ago
On Tue, Jan 13, 2026 at 03:14:15PM +0100, Thomas Huth wrote:
> From: Thomas Huth <thuth@redhat.com>
> 
> A bunch of tests are currently failing e.g. on FreeBSD like this:
> 

> This happens because the sed statements require GNU sed. Let's use
> gsed in these spots to get it fixed.

gsed is not installed by that name on all machines...

\me checks

Ah, common.rc defines a function gsed that calls the appropriate sed.
No objection to the patch as-is, although a mention of the common.rc
existence of gsed might help the next reader who sees just the commit
message and wonders about it like I did.

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.
Virtualization:  qemu.org | libguestfs.org
Re: [PATCH] tests/qemu-iotests: Use "gsed" for expressions that require GNU sed
Posted by Daniel P. Berrangé 3 weeks, 3 days ago
On Tue, Jan 13, 2026 at 03:14:15PM +0100, Thomas Huth wrote:
> From: Thomas Huth <thuth@redhat.com>
> 
> A bunch of tests are currently failing e.g. on FreeBSD like this:
> 
>  082   fail       [13:38:58] [13:38:59]   0.5s                 output
>   mismatch (see .../build/tests/qemu-iotests/scratch/qcow2-file-082/082.out.bad)
>  --- .../src/tests/qemu-iotests/082.out
>  +++ .../build/tests/qemu-iotests/scratch/qcow2-file-082/082.out.bad
>  @@ -17,7 +17,7 @@
>   cluster_size: 4096
>   Format specific information:
>       compat: 1.1
>  -    compression type: COMPRESSION_TYPE
>  +    compression type: zlib
>       lazy refcounts: true
>       refcount bits: 16
>       corrupt: false
> 
> This happens because the sed statements require GNU sed. Let's use
> gsed in these spots to get it fixed.
> 
> Signed-off-by: Thomas Huth <thuth@redhat.com>
> ---
>  tests/qemu-iotests/286       | 2 +-
>  tests/qemu-iotests/common.rc | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>


With regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|