qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v2 21/23] libqtest: Remove qtest_qmp_discard_res


From: Eric Blake
Subject: Re: [Qemu-devel] [PATCH v2 21/23] libqtest: Remove qtest_qmp_discard_response() & friends
Date: Fri, 27 Jul 2018 12:03:25 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0

On 07/27/2018 11:46 AM, Thomas Huth wrote:
On 07/27/2018 05:13 PM, Markus Armbruster wrote:
qtest_qmp_discard_response(...) is shorthand for
qobject_unref(qtest_qmp(...), except it's not actually shorter.

But the latter is IMHO harder to read.

Maybe, but then it lends itself well to:

QObject *rsp = qtest_qmp(...);
qobject_unref(rsp);

which is where you do insert tests for valid responses.

And it might be shorter in the compiled binary (one function call vs. two).

The size of the test binaries is not our biggest concern.


Moreover, the presence of these functions encourage sloppy testing.

Shouldn't we then rather fix the tests to check for valid responses
instead of replacing this function with harder-to-read code?

I think such fixes are now easier to make, but can be separate followup patches. The mechanical conversion is fine to me.

--
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org



reply via email to

[Prev in Thread] Current Thread [Next in Thread]