Messages in this thread | | | Date | Wed, 29 Apr 2020 13:16:27 +0300 | From | Andy Shevchenko <> | Subject | Re: [PATCH v3 2/4] lib/test_bitmap.c: Add for_each_set_clump test cases |
| |
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
| |