File tree Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -330,6 +330,29 @@ static void __init test_copy(void)
330
330
expect_eq_pbl ("0-108,128-1023" , bmap2 , 1024 );
331
331
}
332
332
333
+ static void __init test_bitmap_region (void )
334
+ {
335
+ int pos , order ;
336
+
337
+ DECLARE_BITMAP (bmap , 1000 );
338
+
339
+ bitmap_zero (bmap , 1000 );
340
+
341
+ for (order = 0 ; order < 10 ; order ++ ) {
342
+ pos = bitmap_find_free_region (bmap , 1000 , order );
343
+ if (order == 0 )
344
+ expect_eq_uint (pos , 0 );
345
+ else
346
+ expect_eq_uint (pos , order < 9 ? BIT (order ) : - ENOMEM );
347
+ }
348
+
349
+ bitmap_release_region (bmap , 0 , 0 );
350
+ for (order = 1 ; order < 9 ; order ++ )
351
+ bitmap_release_region (bmap , BIT (order ), order );
352
+
353
+ expect_eq_uint (bitmap_weight (bmap , 1000 ), 0 );
354
+ }
355
+
333
356
#define EXP2_IN_BITS (sizeof(exp2) * 8)
334
357
335
358
static void __init test_replace (void )
@@ -1227,6 +1250,7 @@ static void __init selftest(void)
1227
1250
test_zero_clear ();
1228
1251
test_fill_set ();
1229
1252
test_copy ();
1253
+ test_bitmap_region ();
1230
1254
test_replace ();
1231
1255
test_bitmap_arr32 ();
1232
1256
test_bitmap_arr64 ();
You can’t perform that action at this time.
0 commit comments