[Intel-gfx] [PATCH i-g-t v3 08/13] tests/sw_sync: Add subtest test_sync_merge_same
robert.foss at collabora.com
robert.foss at collabora.com
Tue Sep 13 18:22:53 UTC 2016
From: Robert Foss <robert.foss at collabora.com>
This subtest verifies merging a fence with itself does not fail.
Signed-off-by: Robert Foss <robert.foss at collabora.com>
Reviewed-by: Eric Engestrom <eric at engestrom.ch>
---
tests/sw_sync.c | 37 ++++++++++++++++++++++++++++++++-----
1 file changed, 32 insertions(+), 5 deletions(-)
diff --git a/tests/sw_sync.c b/tests/sw_sync.c
index 8776f42..2872bff 100644
--- a/tests/sw_sync.c
+++ b/tests/sw_sync.c
@@ -173,11 +173,35 @@ static void test_sync_merge(void)
igt_assert_f(active == 0 && signaled == 1,
"fence_merge did not signal\n");
- sw_sync_fence_destroy(in_fence[0]);
- sw_sync_fence_destroy(in_fence[1]);
- sw_sync_fence_destroy(in_fence[2]);
- sw_sync_fence_destroy(fence_merge);
- sw_sync_timeline_destroy(timeline);
+ close(in_fence[0]);
+ close(in_fence[1]);
+ close(in_fence[2]);
+ close(fence_merge);
+ 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] = sw_sync_merge(in_fence[0], in_fence[0]);
+
+ signaled = sw_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 = sw_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
@@ -199,5 +223,8 @@ igt_main
igt_subtest("sync_merge")
test_sync_merge();
+
+ igt_subtest("sync_merge_same")
+ test_sync_merge_same();
}
--
2.9.3
More information about the Intel-gfx
mailing list