[PATCH i-g-t v6 2/2] Skip the test when no engines are found

Peter Senna Tschudin me at petersenna.com
Sat Mar 30 14:19:32 UTC 2024


This patch calls igt_skip() when no engines are found by
find_first_available_engine() preventing downstream code from crashing.

Signed-off-by: Peter Senna Tschudin <me at petersenna.com>
---
 tests/intel/gem_exec_capture.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/tests/intel/gem_exec_capture.c b/tests/intel/gem_exec_capture.c
index a8348f21b..2afb84283 100644
--- a/tests/intel/gem_exec_capture.c
+++ b/tests/intel/gem_exec_capture.c
@@ -665,10 +665,12 @@ static bool needs_recoverable_ctx(int fd)
 		ctx = intel_ctx_create_all_physical(fd); \
 		igt_assert(ctx); \
 		for_each_ctx_engine(fd, ctx, e) \
-			for_each_if(gem_class_can_store_dword(fd, e->class)) { \
+			if(gem_class_can_store_dword(fd, e->class)) { \
 				igt_assert(e); \
 				saved = configure_hangs(fd, e, ctx->id); \
 				break; \
+			} else { \
+				igt_skip("find_first_available_engine(): No engine available\n"); \
 			} \
 		e = &saved.engine; \
 	} while(0)
-- 
2.44.0



More information about the igt-dev mailing list