[PATCH 05/12] event-loop-test: Add some more assertions and work around a FreeBSD bug

Pekka Paalanen ppaalanen at gmail.com
Fri Feb 15 07:20:41 PST 2013


On Fri, 15 Feb 2013 09:48:35 -0500
Dima Ryazanov <dima at gmail.com> wrote:

> On Fri, Feb 15, 2013 at 7:56 AM, Philip Withnall <philip at tecnocode.co.uk>wrote:
> 
> > There’s a bug in FreeBSD’s handling of timer events which means we have to
> > be more relaxed about how we check when timer events have happened because
> > FreeBSD can’t manage enough precision on scheduling the events.
> >
> > Signed-off-by: Philip Withnall <philip at tecnocode.co.uk>
> > ---
> >  tests/event-loop-test.c | 22 ++++++++++++++++------
> >  1 file changed, 16 insertions(+), 6 deletions(-)
> >
> > diff --git a/tests/event-loop-test.c b/tests/event-loop-test.c
> > index c46d3b0..cf9dabe 100644
> > --- a/tests/event-loop-test.c
> > +++ b/tests/event-loop-test.c
> > @@ -155,10 +155,11 @@ TEST(event_loop_signal)
> >
> >         source = wl_event_loop_add_signal(loop, SIGUSR1,
> >                                           signal_callback, &got_it);
> > -       wl_event_loop_dispatch(loop, 0);
> > +       assert(source);
> > +       assert(wl_event_loop_dispatch(loop, 0) == 0);
> >
> 
> You shouldn't put code with side effects inside asserts, since it'll be
> compiled out in release mode.

That's actually standard procedure in the test suite. The test suite
refuses to work at all, if you compile asserts away. We rely on them
here, but you are right in general.


Thanks,
pq


More information about the wayland-devel mailing list