[i-g-t,3/4] i915/gem_exec_capture: Dynamise per-engine tests
diff mbox series

Message ID 20200330092117.810776-3-chris@chris-wilson.co.uk
State New
Headers show
Series
  • [i-g-t,1/4] i915/gem_bad_reloc: Reduce negative testing
Related show

Commit Message

Chris Wilson March 30, 2020, 9:21 a.m. UTC
Convert the per-engine tests into a dynamic subtest.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---
 tests/i915/gem_exec_capture.c | 20 ++++++++------------
 1 file changed, 8 insertions(+), 12 deletions(-)

Patch
diff mbox series

diff --git a/tests/i915/gem_exec_capture.c b/tests/i915/gem_exec_capture.c
index fe2c4bd12..bc13d8632 100644
--- a/tests/i915/gem_exec_capture.c
+++ b/tests/i915/gem_exec_capture.c
@@ -524,9 +524,14 @@  static size_t safer_strlen(const char *s)
 	return s ? strlen(s) : 0;
 }
 
+#define test_each_engine(T, i915, e) \
+	igt_subtest_with_dynamic(T) __for_each_physical_engine(i915, e) \
+		for_each_if(gem_class_can_store_dword(i915, (e)->class)) \
+			igt_dynamic_f("%s", (e)->name)
+
 igt_main
 {
-	const struct intel_execution_engine *e;
+	const struct intel_execution_engine2 *e;
 	igt_hang_t hang;
 	int fd = -1;
 	int dir = -1;
@@ -550,17 +555,8 @@  igt_main
 		igt_require(safer_strlen(igt_sysfs_get(dir, "error")) > 0);
 	}
 
-	for (e = intel_execution_engines; e->name; e++) {
-		/* default exec-id is purely symbolic */
-		if (e->exec_id == 0)
-			continue;
-
-		igt_subtest_f("capture-%s", e->name) {
-			igt_require(gem_ring_has_physical_engine(fd, eb_ring(e)));
-			igt_require(gem_can_store_dword(fd, eb_ring(e)));
-			capture(fd, dir, eb_ring(e));
-		}
-	}
+	test_each_engine("capture", fd, e)
+		capture(fd, dir, e->flags);
 
 	igt_subtest_f("many-4K-zero") {
 		igt_require(gem_can_store_dword(fd, 0));