Re: [v3 01/32] Added domain start/stop/define/undefine event unit tests

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

 



Hi Eric,

On Mon, 2013-12-02 at 17:19 -0700, Eric Blake wrote:
> On 12/02/2013 09:39 AM, Cédric Bosdonnat wrote:
> > These unit tests are aiming at providing some help during the domain
> > events refactoring.
> > ---
> >  .gitignore              |   1 +
> >  tests/Makefile.am       |   7 ++
> >  tests/objecteventtest.c | 246 ++++++++++++++++++++++++++++++++++++++++++++++++
> >  3 files changed, 254 insertions(+)
> >  create mode 100644 tests/objecteventtest.c
> > 
> 
> > +
> > +struct lifecycleEventCounter {
> > +    int startEvents;
> > +    int stopEvents;
> > +    int defineEvents;
> > +    int undefineEvents;
> > +};
> 
> Style: use a typedef here, so you don't have to repeat 'struct' below.
> 
> > +
> > +static void lifecycleEventCounter_reset(struct lifecycleEventCounter* counter)
> 
> Style: return type on separate line, '*' hugs the variable name, not the
> type name.
> 
> static void
> lifecycleEventCounter_reset(lifecycleEventCounter *counter)
> 
> > +static int domainLifecycleCb(virConnectPtr conn ATTRIBUTE_UNUSED,
> > +                             virDomainPtr dom ATTRIBUTE_UNUSED,
> > +                             int event,
> > +                             int detail ATTRIBUTE_UNUSED,
> > +                             void *opaque)
> > +{
> > +    struct lifecycleEventCounter *counter = opaque;
> > +
> > +    switch (event) {
> > +        case VIR_DOMAIN_EVENT_STARTED:
> > +            counter->startEvents++;
> > +            break;
> > +        case VIR_DOMAIN_EVENT_STOPPED:
> > +            counter->stopEvents++;
> > +            break;
> > +        case VIR_DOMAIN_EVENT_DEFINED:
> > +            counter->defineEvents++;
> > +            break;
> > +        case VIR_DOMAIN_EVENT_UNDEFINED:
> > +            counter->undefineEvents++;
> > +            break;
> > +        default:
> > +            /* Ignore other events */
> 
> Should we at least count the number of other events?

I fixed those on a local repository. Waiting for other comments on other
patches to resend the whole thing: 2 patches changed among the 32. In
the meantime, I pushed it all to my github clone:
https://github.com/cbosdo/libvirt/commit/ca88cf14109f8f6ca3506c3f21eb09152f3c1c12

For the ignored events I counted them in an unexpectedEvents member and
check for that to stay 0.

--
Cedric

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list





[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]