Skip to contentSkip to conversation

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

PATCH In review Thomas Huth 3 participants 3 messages Jan 13 – Jan 14

lore
Share & tools
lore
#0 lore raw

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

From: Thomas Huth <[email protected]>

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.

---
 tests/qemu-iotests/286       | 2 +-
 tests/qemu-iotests/common.rc | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
tests/qemu-iotests/286 +1 -1
index 38216c2a0e2..cc6aacf0228 100755
@@ -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)/' \
tests/qemu-iotests/common.rc +1 -1
index c0f8f0f8dfa..731e4b2b998 100644
@@ -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" \
Signature · 1 line
2.52.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 18 lines · Thomas Huth

From: Thomas Huth <[email protected]>

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

Quoted 8 lines

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

---
 tests/qemu-iotests/286       | 2 +-
 tests/qemu-iotests/common.rc | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

With regards,
Daniel

Signature · 3 lines
|: 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 :|
#2 lore raw
In reply to Thomas Huth
Quoted 7 lines · Thomas Huth

From: Thomas Huth <[email protected]>

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.

Signature · 3 lines
Eric Blake, Principal Software Engineer
Red Hat, Inc.
Virtualization:  qemu.org | libguestfs.org