[igt-dev] [PATCH i-g-t] i915/gem_softpin: Limit the noreloc test runtime

Chris Wilson chris at chris-wilson.co.uk
Fri Feb 28 10:12:36 UTC 2020


Use a fixed duration rather than a fixed amount of work.

Closes: https://gitlab.freedesktop.org/drm/intel/issues/1325
Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
---
 tests/i915/gem_softpin.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tests/i915/gem_softpin.c b/tests/i915/gem_softpin.c
index 2c258f443..98c7ab63b 100644
--- a/tests/i915/gem_softpin.c
+++ b/tests/i915/gem_softpin.c
@@ -442,7 +442,7 @@ static void test_noreloc(int fd, enum sleep sleep)
 	uint64_t offset;
 	uint32_t handle;
 	uint32_t *batch, *b;
-	int i, loop;
+	int i, loop = 0;
 
 	handle = gem_create(fd, (ARRAY_SIZE(object)+1)*size);
 	gem_write(fd, handle, 0, &bbe, sizeof(bbe));
@@ -494,11 +494,11 @@ static void test_noreloc(int fd, enum sleep sleep)
 	munmap(batch, size);
 
 	execbuf.buffer_count = ARRAY_SIZE(object);
-	for (loop = 0; loop < 1024; loop++) {
+	igt_until_timeout(5) {
 		igt_permute_array(object, ARRAY_SIZE(object)-1, xchg_offset);
 		gem_execbuf(fd, &execbuf);
 
-		if ((loop & 127) == 0) {
+		if ((loop++ & 127) == 0) {
 			switch (sleep) {
 			case NOSLEEP:
 				break;
-- 
2.25.1



More information about the igt-dev mailing list