linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Syed Nayyar Waris <syednwaris@gmail.com>
Cc: akpm@linux-foundation.org, vilhelm.gray@gmail.com,
	linus.walleij@linaro.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3 2/4] lib/test_bitmap.c: Add for_each_set_clump test cases
Date: Wed, 29 Apr 2020 13:16:27 +0300	[thread overview]
Message-ID: <20200429101627.GD185537@smile.fi.intel.com> (raw)
In-Reply-To: <46108644a1cc2750e281c33fd0efe99bd57c50e2.1588112715.git.syednwaris@gmail.com>

On Wed, Apr 29, 2020 at 04:35:58AM +0530, Syed Nayyar Waris wrote:
> The introduction of the generic for_each_set_clump macro need test
> cases to verify the implementation. This patch adds test cases for
> scenarios in which clump sizes are 8 bits, 24 bits, 30 bits and 6 bits.
> The cases contain situations where clump is getting split at the word
> boundary and also when zeroes are present in the start and middle of
> bitmap.

...

> +static void __init test_for_each_set_clump(void)
> +{
> +	/* common bitmap of max size for different tests */
> +	DECLARE_BITMAP(bits, 256);
> +
> +	/* set bitmap for test case 1 with clump size as 8 bits */
> +	bitmap_set_value(bits, 0x38000201, 0, 32);
> +	bitmap_set_value(bits, 0x05ff0f38, 32, 32);
> +
> +	execute_for_each_set_clump(bits, 64, clump_exp1, 8);
> +
> +	/* set bitmap for test case 2 with clump size as 24 bits */
> +	bitmap_set_value(bits, 0xeffedcba, 0, 32);
> +	bitmap_set_value(bits, 0xbbbbabcd, 32, 32);
> +	bitmap_set_value(bits, 0x000000aa, 64, 32);
> +	bitmap_set_value(bits, 0x000000aa, 96, 32);
> +	bitmap_set_value(bits, 0x00ff0000, 128, 32);
> +	bitmap_set_value(bits, 0xaaaaaa00, 160, 32);
> +	bitmap_set_value(bits, 0xff000000, 192, 32);
> +	bitmap_set_value(bits, 0x00aa0000, 224, 32);
> +
> +	execute_for_each_set_clump(bits, 240, clump_exp2, 24);
> +
> +	/* set bitmap for test case 3 with clump size as 30 bits */
> +	bitmap_set_value(bits, 0x00000000, 0, 32);
> +	bitmap_set_value(bits, 0x00000000, 32, 32);
> +	bitmap_set_value(bits, 0x00000000, 64, 32);
> +	bitmap_set_value(bits, 0x0f000000, 96, 32);
> +
> +	execute_for_each_set_clump(bits, 240, clump_exp3, 30);
> +
> +	/* set bitmap for test case 4 with clump size as 6 bits */
> +	bitmap_set_value(bits, 0x00000ac0, 0, 32);
> +	execute_for_each_set_clump(bits, 18, clump_exp4, 6);

You can roll entire function into one loop

	for i in ARRAY(test_data_configuration):
		prepare_test_data()
		execute_test()

> +}

-- 
With Best Regards,
Andy Shevchenko



  reply	other threads:[~2020-04-29 10:16 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-28 23:03 [PATCH v3 0/4] Introduce the for_each_set_clump macro Syed Nayyar Waris
2020-04-28 23:04 ` [PATCH v3 1/4] bitops: Introduce the " Syed Nayyar Waris
2020-04-28 23:05 ` [PATCH v3 2/4] lib/test_bitmap.c: Add for_each_set_clump test cases Syed Nayyar Waris
2020-04-29 10:16   ` Andy Shevchenko [this message]
2020-04-28 23:07 ` [PATCH v3 3/4] gpio: thunderx: Utilize for_each_set_clump macro Syed Nayyar Waris
2020-04-29 10:17   ` Andy Shevchenko
2020-04-30 16:22     ` Syed Nayyar Waris
2020-04-28 23:09 ` [PATCH v3 4/4] gpio: xilinx: " Syed Nayyar Waris
2020-04-29 10:21   ` Andy Shevchenko
2020-04-30 16:15     ` Syed Nayyar Waris
2020-04-30 16:38       ` Andy Shevchenko
2020-04-30 23:32         ` William Breathitt Gray
2020-05-01 13:32           ` 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=20200429101627.GD185537@smile.fi.intel.com \
    --to=andriy.shevchenko@linux.intel.com \
    --cc=akpm@linux-foundation.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=syednwaris@gmail.com \
    --cc=vilhelm.gray@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;
as well as URLs for NNTP newsgroup(s).