On Tue, 10 May 2016, Gabriel Feceoru <gabriel.fece...@intel.com> wrote:
> Comparing 2 numbers with 1% accuracy depends on which one is the
> reference. If count == 100 and expected == 99 this condition fails,
> although it should pass.

Well, the expectation should be the reference. If you expect 50 at 50%
tolerance, 25..75 is okay. 100 is clearly out of tolerance, but your
method would accept it too.

Would it help to round the lower limit down and upper limit up? I think
that would be more acceptable.

BR,
Jani.

> Signed-off-by: Gabriel Feceoru <gabriel.fece...@intel.com>
> ---
>  tests/kms_flip.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/tests/kms_flip.c b/tests/kms_flip.c
> index eda2fcc..938b32d 100644
> --- a/tests/kms_flip.c
> +++ b/tests/kms_flip.c
> @@ -1187,7 +1187,8 @@ static void check_final_state(struct test_output *o, 
> struct event_state *es,
>  
>               count *= o->seq_step;
>               expected = elapsed / frame_time(o);
> -             igt_assert_f(count >= expected * 99/100 && count <= expected * 
> 101/100,
> +             igt_assert_f((count >= expected * 99/100 && count <= expected * 
> 101/100) ||
> +                          (expected >= count * 99/100 && expected <= count * 
> 101/100),
>                            "dropped frames, expected %d, counted %d, encoder 
> type %d\n",
>                            expected, count, o->kencoder[0]->encoder_type);
>       }

-- 
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

Reply via email to