[Intel-gfx] [PATCH i-g-t] tests/kms_flip: Adjust tolerance when counting frames

Daniel Vetter daniel at ffwll.ch
Tue May 17 07:30:59 UTC 2016


On Tue, May 10, 2016 at 05:15:37PM +0300, Gabriel Feceoru wrote:
> 
> 
> On 10.05.2016 16:52, Jani Nikula wrote:
> >On Tue, 10 May 2016, Gabriel Feceoru <gabriel.feceoru at 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.
> 
> Yes, you are right. I'll adjust it to 98/100 and 102/100.

Maybe also extract the computation for lower/upper limit into local
variables, to make the code less dense and easier to understand.
-Daniel

> 
> Thanks,
> Gabriel.
> 
> >
> >BR,
> >Jani.
> >
> >>Signed-off-by: Gabriel Feceoru <gabriel.feceoru at 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);
> >>  	}
> >

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch


More information about the Intel-gfx mailing list