qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Hajnoczi <stefanha@redhat.com>
To: qemu-devel@nongnu.org
Cc: qemu-block@nongnu.org, Stefan Hajnoczi <stefanha@redhat.com>,
	Hanna Reitz <hreitz@redhat.com>, Kevin Wolf <kwolf@redhat.com>
Subject: [PATCH 4/7] iotests: filter img create backing_file when IMGPROTO is modified
Date: Tue, 25 Jul 2023 10:19:12 -0400	[thread overview]
Message-ID: <20230725141915.386364-5-stefanha@redhat.com> (raw)
In-Reply-To: <20230725141915.386364-1-stefanha@redhat.com>

197 and 215 modify IMGPROTO, IMGFMT, etc temporarily while creating an
additional image file after the main test image. The backing file name
still has the old IMGPROTO, IMGFMT, etc. This means _filter_img_create
will not filter the backing_file= output from qemu-img.

Add a helper that filters backing_file= output so these test cases are
more robust. This will be necessary in order to enable the io_uring
protocol driver in qemu-iotests.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
---
 tests/qemu-iotests/197           | 4 +++-
 tests/qemu-iotests/197.out       | 2 +-
 tests/qemu-iotests/215           | 4 +++-
 tests/qemu-iotests/215.out       | 2 +-
 tests/qemu-iotests/common.filter | 8 ++++++++
 5 files changed, 16 insertions(+), 4 deletions(-)

diff --git a/tests/qemu-iotests/197 b/tests/qemu-iotests/197
index a2547bc280..756603b19e 100755
--- a/tests/qemu-iotests/197
+++ b/tests/qemu-iotests/197
@@ -68,7 +68,9 @@ fi
 _make_test_img 4G
 $QEMU_IO -c "write -P 55 3G 1k" "$TEST_IMG" | _filter_qemu_io
 IMGPROTO=file IMGFMT=qcow2 TEST_IMG_FILE="$TEST_WRAP" \
-    _make_test_img --no-opts -F "$IMGFMT" -b "$TEST_IMG" | _filter_img_create
+    _make_test_img --no-opts -F "$IMGFMT" -b "$TEST_IMG" | \
+    _filter_img_create_backing_file | \
+    _filter_img_create
 $QEMU_IO -f qcow2 -c "write -z -u 1M 64k" "$TEST_WRAP" | _filter_qemu_io
 
 # Ensure that a read of two clusters, but where one is already allocated,
diff --git a/tests/qemu-iotests/197.out b/tests/qemu-iotests/197.out
index ad414c3b0e..bbfb3413e4 100644
--- a/tests/qemu-iotests/197.out
+++ b/tests/qemu-iotests/197.out
@@ -5,7 +5,7 @@ QA output created by 197
 Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=4294967296
 wrote 1024/1024 bytes at offset 3221225472
 1 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
-Formatting 'TEST_DIR/t.wrap.IMGFMT', fmt=IMGFMT size=4294967296 backing_file=TEST_DIR/t.IMGFMT backing_fmt=IMGFMT
+Formatting 'TEST_DIR/t.wrap.IMGFMT', fmt=IMGFMT size=4294967296 backing_file=BACKING_FILE backing_fmt=IMGFMT
 wrote 65536/65536 bytes at offset 1048576
 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
 read 131072/131072 bytes at offset 1048576
diff --git a/tests/qemu-iotests/215 b/tests/qemu-iotests/215
index d464596f14..145f2bb3eb 100755
--- a/tests/qemu-iotests/215
+++ b/tests/qemu-iotests/215
@@ -65,7 +65,9 @@ fi
 _make_test_img 4G
 $QEMU_IO -c "write -P 55 3G 1k" "$TEST_IMG" | _filter_qemu_io
 IMGPROTO=file IMGFMT=qcow2 TEST_IMG_FILE="$TEST_WRAP" \
-    _make_test_img --no-opts -F "$IMGFMT" -b "$TEST_IMG" | _filter_img_create
+    _make_test_img --no-opts -F "$IMGFMT" -b "$TEST_IMG" | \
+    _filter_img_create_backing_file | \
+    _filter_img_create
 $QEMU_IO -f qcow2 -c "write -z -u 1M 64k" "$TEST_WRAP" | _filter_qemu_io
 
 # Ensure that a read of two clusters, but where one is already allocated,
diff --git a/tests/qemu-iotests/215.out b/tests/qemu-iotests/215.out
index 5a2fe40d03..d10cce71bc 100644
--- a/tests/qemu-iotests/215.out
+++ b/tests/qemu-iotests/215.out
@@ -5,7 +5,7 @@ QA output created by 215
 Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=4294967296
 wrote 1024/1024 bytes at offset 3221225472
 1 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
-Formatting 'TEST_DIR/t.wrap.IMGFMT', fmt=IMGFMT size=4294967296 backing_file=TEST_DIR/t.IMGFMT backing_fmt=IMGFMT
+Formatting 'TEST_DIR/t.wrap.IMGFMT', fmt=IMGFMT size=4294967296 backing_file=BACKING_FILE backing_fmt=IMGFMT
 wrote 65536/65536 bytes at offset 1048576
 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
 read 131072/131072 bytes at offset 1048576
diff --git a/tests/qemu-iotests/common.filter b/tests/qemu-iotests/common.filter
index 4acac16c52..b047fe43a0 100644
--- a/tests/qemu-iotests/common.filter
+++ b/tests/qemu-iotests/common.filter
@@ -206,6 +206,14 @@ _filter_img_create()
     done
 }
 
+# When creating additional images with different IMGPROTO, IMGFMT, etc than the
+# main test image, _filter_img_create cannot filter backing_file since it
+# contains different IMGPROTO, IMGFMT, etc values than currently in use.
+_filter_img_create_backing_file()
+{
+    sed -e "s/ backing_file=[^ ]*/ backing_file=BACKING_FILE/g"
+}
+
 _filter_img_create_size()
 {
     gsed -e "s# size=[0-9]\\+# size=SIZE#g"
-- 
2.41.0



  parent reply	other threads:[~2023-07-25 14:21 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-25 14:19 [PATCH 0/7] iotests: add -io_uring support Stefan Hajnoczi
2023-07-25 14:19 ` [PATCH 1/7] block/blkio: add io_uring: filename parsing Stefan Hajnoczi
2023-07-25 14:19 ` [PATCH 2/7] block/blkio: add "simple" creation support Stefan Hajnoczi
2023-07-25 14:19 ` [PATCH 3/7] iotests: string substitution order in _filter_img_create_filenames Stefan Hajnoczi
2023-07-25 14:19 ` Stefan Hajnoczi [this message]
2023-07-25 14:19 ` [PATCH 5/7] iotests: add -io_uring support Stefan Hajnoczi
2023-07-25 14:19 ` [PATCH 6/7] iotests: add io_uring to supported protocols in 012 Stefan Hajnoczi
2023-07-25 14:19 ` [PATCH 7/7] iotests: add io_uring to supported protocols in 052 Stefan Hajnoczi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230725141915.386364-5-stefanha@redhat.com \
    --to=stefanha@redhat.com \
    --cc=hreitz@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).