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

Zbigniew Kempczyński zbigniew.kempczynski at intel.com
Wed Apr 10 17:47:01 UTC 2024


On Thu, Apr 04, 2024 at 05:53:20PM +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.
> 
> Cc: Sai Gowtham Ch <sai.gowtham.ch at intel.com>
> Cc: Mauro Carvalho Chehab <mauro.chehab at linux.intel.com>
> Signed-off-by: Kamil Konieczny <kamil.konieczny at linux.intel.com>
> ---
>  tests/intel/xe_exec_queue_property.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/tests/intel/xe_exec_queue_property.c b/tests/intel/xe_exec_queue_property.c
> index 57baae305..21c51bae5 100644
> --- a/tests/intel/xe_exec_queue_property.c
> +++ b/tests/intel/xe_exec_queue_property.c
> @@ -234,13 +234,14 @@ igt_main
>  	igt_subtest_group {
>  		igt_fixture {
>  			sys_fd = igt_sysfs_open(xe);
> -			igt_require(sys_fd != -1);
> -			close(sys_fd);
> +			if (sys_fd != -1)
> +				close(sys_fd);

After this you have stale sys_fd. Might be error prone when next
open will return same fd as sys_fd has in this moment.

>  		}
>  
>  		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(sys_fd != -1);

If you really need to check sysfs is available, maybe add new helper
like:

	void igt_require_sysfs(int fd);

?

Anyway above construct is imo error prone and I vote to not to
merge it.

--
Zbigniew

>  					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