From: Eduardo Habkost <ehabkost@redhat.com>
To: Igor Mammedov <imammedo@redhat.com>
Cc: qemu-devel@nongnu.org, "Paolo Bonzini" <pbonzini@redhat.com>,
"Andreas Färber" <afaerber@suse.de>
Subject: Re: [Qemu-devel] [PATCH 1/2] tests: Test case for object_resolve_path*()
Date: Mon, 10 Jul 2017 11:45:57 -0300 [thread overview]
Message-ID: <20170710144557.GH12152@localhost.localdomain> (raw)
In-Reply-To: <20170710101041.553a792a@nial.brq.redhat.com>
On Mon, Jul 10, 2017 at 10:10:41AM +0200, Igor Mammedov wrote:
> On Fri, 7 Jul 2017 18:30:51 -0300
> Eduardo Habkost <ehabkost@redhat.com> wrote:
>
> > Test for partial path lookup using object_resolve_path*().
> >
> > Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
> > ---
> > tests/check-qom-proplist.c | 41 +++++++++++++++++++++++++++++++++++++++++
> > 1 file changed, 41 insertions(+)
> >
> > diff --git a/tests/check-qom-proplist.c b/tests/check-qom-proplist.c
> > index 8e432e9..abafbd7 100644
> > --- a/tests/check-qom-proplist.c
> > +++ b/tests/check-qom-proplist.c
> > @@ -568,6 +568,46 @@ static void test_dummy_delchild(void)
> > object_unparent(OBJECT(dev));
> > }
> >
> > +static void test_qom_partial_path(void)
> > +{
> > + Object *root = object_get_objects_root();
> > + Object *cont1 = container_get(root, "/cont1");
> > + Object *obj1 = object_new(TYPE_DUMMY);
> > + Object *obj2a = object_new(TYPE_DUMMY);
> > + Object *obj2b = object_new(TYPE_DUMMY);
> > + bool ambiguous;
> > +
> > + /* Objects created:
> > + * /cont1
> > + * /cont1/obj1
> > + * /cont1/obj2 (obj2a)
> > + * /obj2 (obj2b)
> > + */
> > + object_property_add_child(cont1, "obj1", obj1, &error_abort);
> > + object_unref(obj1);
> > + object_property_add_child(cont1, "obj2", obj2a, &error_abort);
> > + object_unref(obj2a);
> > + object_property_add_child(root, "obj2", obj2b, &error_abort);
> > + object_unref(obj2b);
> > +
> > + ambiguous = false;
> > + g_assert(!object_resolve_path_type("", TYPE_DUMMY, &ambiguous));
> > + g_assert(ambiguous);
> > +
> > + ambiguous = false;
> > + g_assert(!object_resolve_path("obj2", &ambiguous));
> > + g_assert(ambiguous);
> > +
> > + ambiguous = false;
> > + g_assert(object_resolve_path("obj1", &ambiguous) == obj1);
> > + g_assert(!ambiguous);
>
> I'd also add test case for
> object_resolve_path(..., NULL)
They are added by patch 2/2, after the bug is fixed.
>
> > +
> > + object_unparent(obj1);
> > + object_unparent(obj2a);
> > + object_unparent(obj2b);
> Are above unparenting is necessary?
>
> > + object_unparent(cont1);
> Wouldn't parent destruction sufficient to trigger
> implicit destruction of children?
Probably it is. I will test it.
--
Eduardo
next prev parent reply other threads:[~2017-07-10 14:46 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-07 21:30 [Qemu-devel] [PATCH 0/2] qom: Fix ambiguous path detection when ambiguous=NULL Eduardo Habkost
2017-07-07 21:30 ` [Qemu-devel] [PATCH 1/2] tests: Test case for object_resolve_path*() Eduardo Habkost
2017-07-10 8:10 ` Igor Mammedov
2017-07-10 14:45 ` Eduardo Habkost [this message]
2017-07-10 14:48 ` Igor Mammedov
2017-07-10 15:33 ` [Qemu-devel] [PATCH] fixup! qom: Fix ambiguous path detection when ambiguous=NULL Eduardo Habkost
2017-07-10 16:26 ` Igor Mammedov
2017-07-07 21:30 ` [Qemu-devel] [PATCH 2/2] " Eduardo Habkost
2017-07-10 8:18 ` Igor Mammedov
2017-07-10 6:42 ` [Qemu-devel] [PATCH 0/2] " Mark Cave-Ayland
2017-07-10 18:23 ` Eduardo Habkost
2017-07-13 12:09 ` Paolo Bonzini
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=20170710144557.GH12152@localhost.localdomain \
--to=ehabkost@redhat.com \
--cc=afaerber@suse.de \
--cc=imammedo@redhat.com \
--cc=pbonzini@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 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.