Re: [PATCH v4 4/5] tests: test removed triggered timers are not called

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

 



Acked-by: Jonathon Jongsma <jjongsma@xxxxxxxxxx>


On Tue, 2016-01-19 at 11:54 +0000, Frediano Ziglio wrote:
> This could happen for instance if a given timer remove all clients
> which have associated timers.
> 
> Signed-off-by: Frediano Ziglio <fziglio@xxxxxxxxxx>
> ---
>  server/tests/test-loop.c | 21 +++++++++++++++++++++
>  1 file changed, 21 insertions(+)
> 
> diff --git a/server/tests/test-loop.c b/server/tests/test-loop.c
> index 1dc3923..1c2f496 100644
> --- a/server/tests/test-loop.c
> +++ b/server/tests/test-loop.c
> @@ -74,6 +74,19 @@ static void *loop_func(void *arg)
>      return NULL;
>  }
>  
> +static SpiceTimer *twice_timers[2] = { NULL, NULL };
> +static int twice_called = 0;
> +static void timer_not_twice(void *opaque)
> +{
> +    spice_assert(++twice_called == 1);
> +
> +    /* delete timers, should not have another call */
> +    core->timer_remove(twice_timers[0]);
> +    core->timer_remove(twice_timers[1]);
> +    twice_timers[0] = NULL;
> +    twice_timers[1] = NULL;
> +}
> +
>  int main(int argc, char **argv)
>  {
>      SpiceTimer *timer, *timers[10];
> @@ -107,6 +120,14 @@ int main(int argc, char **argv)
>      timer = timers[i++] = core->timer_add(timer_exit, NULL);
>      core->timer_start(timer, 10);
>  
> +    /* test events are not called when freed */
> +    timer = twice_timers[0] = core->timer_add(timer_not_twice, NULL);
> +    spice_assert(timer != NULL);
> +    core->timer_start(timer, 2);
> +    timer = twice_timers[1] = core->timer_add(timer_not_twice, NULL);
> +    spice_assert(timer != NULL);
> +    core->timer_start(timer, 2);
> +
>      /* run the loop */
>      loop = g_main_loop_new(basic_event_loop_get_context(), FALSE);
>      alarm(1);
_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/spice-devel




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