All of lore.kernel.org
 help / color / mirror / Atom feed
From: Max Reitz <mreitz@redhat.com>
To: Kevin Wolf <kwolf@redhat.com>, qemu-block@nongnu.org
Cc: jsnow@redhat.com, eblake@redhat.com, pkrempa@redhat.com,
	qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 06/14] qemu-iotests: Add VM.qmp_log()
Date: Tue, 29 May 2018 13:48:44 +0200	[thread overview]
Message-ID: <2b57e7d1-6980-298e-3cd4-9370595f58d7@redhat.com> (raw)
In-Reply-To: <20180525163327.23097-7-kwolf@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 1558 bytes --]

On 2018-05-25 18:33, Kevin Wolf wrote:
> This adds a helper function that logs both the QMP request and the
> received response before returning it.
> 
> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
> ---
>  tests/qemu-iotests/iotests.py | 11 +++++++++++
>  1 file changed, 11 insertions(+)
> 
> diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py
> index 17aa7c88dc..319d898172 100644
> --- a/tests/qemu-iotests/iotests.py
> +++ b/tests/qemu-iotests/iotests.py
> @@ -206,6 +206,10 @@ def filter_qmp_event(event):
>          event['timestamp']['microseconds'] = 'USECS'
>      return event
>  
> +def filter_testfiles(msg):
> +    prefix = os.path.join(test_dir, "%s-" % (os.getpid()))
> +    return msg.replace(prefix, 'TEST_DIR/')

I'd prefer 'TEST_DIR/PID-' (just because).

But if you really like just 'TEST_DIR/'...  Then OK.

> +
>  def log(msg, filters=[]):
>      for flt in filters:
>          msg = flt(msg)
> @@ -389,6 +393,13 @@ class VM(qtest.QEMUQtestMachine):
>              result.append(filter_qmp_event(ev))
>          return result
>  
> +    def qmp_log(self, cmd, **kwargs):
> +        logmsg = "{'execute': '%s', 'arguments': %s}" % (cmd, kwargs)
> +        log(filter_testfiles(logmsg))
> +        result = self.qmp(cmd, **kwargs)
> +        log(result)

I think we should apply the testfiles filter here, too (error messages
may contain file names, after all).

Max

> +        return result
> +
>  
>  index_re = re.compile(r'([^\[]+)\[([^\]]+)\]')
>  
> 



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

  reply	other threads:[~2018-05-29 11:49 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-25 16:33 [Qemu-devel] [PATCH 00/14] block: Make blockdev-create a job and stable API Kevin Wolf
2018-05-25 16:33 ` [Qemu-devel] [PATCH 01/14] vdi: Fix vdi_co_do_create() return value Kevin Wolf
2018-05-29 10:38   ` Max Reitz
2018-05-29 14:45   ` [Qemu-devel] [Qemu-block] " Jeff Cody
2018-05-25 16:33 ` [Qemu-devel] [PATCH 02/14] vhdx: Fix vhdx_co_create() " Kevin Wolf
2018-05-29 10:40   ` Max Reitz
2018-05-29 14:44   ` [Qemu-devel] [Qemu-block] " Jeff Cody
2018-05-25 16:33 ` [Qemu-devel] [PATCH 03/14] job: Add error message for failing jobs Kevin Wolf
2018-05-29 11:01   ` Max Reitz
2018-05-29 14:43   ` [Qemu-devel] [Qemu-block] " Jeff Cody
2018-05-29 19:54     ` Kevin Wolf
2018-05-25 16:33 ` [Qemu-devel] [PATCH 04/14] block/create: Make x-blockdev-create a job Kevin Wolf
2018-05-29 11:38   ` Max Reitz
2018-05-29 15:27   ` [Qemu-devel] [Qemu-block] " Jeff Cody
2018-05-29 15:40     ` Kevin Wolf
2018-05-25 16:33 ` [Qemu-devel] [PATCH 05/14] qemu-iotests: Add VM.get_qmp_events_filtered() Kevin Wolf
2018-05-29 11:41   ` Max Reitz
2018-05-25 16:33 ` [Qemu-devel] [PATCH 06/14] qemu-iotests: Add VM.qmp_log() Kevin Wolf
2018-05-29 11:48   ` Max Reitz [this message]
2018-05-29 12:12     ` Kevin Wolf
2018-05-29 12:15       ` Max Reitz
2018-05-29 12:39         ` Kevin Wolf
2018-05-29 12:41           ` Max Reitz
2018-05-29 18:31   ` [Qemu-devel] [Qemu-block] " Jeff Cody
2018-05-25 16:33 ` [Qemu-devel] [PATCH 07/14] qemu-iotests: Add iotests.img_info_log() Kevin Wolf
2018-05-29 11:56   ` Max Reitz
2018-05-25 16:33 ` [Qemu-devel] [PATCH 08/14] qemu-iotests: Rewrite 206 for blockdev-create job Kevin Wolf
2018-05-29 12:27   ` Max Reitz
2018-05-29 18:49     ` Kevin Wolf
2018-05-25 16:33 ` [Qemu-devel] [PATCH 09/14] qemu-iotests: Rewrite 207 " Kevin Wolf
2018-05-29 12:44   ` Max Reitz
2018-05-29 12:47   ` Max Reitz
2018-05-29 17:52   ` [Qemu-devel] [Qemu-block] " Jeff Cody
2018-05-25 16:33 ` [Qemu-devel] [PATCH 10/14] qemu-iotests: Rewrite 210 " Kevin Wolf
2018-05-29 13:02   ` Max Reitz
2018-05-29 18:23   ` [Qemu-devel] [Qemu-block] " Jeff Cody
2018-05-25 16:33 ` [Qemu-devel] [PATCH 11/14] qemu-iotests: Rewrite 211 " Kevin Wolf
2018-05-29 13:12   ` Max Reitz
2018-05-25 16:33 ` [Qemu-devel] [PATCH 12/14] qemu-iotests: Rewrite 212 " Kevin Wolf
2018-05-29 13:21   ` Max Reitz
2018-05-25 16:33 ` [Qemu-devel] [PATCH 13/14] qemu-iotests: Rewrite 213 " Kevin Wolf
2018-05-29 13:27   ` Max Reitz
2018-05-25 16:33 ` [Qemu-devel] [PATCH 14/14] block/create: Mark blockdev-create stable Kevin Wolf
2018-05-29 13:30   ` Max Reitz
2018-05-29 18:25   ` [Qemu-devel] [Qemu-block] " Jeff Cody
2018-05-25 16:52 ` [Qemu-devel] [PATCH 00/14] block: Make blockdev-create a job and stable API no-reply
2018-05-25 18:13 ` Eric Blake
2018-05-28  8:42   ` Kevin Wolf

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=2b57e7d1-6980-298e-3cd4-9370595f58d7@redhat.com \
    --to=mreitz@redhat.com \
    --cc=eblake@redhat.com \
    --cc=jsnow@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=pkrempa@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.