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

Gabriel Feceoru gabriel.feceoru at intel.com
Tue May 10 13:27:38 UTC 2016


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.

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);
 	}
-- 
1.9.1



More information about the Intel-gfx mailing list