[PATCH i-g-t] tests/intel/xe_exec_queue_property: move skip into subtest

Zbigniew Kempczyński zbigniew.kempczynski at intel.com
Fri Apr 26 16:40:30 UTC 2024


On Thu, Apr 25, 2024 at 04:39:46PM +0200, Kamil Konieczny wrote:
> Skips in fixture are safe to use just after begin of igt_main()
> when they be working for all subtests. Later on, when used in
> fixture they can mislead developers reading logs, so move one
> into respective subtest.
> 
> v2: use bool var instead of fd (Zbigniew)
> 
> Cc: Sai Gowtham Ch <sai.gowtham.ch at intel.com>
> Cc: Mauro Carvalho Chehab <mauro.chehab at linux.intel.com>
> Cc: "Zbigniew Kempczyński" <zbigniew.kempczynski at intel.com>
> Signed-off-by: Kamil Konieczny <kamil.konieczny at linux.intel.com>
> ---
>  tests/intel/xe_exec_queue_property.c | 14 ++++++++++----
>  1 file changed, 10 insertions(+), 4 deletions(-)
> 
> diff --git a/tests/intel/xe_exec_queue_property.c b/tests/intel/xe_exec_queue_property.c
> index 57baae305..c3a3751cb 100644
> --- a/tests/intel/xe_exec_queue_property.c
> +++ b/tests/intel/xe_exec_queue_property.c
> @@ -203,7 +203,7 @@ igt_main
>  	const char *property[][3] = { {"timeslice_duration_us", "timeslice_duration_min", "timeslice_duration_max"},
>  	};
>  	int count = sizeof(property) / sizeof(property[0]);
> -	int sys_fd;
> +	bool has_sysfs;
>  	int xe;
>  	int gt;
>  
> @@ -233,14 +233,20 @@ igt_main
>  
>  	igt_subtest_group {
>  		igt_fixture {
> -			sys_fd = igt_sysfs_open(xe);
> -			igt_require(sys_fd != -1);
> -			close(sys_fd);
> +			int sys_fd = igt_sysfs_open(xe);
> +
> +			if (sys_fd != -1) {
> +				close(sys_fd);
> +				has_sysfs = true;
> +			} else {
> +				has_sysfs = false;
> +			}

Ok, you stop exposing stale fd outside, lgtm:

Reviewed-by: Zbigniew Kempczyński <zbigniew.kempczynski at intel.com>

--
Zbigniew

>  		}
>  
>  		for (int i = 0; i < count; i++) {
>  			for (typeof(*tests) *t = tests; t->name; t++) {
>  				igt_subtest_with_dynamic_f("%s-%s", property[i][0], t->name) {
> +					igt_require(has_sysfs);
>  					xe_for_each_gt(xe, gt) {
>  						int engines_fd = -1;
>  						int gt_fd = -1;
> -- 
> 2.42.0
> 


More information about the igt-dev mailing list