[igt-dev] [PATCH i-g-t] sw_sync: Use fixed runtime for sync_expired_merge

Chris Wilson chris at chris-wilson.co.uk
Thu Feb 20 16:57:21 UTC 2020


Convert from using a fixed number of iterations (1 million), to using a
fixed runtime so that we have predictable (and shorter!) run times across
a wide variety of machines.

Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
Cc: Martin Peres <martin.peres at linux.intel.com>
---
 tests/sw_sync.c | 17 +++++++----------
 1 file changed, 7 insertions(+), 10 deletions(-)

diff --git a/tests/sw_sync.c b/tests/sw_sync.c
index 626b6d39f..6e439496d 100644
--- a/tests/sw_sync.c
+++ b/tests/sw_sync.c
@@ -747,30 +747,27 @@ static void test_sync_multi_producer_single_consumer(void)
 
 static void test_sync_expired_merge(void)
 {
-	int iterations = 1 << 20;
 	int timeline;
-	int i;
-	int fence_expired, fence_merged;
+	int expired;
 
 	timeline = sw_sync_timeline_create();
 
 	sw_sync_timeline_inc(timeline, 100);
-	fence_expired = sw_sync_timeline_create_fence(timeline, 1);
-	igt_assert_f(sync_fence_wait(fence_expired, 0) == 0,
+	expired = sw_sync_timeline_create_fence(timeline, 1);
+	igt_assert_f(sync_fence_wait(expired, 0) == 0,
 	             "Failure waiting for expired fence\n");
 
-	fence_merged = sync_fence_merge(fence_expired, fence_expired);
-	close(fence_merged);
+	close(sync_fence_merge(expired, expired));
 
-	for (i = 0; i < iterations; i++) {
-		int fence = sync_fence_merge(fence_expired, fence_expired);
+	igt_until_timeout(2) {
+		int fence = sync_fence_merge(expired, expired);
 
 		igt_assert_f(sync_fence_wait(fence, -1) == 0,
 			     "Failure waiting on fence\n");
 		close(fence);
 	}
 
-	close(fence_expired);
+	close(expired);
 }
 
 static void test_sync_random_merge(void)
-- 
2.25.1



More information about the igt-dev mailing list