From: "Maíra Canal" <mairacanal@riseup.net>
To: "José Expósito" <jose.exposito89@gmail.com>, jikos@kernel.org
Cc: benjamin.tissoires@redhat.com, mairacanal@riseup.net,
linux-input@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] HID: uclogic: Use KUNIT_EXPECT_MEMEQ
Date: Mon, 26 Dec 2022 10:22:02 -0300 [thread overview]
Message-ID: <6cf1bb06-86b5-2c55-aec2-e2c414a05b66@riseup.net> (raw)
In-Reply-To: <20221226125736.18053-1-jose.exposito89@gmail.com>
On 12/26/22 09:57, José Expósito wrote:
> Commit b8a926bea8b1 ("kunit: Introduce KUNIT_EXPECT_MEMEQ and
> KUNIT_EXPECT_MEMNEQ macros") introduced a new macro to compare blocks of
> memory and, if the test fails, print the result in a human friendly
> format. For example, this is the output of a test failure:
>
> Expected res == params->expected, but
> res ==
> 01 02 aa 00 00 00 03 bb 00 <00> 00 04 05
> params->expected ==
> 01 02 aa 00 00 00 03 bb 00 <01> 00 04 05
>
> Use this new macro to replace KUNIT_EXPECT_EQ + memcmp.
>
> Signed-off-by: José Expósito <jose.exposito89@gmail.com>
Reviewed-by: Maíra Canal <mairacanal@riseup.net>
Best Regards,
- Maíra Canal
> ---
> drivers/hid/hid-uclogic-rdesc-test.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/hid/hid-uclogic-rdesc-test.c b/drivers/hid/hid-uclogic-rdesc-test.c
> index b429c541bf2f..90bf4e586e01 100644
> --- a/drivers/hid/hid-uclogic-rdesc-test.c
> +++ b/drivers/hid/hid-uclogic-rdesc-test.c
> @@ -197,8 +197,7 @@ static void hid_test_uclogic_template(struct kunit *test)
> params->param_list,
> params->param_num);
> KUNIT_ASSERT_NOT_ERR_OR_NULL(test, res);
> - KUNIT_EXPECT_EQ(test, 0,
> - memcmp(res, params->expected, params->template_size));
> + KUNIT_EXPECT_MEMEQ(test, res, params->expected, params->template_size);
> kfree(res);
> }
>
next prev parent reply other threads:[~2022-12-26 13:22 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-26 12:57 [PATCH] HID: uclogic: Use KUNIT_EXPECT_MEMEQ José Expósito
2022-12-26 13:22 ` Maíra Canal [this message]
2023-01-18 8:47 ` Jiri Kosina
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=6cf1bb06-86b5-2c55-aec2-e2c414a05b66@riseup.net \
--to=mairacanal@riseup.net \
--cc=benjamin.tissoires@redhat.com \
--cc=jikos@kernel.org \
--cc=jose.exposito89@gmail.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