
On Tue, Dec 03, 2013 at 12:44:45PM +0100, Cedric Bosdonnat wrote:
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/ca88cf14109f8f6ca3506c3f21eb09152f3...
ACK to that updated patch. Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|