aboutsummaryrefslogtreecommitdiffstats
path: root/lib/test_bitmap.c
diff options
context:
space:
mode:
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>2018-02-06 18:38:17 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2018-02-06 21:32:44 -0500
commitfe81814c3e091adde489e9d7ac1179340845e396 (patch)
tree78dd2ae4f7c62a53003cb4f34f71bc8cfca52f82 /lib/test_bitmap.c
parent978f369c5c4777c32e686ecff5aaa5b677afc564 (diff)
lib/test_bitmap.c: clean up test_zero_fill_copy() test case and rename
Since we have separate explicit test cases for bitmap_zero() / bitmap_clear() and bitmap_fill() / bitmap_set(), clean up test_zero_fill_copy() to only test bitmap_copy() functionality and thus rename a function to reflect the changes. While here, replace bitmap_fill() by bitmap_set() with proper values. Link: http://lkml.kernel.org/r/20180109172430.87452-3-andriy.shevchenko@linux.intel.com Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Reviewed-by: Yury Norov <ynorov@caviumnetworks.com> Cc: Randy Dunlap <rdunlap@infradead.org> Cc: Rasmus Villemoes <linux@rasmusvillemoes.dk> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'lib/test_bitmap.c')
-rw-r--r--lib/test_bitmap.c29
1 files changed, 5 insertions, 24 deletions
diff --git a/lib/test_bitmap.c b/lib/test_bitmap.c
index 6889fcc0e1f4..b3f235baa05d 100644
--- a/lib/test_bitmap.c
+++ b/lib/test_bitmap.c
@@ -163,7 +163,7 @@ static void __init test_fill_set(void)
163 expect_eq_pbl("0-1023", bmap, 1024); 163 expect_eq_pbl("0-1023", bmap, 1024);
164} 164}
165 165
166static void __init test_zero_fill_copy(void) 166static void __init test_copy(void)
167{ 167{
168 DECLARE_BITMAP(bmap1, 1024); 168 DECLARE_BITMAP(bmap1, 1024);
169 DECLARE_BITMAP(bmap2, 1024); 169 DECLARE_BITMAP(bmap2, 1024);
@@ -172,36 +172,20 @@ static void __init test_zero_fill_copy(void)
172 bitmap_zero(bmap2, 1024); 172 bitmap_zero(bmap2, 1024);
173 173
174 /* single-word bitmaps */ 174 /* single-word bitmaps */
175 expect_eq_pbl("", bmap1, 23); 175 bitmap_set(bmap1, 0, 19);
176
177 bitmap_fill(bmap1, 19);
178 expect_eq_pbl("0-18", bmap1, 1024);
179
180 bitmap_copy(bmap2, bmap1, 23); 176 bitmap_copy(bmap2, bmap1, 23);
181 expect_eq_pbl("0-18", bmap2, 1024); 177 expect_eq_pbl("0-18", bmap2, 1024);
182 178
183 bitmap_fill(bmap2, 23); 179 bitmap_set(bmap2, 0, 23);
184 expect_eq_pbl("0-22", bmap2, 1024);
185
186 bitmap_copy(bmap2, bmap1, 23); 180 bitmap_copy(bmap2, bmap1, 23);
187 expect_eq_pbl("0-18", bmap2, 1024); 181 expect_eq_pbl("0-18", bmap2, 1024);
188 182
189 bitmap_zero(bmap1, 23);
190 expect_eq_pbl("", bmap1, 1024);
191
192 /* multi-word bitmaps */ 183 /* multi-word bitmaps */
193 bitmap_zero(bmap1, 1024); 184 bitmap_set(bmap1, 0, 109);
194 expect_eq_pbl("", bmap1, 1024);
195
196 bitmap_fill(bmap1, 109);
197 expect_eq_pbl("0-108", bmap1, 1024);
198
199 bitmap_copy(bmap2, bmap1, 1024); 185 bitmap_copy(bmap2, bmap1, 1024);
200 expect_eq_pbl("0-108", bmap2, 1024); 186 expect_eq_pbl("0-108", bmap2, 1024);
201 187
202 bitmap_fill(bmap2, 1024); 188 bitmap_fill(bmap2, 1024);
203 expect_eq_pbl("0-1023", bmap2, 1024);
204
205 bitmap_copy(bmap2, bmap1, 1024); 189 bitmap_copy(bmap2, bmap1, 1024);
206 expect_eq_pbl("0-108", bmap2, 1024); 190 expect_eq_pbl("0-108", bmap2, 1024);
207 191
@@ -216,9 +200,6 @@ static void __init test_zero_fill_copy(void)
216 bitmap_fill(bmap2, 1024); 200 bitmap_fill(bmap2, 1024);
217 bitmap_copy(bmap2, bmap1, 97); /* ... but aligned on word length */ 201 bitmap_copy(bmap2, bmap1, 97); /* ... but aligned on word length */
218 expect_eq_pbl("0-108,128-1023", bmap2, 1024); 202 expect_eq_pbl("0-108,128-1023", bmap2, 1024);
219
220 bitmap_zero(bmap2, 97); /* ... but 0-padded til word length */
221 expect_eq_pbl("128-1023", bmap2, 1024);
222} 203}
223 204
224#define PARSE_TIME 0x1 205#define PARSE_TIME 0x1
@@ -369,7 +350,7 @@ static int __init test_bitmap_init(void)
369{ 350{
370 test_zero_clear(); 351 test_zero_clear();
371 test_fill_set(); 352 test_fill_set();
372 test_zero_fill_copy(); 353 test_copy();
373 test_bitmap_arr32(); 354 test_bitmap_arr32();
374 test_bitmap_parselist(); 355 test_bitmap_parselist();
375 test_mem_optimisations(); 356 test_mem_optimisations();