diff mbox series

[i-g-t] i915/gem_ctx_persistence: Sanitycheck execbuf state harder for 'queued'

Message ID 20191030235934.4705-1-chris@chris-wilson.co.uk (mailing list archive)
State New, archived
Headers show
Series [i-g-t] i915/gem_ctx_persistence: Sanitycheck execbuf state harder for 'queued' | expand

Commit Message

Chris Wilson Oct. 30, 2019, 11:59 p.m. UTC
And initialise fence to -1 to avoid closing stdin (fd:0)!

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---
 tests/i915/gem_ctx_persistence.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)
diff mbox series

Patch

diff --git a/tests/i915/gem_ctx_persistence.c b/tests/i915/gem_ctx_persistence.c
index 9273da159..fa6ee7516 100644
--- a/tests/i915/gem_ctx_persistence.c
+++ b/tests/i915/gem_ctx_persistence.c
@@ -363,10 +363,10 @@  static void test_nonpersistent_file(int i915)
 
 static void test_nonpersistent_queued(int i915, unsigned int engine)
 {
-	int count = gem_measure_ring_inflight(i915, engine, 0);
+	const int count = gem_measure_ring_inflight(i915, engine, 0);
 	igt_spin_t *spin;
+	int fence = -1;
 	uint32_t ctx;
-	int fence;
 
 	/*
 	 * Not only must the immediate batch be cancelled, but
@@ -383,10 +383,13 @@  static void test_nonpersistent_queued(int i915, unsigned int engine)
 			    .flags = IGT_SPIN_FENCE_OUT);
 
 	for (int i = 0; i < count - 1; i++) {
+		spin->execbuf.rsvd2 = 0;
 		if (fence != -1)
 			close(fence);
-		spin->execbuf.rsvd2 = 0;
+
+		igt_assert(spin->execbuf.flags & I915_EXEC_FENCE_OUT);
 		gem_execbuf_wr(i915, &spin->execbuf);
+
 		igt_assert(spin->execbuf.rsvd2);
 		fence = spin->execbuf.rsvd2 >> 32;
 	}
@@ -396,8 +399,7 @@  static void test_nonpersistent_queued(int i915, unsigned int engine)
 	igt_assert_eq(sync_fence_wait(fence, MSEC_PER_SEC / 5), 0);
 	igt_assert_eq(sync_fence_status(fence), -EIO);
 
-	spin->handle = 0;
-	igt_spin_free(-1, spin);
+	igt_spin_free(i915, spin);
 }
 
 static void sendfd(int socket, int fd)