[igt-dev] [PATCH i-g-t 1/2] tests/kms_rmfb: Create dynamic subtests

Kamil Konieczny kamil.konieczny at linux.intel.com
Wed Jun 15 15:50:12 UTC 2022


Hi Mohammed,

May you also add global description to test ?

On 2022-06-15 at 16:23:32 +0530, Mohammed Thasleem wrote:
> Modified kms_rmfb to include dynamic test cases.
> 
> Signed-off-by: Mohammed Thasleem <mohammed.thasleem at intel.com>
> ---
>  tests/kms_rmfb.c | 31 ++++++++++++++++++++++---------
>  1 file changed, 22 insertions(+), 9 deletions(-)
> 
> diff --git a/tests/kms_rmfb.c b/tests/kms_rmfb.c
> index fcd5cdad..53172ded 100644
> --- a/tests/kms_rmfb.c
> +++ b/tests/kms_rmfb.c
> @@ -151,14 +151,26 @@ run_rmfb_test(struct rmfb_data *data, bool reopen)
>  	igt_output_t *output;
>  	enum pipe pipe;
>  
> -	for_each_pipe_with_single_output(&data->display, pipe, output)
> +	for_each_pipe_with_single_output(&data->display, pipe, output) {
> +		igt_dynamic_f("%s-pipe-%s", igt_output_name(output),
> +			      kmstest_pipe_name(pipe))
>  		test_rmfb(data, output, pipe, reopen);
--------------- ^

Indent this call (add tab here).

> +	}
>  }
>  
>  igt_main
>  {
> +	int i;
>  	struct rmfb_data data = {};
>  
> +	const struct {
> +		bool flags;
> +		const char *name;

Add description here:
		const char *description;

> +	} tests[] = {
> +		{ false, "rmfb-ioctl" },

And put them after names.

> +		{ true, "close-fd" },
> +	};
> +
>  	igt_fixture {
>  		data.drm_fd = drm_open_driver_master(DRIVER_ANY);
>  
> @@ -168,15 +180,16 @@ igt_main
>  		igt_display_require_output(&data.display);
>  	}
>  
> -	igt_describe("RMFB is supposed to free the framebuffers from any and all "
> -		     "planes so test this and make sure it works.");

Move this description into struct.

> -	igt_subtest_f("rmfb-ioctl")
> -		run_rmfb_test(&data, false);
> +	for (i = 0; i < ARRAY_SIZE(tests); i++) {
> +
> +		igt_describe("RMFB is supposed to free the framebuffers from any and all "

Here you can use igt_describe_f() with tests[i].description.

Regards,
Kamil

> +			     "planes so test this and make sure it works with rmfb-ioctl,"
> +			     "fd close and reopen.");
> +		igt_subtest_with_dynamic(tests[i].name) {
> +			run_rmfb_test(&data, tests[i].flags);
>  
> -	igt_describe("RMFB is supposed to free the framebuffers from any and all planes "
> -		     "so test this and make sure it works with fd close and reopen.");
> -	igt_subtest_f("close-fd")
> -		run_rmfb_test(&data, true);
> +		}
> +	}
>  
>  	igt_fixture {
>  		igt_display_fini(&data.display);
> -- 
> 2.25.1
> 


More information about the igt-dev mailing list