mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Vincent Mailhol <mailhol.vincent@wanadoo.fr>
To: Lucas De Marchi <lucas.demarchi@intel.com>
Cc: Yury Norov <yury.norov@gmail.com>,
	Rasmus Villemoes <linux@rasmusvillemoes.dk>,
	Jani Nikula <jani.nikula@linux.intel.com>,
	Joonas Lahtinen <joonas.lahtinen@linux.intel.com>,
	Rodrigo Vivi <rodrigo.vivi@intel.com>,
	Tvrtko Ursulin <tursulin@ursulin.net>,
	David Airlie <airlied@gmail.com>, Simona Vetter <simona@ffwll.ch>,
	Andrew Morton <akpm@linux-foundation.org>,
	linux-kernel@vger.kernel.org, intel-gfx@lists.freedesktop.org,
	dri-devel@lists.freedesktop.org,
	Andi Shyti <andi.shyti@linux.intel.com>,
	David Laight <David.Laight@aculab.com>,
	Dmitry Baryshkov <dmitry.baryshkov@linaro.org>,
	Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Subject: Re: [PATCH v5 5/7] test_bits: add tests for __GENMASK() and __GENMASK_ULL()
Date: Thu, 13 Mar 2025 15:00:34 +0900	[thread overview]
Message-ID: <b65e5d8c-e7ca-4137-b697-3322e112fff7@wanadoo.fr> (raw)
In-Reply-To: <e5afhg75ry6km3hjmzbimonxc6qfl4vzma7ucv55h6iohrbmbn@xqmxfuvoinp6>

On 13/03/2025 at 13:13, Lucas De Marchi wrote:
> On Thu, Mar 06, 2025 at 08:29:56PM +0900, Vincent Mailhol via B4 Relay
> wrote:
>> From: Vincent Mailhol <mailhol.vincent@wanadoo.fr>
>>
>> The definitions of GENMASK() and GENMASK_ULL() do not depend any more
>> on __GENMASK() and __GENMASK_ULL(). Duplicate the existing unit tests
>> so that __GENMASK{,ULL}() is still covered.
>>
>> Signed-off-by: Vincent Mailhol <mailhol.vincent@wanadoo.fr>
>> ---
>> lib/test_bits.c | 18 ++++++++++++++++++
>> 1 file changed, 18 insertions(+)
>>
>> diff --git a/lib/test_bits.c b/lib/test_bits.c
>> index
>> c7b38d91e1f16d42b7ca92e62fbd6c19b37e76a0..dc93ded9fdb201e0d44b3c1cd71e233fd62258a5 100644
>> --- a/lib/test_bits.c
>> +++ b/lib/test_bits.c
>> @@ -7,6 +7,22 @@
>> #include <linux/bits.h>
>>
>>
>> +static void __genmask_test(struct kunit *test)
>> +{
>> +    KUNIT_EXPECT_EQ(test, 1ul, __GENMASK(0, 0));
>> +    KUNIT_EXPECT_EQ(test, 3ul, __GENMASK(1, 0));
>> +    KUNIT_EXPECT_EQ(test, 6ul, __GENMASK(2, 1));
>> +    KUNIT_EXPECT_EQ(test, 0xFFFFFFFFul, __GENMASK(31, 0));
> 
> why are you dropping the ones for TEST_GENMASK_FAILURES ?

Because the __GENMASK() and the __GENMASK_ULL() do not use
GENMASK_INPUT_CHECK(), it is not possible to have those
TEST_GENMASK_FAILURES negative test cases here.

I will add one sentence to the commit message to explain this.

>> +}
>> +
>> +static void __genmask_ull_test(struct kunit *test)
>> +{
>> +    KUNIT_EXPECT_EQ(test, 1ull, __GENMASK_ULL(0, 0));
>> +    KUNIT_EXPECT_EQ(test, 3ull, __GENMASK_ULL(1, 0));
>> +    KUNIT_EXPECT_EQ(test, 0x000000ffffe00000ull, __GENMASK_ULL(39, 21));
> 
> ditto
> 
> thanks
> Lucas De Marchi
> 
>> +    KUNIT_EXPECT_EQ(test, 0xffffffffffffffffull, __GENMASK_ULL(63, 0));
>> +}
>> +
>> static void genmask_test(struct kunit *test)
>> {
>>     KUNIT_EXPECT_EQ(test, 1ul, GENMASK(0, 0));
>> @@ -93,6 +109,8 @@ static void genmask_input_check_test(struct kunit
>> *test)
>>
>>
>> static struct kunit_case bits_test_cases[] = {
>> +    KUNIT_CASE(__genmask_test),
>> +    KUNIT_CASE(__genmask_ull_test),
>>     KUNIT_CASE(genmask_test),
>>     KUNIT_CASE(genmask_ull_test),
>>     KUNIT_CASE(genmask_u128_test),


Yours sincerely,
Vincent Mailhol


  reply	other threads:[~2025-03-13  6:01 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-06 11:29 [PATCH v5 0/7] bits: Fixed-type GENMASK()/BIT() Vincent Mailhol via B4 Relay
2025-03-06 11:29 ` [PATCH v5 1/7] bits: split the definition of the asm and non-asm GENMASK() Vincent Mailhol via B4 Relay
2025-03-06 13:05   ` Andy Shevchenko
2025-03-06 15:07     ` Vincent Mailhol
2025-03-06 17:51       ` Andy Shevchenko
2025-03-06 14:34   ` Lucas De Marchi
2025-03-06 17:10     ` Vincent Mailhol
2025-03-13  4:16       ` Lucas De Marchi
2025-03-13  6:06         ` Vincent Mailhol
2025-03-06 19:23   ` David Laight
2025-03-07  9:58     ` Vincent Mailhol
2025-03-07 13:27       ` David Laight
2025-03-07 15:50         ` Vincent Mailhol
2025-03-09  1:58       ` David Laight
2025-03-09 10:23         ` David Laight
2025-03-10 10:46           ` Vincent Mailhol
2025-03-06 11:29 ` [PATCH v5 2/7] bits: introduce fixed-type genmasks Vincent Mailhol via B4 Relay
2025-03-06 13:08   ` Andy Shevchenko
2025-03-06 16:08     ` Vincent Mailhol
2025-03-06 17:53       ` Andy Shevchenko
2025-03-06 11:29 ` [PATCH v5 3/7] bits: introduce fixed-type BIT_U*() Vincent Mailhol via B4 Relay
2025-03-06 11:29 ` [PATCH v5 4/7] drm/i915: Convert REG_GENMASK*() to fixed-width GENMASK_U*() Vincent Mailhol via B4 Relay
2025-03-06 11:29 ` [PATCH v5 5/7] test_bits: add tests for __GENMASK() and __GENMASK_ULL() Vincent Mailhol via B4 Relay
2025-03-13  4:13   ` Lucas De Marchi
2025-03-13  6:00     ` Vincent Mailhol [this message]
2025-03-13 13:15       ` Lucas De Marchi
2025-03-06 11:29 ` [PATCH v5 6/7] test_bits: add tests for GENMASK_U*() Vincent Mailhol via B4 Relay
2025-03-06 11:29 ` [PATCH v5 7/7] test_bits: add tests for BIT_U*() Vincent Mailhol via B4 Relay
2025-03-06 13:11   ` Andy Shevchenko
2025-03-06 16:08     ` Vincent Mailhol
2025-03-06 17:55       ` Andy Shevchenko
2025-03-07 10:11         ` Vincent Mailhol
2025-03-07 16:07           ` Andy Shevchenko
2025-03-07 16:47             ` Vincent Mailhol
2025-03-13  4:10   ` Lucas De Marchi
2025-03-06 13:02 ` [PATCH v5 0/7] bits: Fixed-type GENMASK()/BIT() Andy Shevchenko
2025-03-06 14:56   ` Vincent Mailhol
2025-03-06 13:12 ` Andy Shevchenko

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=b65e5d8c-e7ca-4137-b697-3322e112fff7@wanadoo.fr \
    --to=mailhol.vincent@wanadoo.fr \
    --cc=David.Laight@aculab.com \
    --cc=airlied@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=andi.shyti@linux.intel.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=dmitry.baryshkov@linaro.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=jani.nikula@linux.intel.com \
    --cc=joonas.lahtinen@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@rasmusvillemoes.dk \
    --cc=lucas.demarchi@intel.com \
    --cc=rodrigo.vivi@intel.com \
    --cc=simona@ffwll.ch \
    --cc=tursulin@ursulin.net \
    --cc=yury.norov@gmail.com \
    /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

all inboxes | Powered by JetHome®