Re: [PATCH v2] Input: tests: add test to cover all input_grab_device() function

From: Javier Martinez Canillas
Date: Thu May 18 2023 - 09:39:55 EST


Dana Elfassy <delfassy@xxxxxxxxxx> writes:

Hello Dana,

> Currently input_grab_device() isn't covered by any tests
> Thus, adding a test to cover the cases:
> 1. The device is grabbed successfully
> 2. Trying to grab a device that is already grabbed by another input
> handle
>
> Signed-off-by: Dana Elfassy <dangel101@xxxxxxxxx>
> Tested-by: Javier Martinez Canillas <javierm@xxxxxxxxxx>
> Reviewed-by: Javier Martinez Canillas <javierm@xxxxxxxxxx>
> ---

[...]

> +
> + handle.dev = input_get_device(input_dev);
> + handle.name = dev_name(&input_dev->dev);
> + handle.handler = &handler;
> + res = input_grab_device(&handle);

Another thing I noticed is that your test will try to grab the same
input_handle twice. So you need to remove the line above I believe.

> + KUNIT_ASSERT_TRUE(test, input_grab_device(&handle));
> +

--
Best regards,

Javier Martinez Canillas
Core Platforms
Red Hat