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

Kamil Konieczny kamil.konieczny at linux.intel.com
Tue Apr 2 16:17:25 UTC 2024


Hi Peter,
On 2024-03-30 at 15:19:32 +0100, Peter Senna Tschudin wrote:
> This patch calls igt_skip() when no engines are found by
> find_first_available_engine() preventing downstream code from crashing.

I would prefer to have this change in one patch.

> 
> 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); \

If 'e' is causing problems here, maybe introduce new var 'tmpe'?
So you can start with:

        e = NULL;
  		for_each_ctx_engine(fd, ctx, tmpe) \

then use tmpe->engine and after for_each... loop you may add
igt_skip_on_f(e == NULL, "no capable engine found\n");

> -			for_each_if(gem_class_can_store_dword(fd, e->class)) { \
> +			if(gem_class_can_store_dword(fd, e->class)) { \

This looks much better, you replaced confusing macro with if()

>  				igt_assert(e); \
>  				saved = configure_hangs(fd, e, ctx->id); \
>  				break; \
> +			} else { \
> +				igt_skip("find_first_available_engine(): No engine available\n"); \

This do not solve a problem, you may have capable engine later on
as there is for_each... loop.

>  			} \
>  		e = &saved.engine; \

If using 'tmpe' this should be before 'break;' line and here
you should place igt_skip_on_f()

Regards,
Kamil

>  	} while(0)
> -- 
> 2.44.0
> 


More information about the igt-dev mailing list