linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Dana Elfassy <delfassy@redhat.com>
Cc: eballetb@redhat.com, javierm@redhat.com,
	linux-input@vger.kernel.org, linux-kernel@vger.kernel.org,
	Dana Elfassy <dangel101@gmail.com>
Subject: Re: [PATCH v2] Input: tests: add test to cover all input_grab_device() function
Date: Wed, 17 May 2023 10:06:40 -0700	[thread overview]
Message-ID: <ZGUJoClUZpL71Jw4@google.com> (raw)
In-Reply-To: <20230517153145.513095-1-dangel101@gmail.com>

Hi Dana,

On Wed, May 17, 2023 at 06:31:45PM +0300, Dana Elfassy wrote:
> 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@gmail.com>
> Tested-by: Javier Martinez Canillas <javierm@redhat.com>
> Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
> ---
> 
> Changes in v2:
> - Use input_put_device() to decrement the refcount increased by get().
> - Remove unnecessary struct input_handle test_handle variable.

So this tests something different than what patch description states.
You are testing that there is no "recursive" grabbing happening (an API
could be designed to allow the same handle grab device several times).
This is a good and useful test, but you do want to also use 2nd separate
handle to see that it gets -EBUSY as well. And ideally we should have
another test verifying that the 2nd handle can successfully grab the
device once the first handle releases it.

Thanks.

-- 
Dmitry

  reply	other threads:[~2023-05-17 17:06 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-17 15:31 [PATCH v2] Input: tests: add test to cover all input_grab_device() function Dana Elfassy
2023-05-17 17:06 ` Dmitry Torokhov [this message]
2023-05-17 17:24   ` Javier Martinez Canillas
2023-05-18 13:38 ` Javier Martinez Canillas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZGUJoClUZpL71Jw4@google.com \
    --to=dmitry.torokhov@gmail.com \
    --cc=dangel101@gmail.com \
    --cc=delfassy@redhat.com \
    --cc=eballetb@redhat.com \
    --cc=javierm@redhat.com \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).