From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Andrew Morton <akpm@linux-foundation.org>,
linux-kernel@vger.kernel.org,
Rasmus Villemoes <linux@rasmusvillemoes.dk>,
Randy Dunlap <rdunlap@infradead.org>,
Yury Norov <ynorov@caviumnetworks.com>
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Subject: [PATCH v1 2/4] bitmap: Add bitmap_fill()/bitmap_set() test cases
Date: Tue, 9 Jan 2018 19:24:28 +0200 [thread overview]
Message-ID: <20180109172430.87452-2-andriy.shevchenko@linux.intel.com> (raw)
In-Reply-To: <20180109172430.87452-1-andriy.shevchenko@linux.intel.com>
Explicitly test bitmap_fill() and bitmap_set() functions.
For bitmap_fill() we expect a consistent behaviour as in bitmap_zero(),
i.e. the trailing bits will be set up to unsigned long boundary.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
lib/test_bitmap.c | 30 ++++++++++++++++++++++++++++++
1 file changed, 30 insertions(+)
diff --git a/lib/test_bitmap.c b/lib/test_bitmap.c
index 9734af711816..6889fcc0e1f4 100644
--- a/lib/test_bitmap.c
+++ b/lib/test_bitmap.c
@@ -134,6 +134,35 @@ static void __init test_zero_clear(void)
expect_eq_pbl("", bmap, 1024);
}
+static void __init test_fill_set(void)
+{
+ DECLARE_BITMAP(bmap, 1024);
+
+ /* Known way to clear all bits */
+ memset(bmap, 0x00, 128);
+
+ expect_eq_pbl("", bmap, 23);
+ expect_eq_pbl("", bmap, 1024);
+
+ /* single-word bitmaps */
+ bitmap_set(bmap, 0, 9);
+ expect_eq_pbl("0-8", bmap, 1024);
+
+ bitmap_fill(bmap, 35);
+ expect_eq_pbl("0-63", bmap, 1024);
+
+ /* cross boundaries operations */
+ bitmap_set(bmap, 79, 19);
+ expect_eq_pbl("0-63,79-97", bmap, 1024);
+
+ bitmap_fill(bmap, 115);
+ expect_eq_pbl("0-127", bmap, 1024);
+
+ /* Zeroing entire area */
+ bitmap_fill(bmap, 1024);
+ expect_eq_pbl("0-1023", bmap, 1024);
+}
+
static void __init test_zero_fill_copy(void)
{
DECLARE_BITMAP(bmap1, 1024);
@@ -339,6 +368,7 @@ static void noinline __init test_mem_optimisations(void)
static int __init test_bitmap_init(void)
{
test_zero_clear();
+ test_fill_set();
test_zero_fill_copy();
test_bitmap_arr32();
test_bitmap_parselist();
--
2.15.1
next prev parent reply other threads:[~2018-01-09 17:25 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-09 17:24 [PATCH v1 1/4] bitmap: Add bitmap_zero()/bitmap_clear() test cases Andy Shevchenko
2018-01-09 17:24 ` Andy Shevchenko [this message]
2018-01-09 17:24 ` [PATCH v1 3/4] bitmap: Clean up test_zero_fill_copy() test case and rename Andy Shevchenko
2018-01-09 17:24 ` [PATCH v1 4/4] bitmap: Make bitmap_fill() and bitmap_zero() consistent Andy Shevchenko
2018-01-10 8:49 ` Yury Norov
2018-01-10 13:17 ` Andy Shevchenko
2018-01-11 11:57 ` Yury Norov
2018-01-11 12:46 ` Andy Shevchenko
2018-01-10 9:34 ` [PATCH v1 1/4] bitmap: Add bitmap_zero()/bitmap_clear() test cases Yury Norov
2018-01-10 13:11 ` Andy Shevchenko
2018-01-11 12:07 ` Yury Norov
2018-01-11 12: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=20180109172430.87452-2-andriy.shevchenko@linux.intel.com \
--to=andriy.shevchenko@linux.intel.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@rasmusvillemoes.dk \
--cc=rdunlap@infradead.org \
--cc=ynorov@caviumnetworks.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