All of lore.kernel.org
 help / color / mirror / Atom feed
From: Elizabeth Figura <zfigura@codeweavers.com>
To: Dan Carpenter <dan.carpenter@linaro.org>
Cc: Su Hui <suhui@nfschina.com>,
	shuah@kernel.org, wine-devel@winehq.org,
	linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org,
	kernel-janitors@vger.kernel.org
Subject: Re: [PATCH 1/4] selftests: ntsync: fix the wrong condition in wake_all
Date: Sat, 15 Mar 2025 15:29:43 -0500	[thread overview]
Message-ID: <1961744.6tgchFWduM@camazotz> (raw)
In-Reply-To: <f86c7af5-9e7f-41a0-a357-6a356fdeb0b9@stanley.mountain>

On Saturday, 15 March 2025 04:39:46 CDT Dan Carpenter wrote:
> On Fri, Mar 14, 2025 at 05:13:50PM -0500, Elizabeth Figura wrote:
> > On Friday, 14 March 2025 05:14:30 CDT Su Hui wrote:
> > > On 2025/3/14 17:21, Dan Carpenter wrote:
> > > > On Fri, Mar 14, 2025 at 03:14:51PM +0800, Su Hui wrote:
> > > >> When  'manual=false' and  'signaled=true', then expected value when using
> > > >> NTSYNC_IOC_CREATE_EVENT should be greater than zero. Fix this typo error.
> > > >>
> > > >> Signed-off-by: Su Hui<suhui@nfschina.com>
> > > >> ---
> > > >>   tools/testing/selftests/drivers/ntsync/ntsync.c | 2 +-
> > > >>   1 file changed, 1 insertion(+), 1 deletion(-)
> > > >>
> > > >> diff --git a/tools/testing/selftests/drivers/ntsync/ntsync.c b/tools/testing/selftests/drivers/ntsync/ntsync.c
> > > >> index 3aad311574c4..bfb6fad653d0 100644
> > > >> --- a/tools/testing/selftests/drivers/ntsync/ntsync.c
> > > >> +++ b/tools/testing/selftests/drivers/ntsync/ntsync.c
> > > >> @@ -968,7 +968,7 @@ TEST(wake_all)
> > > >>   	auto_event_args.manual = false;
> > > >>   	auto_event_args.signaled = true;
> > > >>   	objs[3] = ioctl(fd, NTSYNC_IOC_CREATE_EVENT, &auto_event_args);
> > > >> -	EXPECT_EQ(0, objs[3]);
> > > >> +	EXPECT_LE(0, objs[3]);
> > > > It's kind of weird how these macros put the constant on the left.
> > > > It returns an "fd" on success.  So this look reasonable.  It probably
> > > > won't return the zero fd so we could probably check EXPECT_LT()?
> > > Agreed, there are about 29 items that can be changed to EXPECT_LT().
> > > I can send a v2 patchset with this change if there is no more other
> > > suggestions.
> > 
> > I personally think it looks wrong to use EXPECT_LT(), but I'll certainly
> > defer to a higher maintainer on this point.
> 
> I'm not sure I understand what you are saying.  Are you saying that we
> should allow zero as an expected file descriptor here?  I don't have
> strong feelings about that either way.

Yes, my apologies for the ambiguous wording. That is, EXPECT_LE looks more correct to me than EXPECT_LT per se.

> Putting variables on the right, Yoda speak is.  Unnatural is.

Yes, I certainly agree with this. I wrote it this way in the first place because I was following some other example, I forget which.

> I did a git grep and the KUNIT_EXPECT_LT() just calls the parameters
> left and right instead of "expected" and "seen".  Expected is wrong
> for LT because we expect it to be != to the expected value.  It's
> the opposite.  We're expecting the unexpected!  It would be better
> to just call them left and right.
> 
> regards,
> dan carpenter
> 





  reply	other threads:[~2025-03-15 20:29 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <00d17d6d-19c9-4431-a3ac-c0f767c533d4@nfschina.com>
2025-03-14 10:23 ` [PATCH 1/4] selftests: ntsync: fix the wrong condition in wake_all Su Hui
2025-03-14 22:13 ` Elizabeth Figura
2025-03-15  9:39   ` Dan Carpenter
2025-03-15 20:29     ` Elizabeth Figura [this message]
2025-03-17  1:33       ` Su Hui
2025-03-14  7:14 [PATCH 0/4] ntsync: some small fixes for doc and selftests Su Hui
2025-03-14  7:14 ` [PATCH 1/4] selftests: ntsync: fix the wrong condition in wake_all Su Hui
2025-03-14  9:21   ` Dan Carpenter
2025-03-14 22:12   ` Elizabeth Figura

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=1961744.6tgchFWduM@camazotz \
    --to=zfigura@codeweavers.com \
    --cc=dan.carpenter@linaro.org \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=shuah@kernel.org \
    --cc=suhui@nfschina.com \
    --cc=wine-devel@winehq.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.