From: Markus Armbruster <armbru@redhat.com>
To: Steven Sistare <steven.sistare@oracle.com>
Cc: "Philippe Mathieu-Daudé" <philmd@linaro.org>,
qemu-devel@nongnu.org, "John Snow" <jsnow@redhat.com>,
"Cleber Rosa" <crosa@redhat.com>,
"Eric Blake" <eblake@redhat.com>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Daniel P. Berrange" <berrange@redhat.com>,
"Eduardo Habkost" <eduardo@habkost.net>,
"Fabiano Rosas" <farosas@suse.de>,
"Laurent Vivier" <lvivier@redhat.com>
Subject: Re: [PATCH V3 3/3] tests/qtest/qom-test: unit test for qom-list-getv
Date: Thu, 10 Jul 2025 10:54:06 +0200 [thread overview]
Message-ID: <87qzyofmtt.fsf@pond.sub.org> (raw)
In-Reply-To: <337e2790-195c-4852-8904-d421601f9011@oracle.com> (Steven Sistare's message of "Wed, 9 Jul 2025 11:17:30 -0400")
Steven Sistare <steven.sistare@oracle.com> writes:
> On 7/8/2025 6:02 PM, Philippe Mathieu-Daudé wrote:
>> Hi Steve,
>> On 8/7/25 19:24, Steve Sistare wrote:
>>> Add a unit test for qom-list-getv.
>>>
>>> Signed-off-by: Steve Sistare <steven.sistare@oracle.com>
>>> ---
>>> tests/qtest/qom-test.c | 64 ++++++++++++++++++++++++++++++++++++++++++++++++++
>>> 1 file changed, 64 insertions(+)
>>>
>>> diff --git a/tests/qtest/qom-test.c b/tests/qtest/qom-test.c
>>> index 27d70bc..4defff1 100644
>>> --- a/tests/qtest/qom-test.c
>>> +++ b/tests/qtest/qom-test.c
>>> @@ -11,11 +11,72 @@
>>> #include "qobject/qdict.h"
>>> #include "qobject/qlist.h"
>>> +#include "qobject/qstring.h"
>>> #include "qemu/cutils.h"
>>> #include "libqtest.h"
>>> static int verbosity_level;
>>> +static void test_getv(QTestState *qts, QList *paths)
>>> +{
>>> + QListEntry *entry, *prop_entry, *path_entry;
>>> + g_autoptr(QDict) response = NULL;
>>> + QDict *args = qdict_new();
>>> + QDict *prop;
>>> + QList *return_list;
>>> +
>>> + if (verbosity_level >= 2) {
>>
>> Tested-by: Philippe Mathieu-Daudé <philmd@linaro.org>
>>
>> But I note this doesn't assert anything except if you use V=3 and
>> look at the output.
>
> I don't follow. It unconditionally traverses the whole tree and asserts
> that properties are present. Plus, for V >= 2, it prints paths.
It starts with path "/machine".
For each property returned for that path, it checks there is a name and
type.
It collects the paths where the type starts with "child<" into a list,
and recurses. So it walks the entire tree under "/machine".
It does not examine property values at all. This is a gap in testing.
It does not check properties against expectations. The test would
silently pass if qom-list-getv always returned [], or if it always
returned crap types like "". Another gap.
Checking all this for the entire tree is entirely impractical. But we
could check it for a suitable path of our choice. I recommend to avoid
going into machine-dependent weeds there. Maybe create some suitable
thing with -object, and check that.
If you can't afford implementing this, document the gaps in a TODO
comment.
> It is patterned after test_properties() in the same file.
Same gaps :)
[...]
next prev parent reply other threads:[~2025-07-10 8:56 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-08 17:24 [PATCH V3 0/3] fast qom tree get Steve Sistare
2025-07-08 17:24 ` [PATCH V3 1/3] qom: qom-list-getv Steve Sistare
2025-07-08 21:54 ` Philippe Mathieu-Daudé
2025-07-10 7:13 ` Philippe Mathieu-Daudé
2025-07-09 8:39 ` Markus Armbruster
2025-07-09 15:19 ` Steven Sistare
2025-07-08 17:24 ` [PATCH V3 2/3] python: use qom-list-getv Steve Sistare
2025-07-08 17:24 ` [PATCH V3 3/3] tests/qtest/qom-test: unit test for qom-list-getv Steve Sistare
2025-07-08 17:47 ` Fabiano Rosas
2025-07-08 22:02 ` Philippe Mathieu-Daudé
2025-07-09 6:23 ` Markus Armbruster
2025-07-09 15:17 ` Steven Sistare
2025-07-10 7:12 ` Philippe Mathieu-Daudé
2025-07-10 8:54 ` Markus Armbruster [this message]
2025-07-10 15:58 ` Steven Sistare
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=87qzyofmtt.fsf@pond.sub.org \
--to=armbru@redhat.com \
--cc=berrange@redhat.com \
--cc=crosa@redhat.com \
--cc=eblake@redhat.com \
--cc=eduardo@habkost.net \
--cc=farosas@suse.de \
--cc=jsnow@redhat.com \
--cc=lvivier@redhat.com \
--cc=pbonzini@redhat.com \
--cc=philmd@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=steven.sistare@oracle.com \
/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.