All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Modem, Bhanuprakash" <bhanuprakash.modem@intel.com>
To: Mohammed Thasleem <mohammed.thasleem@intel.com>,
	<igt-dev@lists.freedesktop.org>
Cc: nidhi1.gupta@intel.com
Subject: Re: [igt-dev] [PATCH v2 1/2] tests/kms_lease: Create dynamic subtests
Date: Mon, 18 Jul 2022 10:52:19 +0530	[thread overview]
Message-ID: <6a786eab-dadc-e97d-093f-bcdee44a765e@intel.com> (raw)
In-Reply-To: <20220717195554.162231-2-mohammed.thasleem@intel.com>

On Mon-18-07-2022 01:25 am, Mohammed Thasleem wrote:
> Modified tests/kms_lease to include dynamic test cases.
> 
> Signed-off-by: Mohammed Thasleem <mohammed.thasleem@intel.com>
> ---
>   tests/kms_lease.c | 107 +++++++++++++++++++++++++++++-----------------
>   1 file changed, 67 insertions(+), 40 deletions(-)
> 
> diff --git a/tests/kms_lease.c b/tests/kms_lease.c
> index 0bf102a6..4f614e4e 100644
> --- a/tests/kms_lease.c
> +++ b/tests/kms_lease.c
> @@ -47,6 +47,8 @@
>   
>   IGT_TEST_DESCRIPTION("Test of CreateLease.");
>   
> +unsigned int valid_tests;
> +
>   typedef struct {
>   	int fd;
>   	uint32_t lessee_id;
> @@ -809,39 +811,31 @@ static void lease_invalid_plane(data_t *data)
>   }
>   
>   
> -static void run_test(data_t *data, void (*testfunc)(data_t *))
> +static void run_test(data_t *data, void (*testfunc)(data_t *), enum pipe p, igt_output_t *output)
>   {
>   	lease_t *master = &data->master;
>   	igt_display_t *display = &master->display;
> -	igt_output_t *output;
> -	enum pipe p;
> -	unsigned int valid_tests = 0;
> -
> -	for_each_pipe_with_valid_output(display, p, output) {
> -		igt_info("Beginning %s on pipe %s, connector %s\n",
> -			 igt_subtest_name(),
> -			 kmstest_pipe_name(p),
> -			 igt_output_name(output));
> -
> -		data->pipe = p;
> -		data->crtc_id = pipe_to_crtc_id(display, p);
> -		data->connector_id = output->id;
> -		data->plane_id =
> -			igt_pipe_get_plane_type(&data->master.display.pipes[data->pipe],
> -						DRM_PLANE_TYPE_PRIMARY)->drm_plane->plane_id;
>   
> -		testfunc(data);
> +	igt_info("Beginning %s on pipe %s, connector %s\n",
> +		 igt_subtest_name(),
> +		 kmstest_pipe_name(p),
> +		 igt_output_name(output));

Please drop this print, dynamic subtest will take care of this:

Example:
Starting subtest: empty_lease
Starting dynamic subtest: HDMI-A-1-pipe-A

>   
> -		igt_info("\n%s on pipe %s, connector %s: PASSED\n\n",
> -			 igt_subtest_name(),
> -			 kmstest_pipe_name(p),
> -			 igt_output_name(output));
> +	data->pipe = p;
> +	data->crtc_id = pipe_to_crtc_id(display, p);
> +	data->connector_id = output->id;
> +	data->plane_id =
> +		igt_pipe_get_plane_type(&data->master.display.pipes[data->pipe],
> +					DRM_PLANE_TYPE_PRIMARY)->drm_plane->plane_id;
>   
> -		valid_tests++;
> -	}
> +	testfunc(data);
>   
> -	igt_require_f(valid_tests,
> -		      "no valid crtc/connector combinations found\n");
> +	igt_info("\n%s on pipe %s, connector %s: PASSED\n\n",
> +		 igt_subtest_name(),
> +		 kmstest_pipe_name(p),
> +		 igt_output_name(output));

Same here.

Example:
Dynamic subtest HDMI-A-1-pipe-A: SUCCESS (0.001s)

> +
> +	valid_tests++;
>   }
>   
>   #define assert_double_id_err(ret) \
> @@ -1218,6 +1212,8 @@ static void lease_uevent(data_t *data)
>   igt_main
>   {
>   	data_t data;
> +	igt_output_t *output;
> +	enum pipe p;
>   	const struct {
>   		const char *name;
>   		void (*func)(data_t *);
> @@ -1255,36 +1251,67 @@ igt_main
>   	for (f = funcs; f->name; f++) {
>   
>   		igt_describe(f->desc);
> -		igt_subtest_f("%s", f->name) {
> -			run_test(&data, f->func);
> +		igt_subtest_with_dynamic_f("%s", f->name) {
> +			for_each_pipe_with_valid_output(&data.master.display, p, output) {
> +				igt_dynamic_f("%s-pipe-%s", igt_output_name(output),
> +					      kmstest_pipe_name(p)) {

Please update the dynamic subtest name as <pipe>-<output>

> +					run_test(&data, f->func, p, output);
> +				}
> +			}
> +			igt_require_f(valid_tests,
> +					"no valid crtc/connector combinations found\n");

This is not required. IGT will throw SKIP automatically if 
igt_dynamic(_f) is not executed.

>   		}
>   	}
>   
>   	igt_describe("Tests error handling while creating invalid corner-cases for "
>   		     "create-lease ioctl");
> -	igt_subtest("invalid-create-leases")
> -		invalid_create_leases(&data);
> +	igt_subtest_with_dynamic_f("invalid-create-leases") {
> +		for_each_pipe_with_valid_output(&data.master.display, p, output) {
> +			igt_dynamic_f("%s-pipe-%s", igt_output_name(output), kmstest_pipe_name(p))
> +				invalid_create_leases(&data);

There's an easy thumb rule to follow: If you're looping over all 
output/pipe combinations, and you're not even passing the output and 
pipe to the test, you're just repeating the same operation n times.

- Bhanu

> +		}
> +	}
>   
>   	igt_describe("Tests that  possible_crtcs logically match between master and "
>   		     "lease, and that the values are correctly renumbered on the lease side.");
> -	igt_subtest("possible-crtcs-filtering")
> -		possible_crtcs_filtering(&data);
> +	igt_subtest_with_dynamic_f("possible-crtcs-filtering") {
> +		for_each_pipe_with_valid_output(&data.master.display, p, output) {
> +			igt_dynamic_f("%s-pipe-%s", igt_output_name(output), kmstest_pipe_name(p))
> +				possible_crtcs_filtering(&data);
> +		}
> +	}
>   
>   	igt_describe("Tests the drop/set_master interactions.");
> -	igt_subtest("master-vs-lease")
> -		master_vs_lease(&data);
> +	igt_subtest_with_dynamic_f("master-vs-lease") {
> +		for_each_pipe_with_valid_output(&data.master.display, p, output) {
> +			igt_dynamic_f("%s-pipe-%s", igt_output_name(output), kmstest_pipe_name(p))
> +				master_vs_lease(&data);
> +		}
> +	}
>   
>   	igt_describe("Tests that the 2nd master can only create leases while being active "
>   		     "master, and that leases on the first master don't prevent lease creation "
>   		     "for the 2nd master.");
> -	igt_subtest("multimaster-lease")
> -		multimaster_lease(&data);
> +	igt_subtest_with_dynamic_f("multimaster-lease") {
> +		for_each_pipe_with_valid_output(&data.master.display, p, output) {
> +			igt_dynamic_f("%s-pipe-%s", igt_output_name(output), kmstest_pipe_name(p))
> +				multimaster_lease(&data);
> +		}
> +	}
>   
>   	igt_describe("Tests the implicitly added planes.");
> -	igt_subtest("implicit-plane-lease")
> -		implicit_plane_lease(&data);
> +	igt_subtest_with_dynamic_f("implicit-plane-lease") {
> +		for_each_pipe_with_valid_output(&data.master.display, p, output) {
> +			igt_dynamic_f("%s-pipe-%s", igt_output_name(output), kmstest_pipe_name(p))
> +				implicit_plane_lease(&data);
> +		}
> +	}
>   
>   	igt_describe("Tests all the uevent cases");
> -	igt_subtest("lease-uevent")
> -		lease_uevent(&data);
> +	igt_subtest_with_dynamic_f("lease-uevent") {
> +		for_each_pipe_with_valid_output(&data.master.display, p, output) {
> +			igt_dynamic_f("%s-pipe-%s", igt_output_name(output), kmstest_pipe_name(p))
> +				lease_uevent(&data);
> +		}
> +	}
>   }

  reply	other threads:[~2022-07-18  5:22 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-17 19:55 [igt-dev] [PATCH v2 0/2] tests/kms_lease: IGT test Cleanup Mohammed Thasleem
2022-07-17 19:55 ` [igt-dev] [PATCH v2 1/2] tests/kms_lease: Create dynamic subtests Mohammed Thasleem
2022-07-18  5:22   ` Modem, Bhanuprakash [this message]
2022-07-17 19:55 ` [igt-dev] [PATCH v2 2/2] tests/kms_lease: Test Cleanup Mohammed Thasleem
2022-07-17 20:46 ` [igt-dev] ✗ Fi.CI.BAT: failure for tests/kms_lease: IGT test Cleanup (rev2) Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6a786eab-dadc-e97d-093f-bcdee44a765e@intel.com \
    --to=bhanuprakash.modem@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=mohammed.thasleem@intel.com \
    --cc=nidhi1.gupta@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.