[PATCH v2 i-g-t] tests/intel/xe_sysfs_defaults: Validate for all default values

Kamil Konieczny kamil.konieczny at linux.intel.com
Thu Apr 11 11:49:30 UTC 2024


Hi Nakshtra,

On 2024-04-11 at 00:13:30 +0530, nakshtra.goyal at intel.com wrote:
> From: Nakshtra Goyal <nakshtra.goyal at intel.com>
> 
> Change in igt_assert_f function parameters so that it also validate for
> property value equals to 0.

I do have one nit, see below.

> 
> v2: use uint64_t for property_value,use bool __igt_sysfs_get_u64 in
> igt_assert_f(Kamil)
> 
> Cc: Himal Prasad Ghimiray <himal.prasad.ghimiray at intel.com>
> Cc: Janga Rahul Kumar <janga.rahul.kumar at intel.com>
> Cc: Priyanka Dandamudi <priyanka.dandamudi at intel.com>
> Cc: Kamil Konieczny <kamil.konieczny at intel.com>
> Signed-off-by: Nakshtra Goyal <nakshtra.goyal at intel.com>
> ---
>  tests/intel/xe_sysfs_defaults.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/tests/intel/xe_sysfs_defaults.c b/tests/intel/xe_sysfs_defaults.c
> index 4a6b3ba6d..d38a75e55 100644
> --- a/tests/intel/xe_sysfs_defaults.c
> +++ b/tests/intel/xe_sysfs_defaults.c
> @@ -28,7 +28,7 @@
>  static void test_defaults(int xe, int engine, const char **property)
>  {
>  	struct dirent *de;
> -	int property_value;
> +	uint64_t property_value;
>  	int defaults;
>  	DIR *dir;
>  
> @@ -42,7 +42,7 @@ static void test_defaults(int xe, int engine, const char **property)
>  
>  		igt_debug("Checking attr '%s'\n", de->d_name);
>  
> -		igt_assert_f(property_value = igt_sysfs_get_u64(defaults, de->d_name),
> +		igt_assert_f(__igt_sysfs_get_u64(defaults, de->d_name, &property_value),
>  			     "Default value %s is not present!\n", de->d_name);
>  
>  		igt_debug("Default property:%s, value:%d\n", de->d_name, property_value);
---------------------------------------------- ^ --------------- ^

I did give my r-b but after local recompile it gives warning
(and GitLab infra just choked on your patch so I didn't see it there):

../tests/intel/xe_sysfs_defaults.c: In function 'test_defaults':
../tests/intel/xe_sysfs_defaults.c:48:27: warning: format '%d' expects argument of type 'int', but argument 5 has type 'uint64_t' {aka 'long unsigned int'} [-Wformat=]
   48 |                 igt_debug("Default property:%s, value:%d\n", de->d_name, property_value);
      |                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~              ~~~~~~~~~~~~~~

Please fix it with v3 with:

igt_debug("Default property:%s, value:0x%" PRId64 "\n", de->d_name, property_value);

You can keep my r-b.

Regards,
Kamil

> -- 
> 2.34.1
> 


More information about the igt-dev mailing list