qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Hajnoczi <stefanha@redhat.com>
To: qemu-devel@nongnu.org
Cc: Paolo Bonzini <pbonzini@redhat.com>,
	Kevin Wolf <kwolf@redhat.com>,
	Markus Armbruster <armbru@redhat.com>,
	Michael Roth <michael.roth@amd.com>, <qemu-block@nongnu.org>,
	Fiona Ebner <f.ebner@proxmox.com>,
	Hanna Reitz <hreitz@redhat.com>,
	Stefan Hajnoczi <stefanha@redhat.com>
Subject: [PATCH 1/3] iotests: add filter_qmp_generated_node_ids()
Date: Tue, 16 Jan 2024 14:00:40 -0500	[thread overview]
Message-ID: <20240116190042.1363717-2-stefanha@redhat.com> (raw)
In-Reply-To: <20240116190042.1363717-1-stefanha@redhat.com>

Add a filter function for QMP responses that contain QEMU's
automatically generated node ids. The ids change between runs and must
be masked in the reference output.

The next commit will use this new function.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
---
 tests/qemu-iotests/iotests.py | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py
index e5c5798c71..ea48af4a7b 100644
--- a/tests/qemu-iotests/iotests.py
+++ b/tests/qemu-iotests/iotests.py
@@ -651,6 +651,13 @@ def _filter(_key, value):
 def filter_generated_node_ids(msg):
     return re.sub("#block[0-9]+", "NODE_NAME", msg)
 
+def filter_qmp_generated_node_ids(qmsg):
+    def _filter(_key, value):
+        if is_str(value):
+            return filter_generated_node_ids(value)
+        return value
+    return filter_qmp(qmsg, _filter)
+
 def filter_img_info(output: str, filename: str,
                     drop_child_info: bool = True) -> str:
     lines = []
-- 
2.43.0



  reply	other threads:[~2024-01-16 19:01 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-16 19:00 [PATCH 0/3] monitor: only run coroutine commands in qemu_aio_context Stefan Hajnoczi
2024-01-16 19:00 ` Stefan Hajnoczi [this message]
2024-01-17 16:13   ` [PATCH 1/3] iotests: add filter_qmp_generated_node_ids() Kevin Wolf
2024-01-16 19:00 ` [PATCH 2/3] iotests: port 141 to Python for reliable QMP testing Stefan Hajnoczi
2024-01-17 16:13   ` Kevin Wolf
2024-01-17 18:04   ` Kevin Wolf
2024-01-18 14:55     ` Stefan Hajnoczi
2024-01-18 15:36       ` Kevin Wolf
2024-01-16 19:00 ` [PATCH 3/3] monitor: only run coroutine commands in qemu_aio_context Stefan Hajnoczi
2024-01-17 18:10   ` Kevin Wolf
2024-01-18 15:47   ` Fiona Ebner
2024-02-03  9:01   ` Michael Tokarev
2024-02-03 11:30     ` Michael Tokarev
2024-02-13 20:19       ` Stefan Hajnoczi
2024-01-18 11:20 ` [PATCH 0/3] " Michael Tokarev
2024-01-29 11:38 ` Peter Maydell
2024-02-03  2:19   ` YangHang Liu

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=20240116190042.1363717-2-stefanha@redhat.com \
    --to=stefanha@redhat.com \
    --cc=armbru@redhat.com \
    --cc=f.ebner@proxmox.com \
    --cc=hreitz@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=michael.roth@amd.com \
    --cc=pbonzini@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).