[igt-dev] [i-g-t, 2/2] tests/amdgpu: Fix typo in amd_module_load

Petri Latvala petri.latvala at intel.com
Tue Jun 15 08:20:05 UTC 2021


On Mon, Jun 14, 2021 at 11:35:57AM -0400, Anson Jacob wrote:
> From: Victor Lu <victorchengchi.lu at amd.com>
> 
> A typo in amd_module_load was causing the test to fail.
> igt_assert_f(err, 0) should have been igt_assert_eq(err, 0),
> to check err == 0. Also added drm_fd >= 0 check and made
> ioctl query more explicit.
> 
> Signed-off-by: Victor Lu <victorchengchi.lu at amd.com>
> Acked-by: Anson Jacob <Anson.Jacob at amd.com>
> ---
>  tests/amdgpu/amd_module_load.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/tests/amdgpu/amd_module_load.c b/tests/amdgpu/amd_module_load.c
> index e682d2c5..8762b2a2 100644
> --- a/tests/amdgpu/amd_module_load.c
> +++ b/tests/amdgpu/amd_module_load.c
> @@ -41,8 +41,10 @@ sanity_check(void)
>  	args.return_pointer = (uintptr_t) &arg_ret;
>  	args.return_size = sizeof(int);
>  	args.query = AMDGPU_INFO_HW_IP_INFO;
> +	args.query_hw_ip.type = AMDGPU_HW_IP_COMPUTE;
>  
>  	fd = drm_open_driver(DRIVER_AMDGPU);
> +	igt_assert_f(fd >= 0, "Module failed to load\n");

drm_open_driver() already asserts that it's able to give you a proper
fd.


-- 
Petri Latvala


>  	igt_set_timeout(1, "Module reload timeout!");
>  
>  	if (ioctl(fd, DRM_IOCTL_AMDGPU_INFO, &args) < 0)
> @@ -51,7 +53,7 @@ sanity_check(void)
>  	igt_set_timeout(0, NULL);
>  	close(fd);
>  
> -	igt_assert_f(err, 0);
> +	igt_assert_eq(err, 0);
>  }
>  
>  igt_main


More information about the igt-dev mailing list