[Piglit] [PATCH] ext_timer_query/time-elapsed: Prevent infinite loop.

jfonseca at vmware.com jfonseca at vmware.com
Thu Apr 3 07:20:41 PDT 2014


From: José Fonseca <jfonseca at vmware.com>

When testing with llvmpipe, somehow the draw() function is returning
constant elapsed time of 0.000222 approximately, regardless how big
iters is.

This is probably a bug in llvmpipe, but it seems a good idea to fix the
test to prevent integer overflow and the consequent infinite loop in the
test regardless.
---
 tests/spec/ext_timer_query/time-elapsed.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/tests/spec/ext_timer_query/time-elapsed.c b/tests/spec/ext_timer_query/time-elapsed.c
index e0da672..64c2d67 100644
--- a/tests/spec/ext_timer_query/time-elapsed.c
+++ b/tests/spec/ext_timer_query/time-elapsed.c
@@ -213,6 +213,10 @@ retry:
 	for (iters = 1; ; iters *= 2) {
 		if (draw(q, iters) > 0.1)
 			break;
+		if (iters * 2 <= iters) {
+			printf("Couldn't find appropriate number of iterations\n");
+			piglit_report_result(PIGLIT_FAIL);
+		}
 	}
 
 	/* Now, do several runs like this so we can determine if the
-- 
1.8.3.2



More information about the Piglit mailing list