diff mbox

[RFC] tests/gem_reset_stats: add subtest hang-render-and-<ring>

Message ID 1390907795-3491-2-git-send-email-mika.kuoppala@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Mika Kuoppala Jan. 28, 2014, 11:16 a.m. UTC
If multiple rings are hung at the same time by two different
contexts, both should get get blamed for hanging the GPU.

Signed-off-by: Mika Kuoppala <mika.kuoppala@intel.com>
---
 tests/gem_reset_stats.c |   34 ++++++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)
diff mbox

Patch

diff --git a/tests/gem_reset_stats.c b/tests/gem_reset_stats.c
index 331d954..c1bf72e 100644
--- a/tests/gem_reset_stats.c
+++ b/tests/gem_reset_stats.c
@@ -1017,6 +1017,37 @@  static void test_params(void)
 	close(fd);
 }
 
+static void test_hang_render_and(void)
+{
+	int fd[2];
+	int h[2];
+	int ctx;
+	const struct target_ring *ring = current_ring;
+
+	fd[0] = drm_open_any();
+	fd[1] = drm_open_any();
+
+	ctx = context_create(fd[0]);
+	igt_assert(ctx >= 0);
+
+	h[0] = inject_hang_ring(fd[0], ctx, I915_EXEC_RENDER);
+	h[1] = inject_hang_ring(fd[1], 0, ring->exec);
+
+	gem_sync(fd[1], h[1]);
+
+	assert_reset_status(fd[0], ctx, RS_BATCH_ACTIVE);
+	assert_reset_status(fd[1], 0, RS_BATCH_ACTIVE);
+
+	gem_close(fd[1], h[1]);
+	gem_close(fd[0], h[0]);
+
+	context_destroy(fd[0], ctx);
+
+	close(fd[1]);
+	close(fd[0]);
+}
+
+
 #define RING_HAS_CONTEXTS current_ring->contexts(current_ring)
 #define RUN_CTX_TEST(...) do { igt_skip_on(RING_HAS_CONTEXTS == false); __VA_ARGS__; } while (0)
 
@@ -1093,5 +1124,8 @@  igt_main
 			test_close_pending_fork(true);
 			test_close_pending_fork(false);
 		}
+
+		igt_subtest_f("hang-render-and-%s", name)
+			test_hang_render_and();
 	}
 }