[PATCH i-g-t v11 08/21] tests/sw_sync: Add subtest test_sync_merge_same

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This subtest verifies merging a fence with itself does not fail.

Signed-off-by: Robert Foss <robert.foss@xxxxxxxxxxxxx>
Reviewed-by: Eric Engestrom <eric@xxxxxxxxxxxx>
Reviewed-by: Tomeu Vizoso <tomeu.vizoso@xxxxxxxxxxxxx>
---
 tests/sw_sync.c | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

diff --git a/tests/sw_sync.c b/tests/sw_sync.c
index 7780c9e1..c0eade51 100644
--- a/tests/sw_sync.c
+++ b/tests/sw_sync.c
@@ -193,6 +193,30 @@ static void test_sync_merge(void)
 	close(timeline);
 }
 
+static void test_sync_merge_same(void)
+{
+	int in_fence[2];
+	int timeline;
+	int signaled;
+
+	timeline = sw_sync_timeline_create();
+	in_fence[0] = sw_sync_fence_create(timeline, 1);
+	in_fence[1] = sync_merge(in_fence[0], in_fence[0]);
+
+	signaled = sync_fence_count_status(in_fence[0],
+					      SW_SYNC_FENCE_STATUS_SIGNALED);
+	igt_assert_f(signaled == 0, "Fence signaled too early\n");
+
+	sw_sync_timeline_inc(timeline, 1);
+	signaled = sync_fence_count_status(in_fence[0],
+					      SW_SYNC_FENCE_STATUS_SIGNALED);
+	igt_assert_f(signaled == 1, "Fence did not signal\n");
+
+	close(in_fence[0]);
+	close(in_fence[1]);
+	close(timeline);
+}
+
 igt_main
 {
 	igt_subtest("alloc_timeline")
@@ -212,5 +236,8 @@ igt_main
 
 	igt_subtest("sync_merge")
 		test_sync_merge();
+
+	igt_subtest("sync_merge_same")
+		test_sync_merge_same();
 }
 
-- 
2.11.0

_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux