qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Andrey Zhadchenko via <qemu-devel@nongnu.org>
To: qemu-block@nongnu.org, kwolf@redhat.com
Cc: hreitz@redhat.com, qemu-devel@nongnu.org, den@virtuozzo.com
Subject: [PATCH 2/2] iotests: add new test case for image streaming
Date: Thu, 14 Sep 2023 13:09:51 +0200	[thread overview]
Message-ID: <20230914110951.845856-3-andrey.zhadchenko@virtuozzo.com> (raw)
In-Reply-To: <20230914110951.845856-1-andrey.zhadchenko@virtuozzo.com>

Check if we can list named block nodes when the block-stream is
finalized but not yet dismissed
This previously led to a crash

Signed-off-by: Andrey Zhadchenko <andrey.zhadchenko@virtuozzo.com>
---
 tests/qemu-iotests/030     | 17 +++++++++++++++++
 tests/qemu-iotests/030.out |  4 ++--
 2 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/tests/qemu-iotests/030 b/tests/qemu-iotests/030
index 98595d47fe..2be407a8da 100755
--- a/tests/qemu-iotests/030
+++ b/tests/qemu-iotests/030
@@ -192,6 +192,23 @@ test_img = os.path.join(iotests.test_dir, 'test.img')
             self.assert_qmp(result, 'return', {})
 
 
+    def test_auto_dismiss(self):
+        result = self.vm.qmp('block-stream', device='drive0', auto_dismiss=False)
+        completed = False
+        while not completed:
+            for event in self.vm.get_qmp_events(wait=True):
+                self.assertNotEqual(event['event'], 'BLOCK_JOB_ERROR')
+                if event['event'] == 'BLOCK_JOB_COMPLETED':
+                    self.assert_qmp(event, 'data/device', 'drive0')
+                    completed = True
+                elif event['event'] == 'JOB_STATUS_CHANGE':
+                    self.assert_qmp(event, 'data/id', 'drive0')
+
+        result = self.vm.qmp('query-named-block-nodes')
+        result = self.vm.qmp('job-dismiss', id='drive0')
+        self.assert_qmp(result, 'return', {})
+
+
 class TestParallelOps(iotests.QMPTestCase):
     num_ops = 4 # Number of parallel block-stream operations
     num_imgs = num_ops * 2 + 1
diff --git a/tests/qemu-iotests/030.out b/tests/qemu-iotests/030.out
index 6d9bee1a4b..af8dac10f9 100644
--- a/tests/qemu-iotests/030.out
+++ b/tests/qemu-iotests/030.out
@@ -1,5 +1,5 @@
-...........................
+............................
 ----------------------------------------------------------------------
-Ran 27 tests
+Ran 28 tests
 
 OK
-- 
2.40.1



      parent reply	other threads:[~2023-09-14 11:10 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-14 11:09 [PATCH 0/2] block: do not try to list nearly-dropped filters Andrey Zhadchenko via
2023-09-14 11:09 ` [PATCH 1/2] " Andrey Zhadchenko via
2023-09-14 11:09 ` Andrey Zhadchenko via [this message]

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=20230914110951.845856-3-andrey.zhadchenko@virtuozzo.com \
    --to=qemu-devel@nongnu.org \
    --cc=andrey.zhadchenko@virtuozzo.com \
    --cc=den@virtuozzo.com \
    --cc=hreitz@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=qemu-block@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).