Re: [Spice-devel] [PATCH spice-server v4 06/20] test-stat: Adjust delay checks

2019-03-05 Thread Marc-André Lureau
On Wed, Feb 6, 2019 at 2:59 PM Frediano Ziglio  wrote:
>
> usleep under Windows does not seem to have the required precision.
> Use milliseconds and adjust check times according.
>
> Signed-off-by: Frediano Ziglio 

Reviewed-by: Marc-André Lureau 

> ---
>  server/tests/stat-test.c | 12 ++--
>  1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/server/tests/stat-test.c b/server/tests/stat-test.c
> index e4a83f4f..444ff7e3 100644
> --- a/server/tests/stat-test.c
> +++ b/server/tests/stat-test.c
> @@ -57,13 +57,13 @@ void TEST_NAME(void)
>
>  stat_init(, "test", CLOCK_MONOTONIC);
>  stat_start_time_init(_time, );
> -usleep(2);
> +usleep(2000);
>  stat_add(, start_time);
>
>  #ifdef RED_WORKER_STAT
>  g_assert_cmpuint(info.count, ==, 1);
>  g_assert_cmpuint(info.min, ==, info.max);
> -g_assert_cmpuint(info.min, >=, 2000);
> +g_assert_cmpuint(info.min, >=, 200);
>  g_assert_cmpuint(info.min, <, 1);
>  #endif
>
> @@ -71,17 +71,17 @@ void TEST_NAME(void)
>
>  stat_compress_init(, "test", CLOCK_MONOTONIC);
>  stat_start_time_init(_time, );
> -usleep(2);
> +usleep(2000);
>  stat_compress_add(, start_time, 100, 50);
> -usleep(1);
> +usleep(1000);
>  stat_compress_add(, start_time, 1000, 500);
>
>  #ifdef COMPRESS_STAT
>  g_assert_cmpuint(info.count, ==, 2);
>  g_assert_cmpuint(info.min, !=, info.max);
> -g_assert_cmpuint(info.min, >=, 2000);
> +g_assert_cmpuint(info.min, >=, 200);
>  g_assert_cmpuint(info.min, <, 1);
> -g_assert_cmpuint(info.total, >=, 5000);
> +g_assert_cmpuint(info.total, >=, 500);
>  g_assert_cmpuint(info.orig_size, ==, 1100);
>  g_assert_cmpuint(info.comp_size, ==, 550);
>  #endif
> --
> 2.20.1
>
> ___
> Spice-devel mailing list
> Spice-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/spice-devel



-- 
Marc-André Lureau
___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/spice-devel

Re: [Spice-devel] [PATCH spice-server v4 06/20] test-stat: Adjust delay checks

2019-03-05 Thread Frediano Ziglio
> 
> Hi
> 
> On Wed, Feb 6, 2019 at 2:59 PM Frediano Ziglio  wrote:
> >
> > usleep under Windows does not seem to have the required precision.
> > Use milliseconds and adjust check times according.
> >
> > Signed-off-by: Frediano Ziglio 
> 
> As discussed previously, g_usleep() would also be a good fit. I would
> rather use it over the whole code base.
> 

As already replied g_usleep has the same issue so it's not a good fit

Frediano

> > ---
> >  server/tests/stat-test.c | 12 ++--
> >  1 file changed, 6 insertions(+), 6 deletions(-)
> >
> > diff --git a/server/tests/stat-test.c b/server/tests/stat-test.c
> > index e4a83f4f..444ff7e3 100644
> > --- a/server/tests/stat-test.c
> > +++ b/server/tests/stat-test.c
> > @@ -57,13 +57,13 @@ void TEST_NAME(void)
> >
> >  stat_init(, "test", CLOCK_MONOTONIC);
> >  stat_start_time_init(_time, );
> > -usleep(2);
> > +usleep(2000);
> >  stat_add(, start_time);
> >
> >  #ifdef RED_WORKER_STAT
> >  g_assert_cmpuint(info.count, ==, 1);
> >  g_assert_cmpuint(info.min, ==, info.max);
> > -g_assert_cmpuint(info.min, >=, 2000);
> > +g_assert_cmpuint(info.min, >=, 200);
> >  g_assert_cmpuint(info.min, <, 1);
> >  #endif
> >
> > @@ -71,17 +71,17 @@ void TEST_NAME(void)
> >
> >  stat_compress_init(, "test", CLOCK_MONOTONIC);
> >  stat_start_time_init(_time, );
> > -usleep(2);
> > +usleep(2000);
> >  stat_compress_add(, start_time, 100, 50);
> > -usleep(1);
> > +usleep(1000);
> >  stat_compress_add(, start_time, 1000, 500);
> >
> >  #ifdef COMPRESS_STAT
> >  g_assert_cmpuint(info.count, ==, 2);
> >  g_assert_cmpuint(info.min, !=, info.max);
> > -g_assert_cmpuint(info.min, >=, 2000);
> > +g_assert_cmpuint(info.min, >=, 200);
> >  g_assert_cmpuint(info.min, <, 1);
> > -g_assert_cmpuint(info.total, >=, 5000);
> > +g_assert_cmpuint(info.total, >=, 500);
> >  g_assert_cmpuint(info.orig_size, ==, 1100);
> >  g_assert_cmpuint(info.comp_size, ==, 550);
> >  #endif
___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/spice-devel

Re: [Spice-devel] [PATCH spice-server v4 06/20] test-stat: Adjust delay checks

2019-03-04 Thread Marc-André Lureau
Hi

On Wed, Feb 6, 2019 at 2:59 PM Frediano Ziglio  wrote:
>
> usleep under Windows does not seem to have the required precision.
> Use milliseconds and adjust check times according.
>
> Signed-off-by: Frediano Ziglio 

As discussed previously, g_usleep() would also be a good fit. I would
rather use it over the whole code base.

> ---
>  server/tests/stat-test.c | 12 ++--
>  1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/server/tests/stat-test.c b/server/tests/stat-test.c
> index e4a83f4f..444ff7e3 100644
> --- a/server/tests/stat-test.c
> +++ b/server/tests/stat-test.c
> @@ -57,13 +57,13 @@ void TEST_NAME(void)
>
>  stat_init(, "test", CLOCK_MONOTONIC);
>  stat_start_time_init(_time, );
> -usleep(2);
> +usleep(2000);
>  stat_add(, start_time);
>
>  #ifdef RED_WORKER_STAT
>  g_assert_cmpuint(info.count, ==, 1);
>  g_assert_cmpuint(info.min, ==, info.max);
> -g_assert_cmpuint(info.min, >=, 2000);
> +g_assert_cmpuint(info.min, >=, 200);
>  g_assert_cmpuint(info.min, <, 1);
>  #endif
>
> @@ -71,17 +71,17 @@ void TEST_NAME(void)
>
>  stat_compress_init(, "test", CLOCK_MONOTONIC);
>  stat_start_time_init(_time, );
> -usleep(2);
> +usleep(2000);
>  stat_compress_add(, start_time, 100, 50);
> -usleep(1);
> +usleep(1000);
>  stat_compress_add(, start_time, 1000, 500);
>
>  #ifdef COMPRESS_STAT
>  g_assert_cmpuint(info.count, ==, 2);
>  g_assert_cmpuint(info.min, !=, info.max);
> -g_assert_cmpuint(info.min, >=, 2000);
> +g_assert_cmpuint(info.min, >=, 200);
>  g_assert_cmpuint(info.min, <, 1);
> -g_assert_cmpuint(info.total, >=, 5000);
> +g_assert_cmpuint(info.total, >=, 500);
>  g_assert_cmpuint(info.orig_size, ==, 1100);
>  g_assert_cmpuint(info.comp_size, ==, 550);
>  #endif
> --
> 2.20.1
>
> ___
> Spice-devel mailing list
> Spice-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/spice-devel



-- 
Marc-André Lureau
___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/spice-devel