Re: [PATCH spice-gtk v4 26/29] test-cd-emu: Test attach/detach emulated device

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

 



> 
> Frediano Ziglio writes:
> 
> > Mock some usb-backend functions to be able to simulate device
> > attachment and detachment.
> > +
> > +    // this it's the correct sequence to free session!
> > +    // g_object_unref is not enough, causing wrong reference countings
> > +    spice_session_disconnect(session);
> > +    g_object_unref(session);
> > +    while (g_main_context_iteration(NULL, FALSE)) {
> > +        continue;
> > +    }
> 
> This looks so peculiar that it might be worth putting in its
> own function, in order to facilitate reuse.
> 

I was thinking about a DoEvents function in memory of the good old VB!
(well, do_events in C).
Getting these lines right was not really easy! Calling g_object_unref
directly causes multiple crashes. The deallocations are queued in GLib.

> > +
> > +    g_assert_cmpint(gobjects_allocated, ==, 0);
> > +}
> > +
> >  static void
> >  write_test_iso(void)
> >  {
> > @@ -87,6 +234,8 @@ int main(int argc, char* argv[])
> >
> >      g_test_add_data_func("/cd-emu/simple", GUINT_TO_POINTER(1), multiple);
> >      g_test_add_data_func("/cd-emu/multiple", GUINT_TO_POINTER(128),
> >      multiple);
> > +    g_test_add_data_func("/cd-emu/attach_no_auto", GUINT_TO_POINTER(0),
> > attach);
> > +    g_test_add_data_func("/cd-emu/attach_auto", GUINT_TO_POINTER(1),
> > attach);
> >
> >      return g_test_run();
> >  }
> 

Frediano
_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux Virtualization]     [Linux Virtualization]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]