diff mbox

[i-g-t,v9,05/21] tests/sw_sync: Add subtest test_alloc_merge_fence

Message ID 20161122132839.26250-6-robert.foss@collabora.com (mailing list archive)
State New, archived
Headers show

Commit Message

Robert Foss Nov. 22, 2016, 1:28 p.m. UTC
From: Robert Foss <robert.foss@collabora.com>

This subtest verifies that merging two fences works in the simples possible
case.

Signed-off-by: Robert Foss <robert.foss@collabora.com>
Reviewed-by: Eric Engestrom <eric@engestrom.ch>
---
 tests/sw_sync.c | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)
diff mbox

Patch

diff --git a/tests/sw_sync.c b/tests/sw_sync.c
index f9d4fe9..03bc0b3 100644
--- a/tests/sw_sync.c
+++ b/tests/sw_sync.c
@@ -63,6 +63,26 @@  static void test_alloc_fence_invalid_timeline(void)
 	igt_assert(__sw_sync_fence_create(-1, 0) < 0);
 }
 
+static void test_alloc_merge_fence(void)
+{
+	int in_fence[2];
+	int fence_merge;
+	int timeline[2];
+
+	timeline[0] = sw_sync_timeline_create();
+	timeline[1] = sw_sync_timeline_create();
+
+	in_fence[0] = sw_sync_fence_create(timeline[0], 1);
+	in_fence[1] = sw_sync_fence_create(timeline[1], 1);
+	fence_merge = sync_merge(in_fence[1], in_fence[0]);
+
+	close(in_fence[0]);
+	close(in_fence[1]);
+	close(fence_merge);
+	close(timeline[0]);
+	close(timeline[1]);
+}
+
 igt_main
 {
 	igt_subtest("alloc_timeline")
@@ -73,5 +93,8 @@  igt_main
 
 	igt_subtest("alloc_fence_invalid_timeline")
 		test_alloc_fence_invalid_timeline();
+
+	igt_subtest("alloc_merge_fence")
+		test_alloc_merge_fence();
 }