From: Eric Blake <eblake@redhat.com>
To: Markus Armbruster <armbru@redhat.com>, Peter Xu <peterx@redhat.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>, Fam Zheng <famz@redhat.com>,
qemu-devel@nongnu.org, Gerd Hoffmann <kraxel@redhat.com>
Subject: Re: [Qemu-devel] [PATCH 1/4] libqtest: add qmp_device_del()
Date: Mon, 2 Oct 2017 12:33:25 -0500 [thread overview]
Message-ID: <0ba97cc0-4c1a-a99a-9e9d-ff24cc54db24@redhat.com> (raw)
In-Reply-To: <87bmlp1mxl.fsf@dusky.pond.sub.org>
[-- Attachment #1: Type: text/plain, Size: 1753 bytes --]
On 10/02/2017 12:25 PM, Markus Armbruster wrote:
> Peter Xu <peterx@redhat.com> writes:
>
>> Device deletion is tricky since we'll get both a response and an event,
>> while the order of arrival may vary. Provide a helper to handle this
>> complexity.
>>
>> Signed-off-by: Peter Xu <peterx@redhat.com>
>> ---
>> tests/libqtest.c | 48 ++++++++++++++++++++++++++++++++++++++++++++++++
>> tests/libqtest.h | 8 ++++++++
>> 2 files changed, 56 insertions(+)
>>
>> diff --git a/tests/libqtest.c b/tests/libqtest.c
>> index b9a1f18..a34d8c4 100644
>> --- a/tests/libqtest.c
>> +++ b/tests/libqtest.c
>> @@ -925,6 +925,54 @@ QDict *qmp(const char *fmt, ...)
>> return response;
>> }
>>
>> +void qmp_device_del(const char *id)
>> +
>> + response2 = qmp("");
>> + g_assert(response2);
>> + g_assert(!qdict_haskey(response2, "error"));
>
> qmp_receive() would be cleaner than qmp("").
>
>> +
>> + if (qdict_haskey(response1, "event")) {
>> + event = response1;
>> + } else if (qdict_haskey(response2, "event")) {
>> + event = response2;
>> + }
>> + g_assert(event);
>> + g_assert(!strcmp(qdict_get_str(event, "event"), "DEVICE_DELETED"));
>> +
>> + QDECREF(response1);
>> + QDECREF(response2);
>> +}
>> +
>
> Uh, this looks similar to existing qtest_qmp_device_del(). Do we need both?
In fact, if I'm reading correctly, this is an early version, which was
retitled into commit acd80015 adding qtest_qmp_device_del().
At any rate, when I post my respin of my libqtest cleanups, I have the
qmp("") slated to be fixed.
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3266
Virtualization: qemu.org | libvirt.org
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 619 bytes --]
next prev parent reply other threads:[~2017-10-02 17:33 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-13 9:36 [Qemu-devel] [PATCH 0/4] qtest: fix "device_del" out-of-order events Peter Xu
2017-09-13 9:36 ` [Qemu-devel] [PATCH 1/4] libqtest: add qmp_device_del() Peter Xu
2017-10-02 17:25 ` Markus Armbruster
2017-10-02 17:33 ` Eric Blake [this message]
2017-09-13 9:36 ` [Qemu-devel] [PATCH 2/4] tests: use qmp_device_del() where proper Peter Xu
2017-09-13 9:36 ` [Qemu-devel] [PATCH 3/4] libqtest: add qmp_device_add() Peter Xu
2017-09-13 10:01 ` Thomas Huth
2017-09-13 9:36 ` [Qemu-devel] [PATCH 4/4] tests: use qmp_device_add() where proper Peter Xu
2017-09-13 9:53 ` [Qemu-devel] [PATCH 0/4] qtest: fix "device_del" out-of-order events Thomas Huth
2017-09-13 10:28 ` Peter Xu
2017-09-13 10:35 ` Thomas Huth
2017-09-13 10:42 ` Peter Xu
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=0ba97cc0-4c1a-a99a-9e9d-ff24cc54db24@redhat.com \
--to=eblake@redhat.com \
--cc=armbru@redhat.com \
--cc=famz@redhat.com \
--cc=kraxel@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peterx@redhat.com \
--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).