Thomas Gleixner | 09c434b | 2019-05-19 13:08:20 +0100 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0-only |
David Decotigny | 5fd003f | 2016-02-19 09:24:00 -0500 | [diff] [blame] | 2 | /* |
Andy Shevchenko | 780ff33 | 2019-12-04 16:53:23 -0800 | [diff] [blame] | 3 | * Test cases for bitmap API. |
David Decotigny | 5fd003f | 2016-02-19 09:24:00 -0500 | [diff] [blame] | 4 | */ |
| 5 | |
| 6 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt |
| 7 | |
| 8 | #include <linux/bitmap.h> |
| 9 | #include <linux/init.h> |
| 10 | #include <linux/kernel.h> |
| 11 | #include <linux/module.h> |
| 12 | #include <linux/printk.h> |
| 13 | #include <linux/slab.h> |
| 14 | #include <linux/string.h> |
Yury Norov | 6ea86bd | 2019-05-14 15:43:24 -0700 | [diff] [blame] | 15 | #include <linux/uaccess.h> |
David Decotigny | 5fd003f | 2016-02-19 09:24:00 -0500 | [diff] [blame] | 16 | |
Tobin C. Harding | 6b1a4d5 | 2019-04-05 12:58:57 +1100 | [diff] [blame] | 17 | #include "../tools/testing/selftests/kselftest_module.h" |
| 18 | |
Timur Tabi | 4e89a78 | 2021-02-14 10:13:46 -0600 | [diff] [blame] | 19 | KSTM_MODULE_GLOBALS(); |
David Decotigny | 5fd003f | 2016-02-19 09:24:00 -0500 | [diff] [blame] | 20 | |
| 21 | static char pbl_buffer[PAGE_SIZE] __initdata; |
| 22 | |
Andy Shevchenko | c21dd8a | 2019-12-04 16:53:20 -0800 | [diff] [blame] | 23 | static const unsigned long exp1[] __initconst = { |
| 24 | BITMAP_FROM_U64(1), |
| 25 | BITMAP_FROM_U64(2), |
| 26 | BITMAP_FROM_U64(0x0000ffff), |
| 27 | BITMAP_FROM_U64(0xffff0000), |
| 28 | BITMAP_FROM_U64(0x55555555), |
| 29 | BITMAP_FROM_U64(0xaaaaaaaa), |
| 30 | BITMAP_FROM_U64(0x11111111), |
| 31 | BITMAP_FROM_U64(0x22222222), |
| 32 | BITMAP_FROM_U64(0xffffffff), |
| 33 | BITMAP_FROM_U64(0xfffffffe), |
| 34 | BITMAP_FROM_U64(0x3333333311111111ULL), |
| 35 | BITMAP_FROM_U64(0xffffffff77777777ULL), |
| 36 | BITMAP_FROM_U64(0), |
| 37 | }; |
| 38 | |
| 39 | static const unsigned long exp2[] __initconst = { |
| 40 | BITMAP_FROM_U64(0x3333333311111111ULL), |
| 41 | BITMAP_FROM_U64(0xffffffff77777777ULL), |
| 42 | }; |
David Decotigny | 5fd003f | 2016-02-19 09:24:00 -0500 | [diff] [blame] | 43 | |
Andy Shevchenko | 30544ed | 2019-12-04 16:53:26 -0800 | [diff] [blame] | 44 | /* Fibonacci sequence */ |
| 45 | static const unsigned long exp2_to_exp3_mask[] __initconst = { |
| 46 | BITMAP_FROM_U64(0x008000020020212eULL), |
| 47 | }; |
| 48 | /* exp3_0_1 = (exp2[0] & ~exp2_to_exp3_mask) | (exp2[1] & exp2_to_exp3_mask) */ |
| 49 | static const unsigned long exp3_0_1[] __initconst = { |
| 50 | BITMAP_FROM_U64(0x33b3333311313137ULL), |
| 51 | }; |
| 52 | /* exp3_1_0 = (exp2[1] & ~exp2_to_exp3_mask) | (exp2[0] & exp2_to_exp3_mask) */ |
| 53 | static const unsigned long exp3_1_0[] __initconst = { |
| 54 | BITMAP_FROM_U64(0xff7fffff77575751ULL), |
| 55 | }; |
| 56 | |
David Decotigny | 5fd003f | 2016-02-19 09:24:00 -0500 | [diff] [blame] | 57 | static bool __init |
| 58 | __check_eq_uint(const char *srcfile, unsigned int line, |
| 59 | const unsigned int exp_uint, unsigned int x) |
| 60 | { |
| 61 | if (exp_uint != x) { |
Yury Norov | 3aa5688 | 2018-02-06 15:38:06 -0800 | [diff] [blame] | 62 | pr_err("[%s:%u] expected %u, got %u\n", |
David Decotigny | 5fd003f | 2016-02-19 09:24:00 -0500 | [diff] [blame] | 63 | srcfile, line, exp_uint, x); |
| 64 | return false; |
| 65 | } |
| 66 | return true; |
| 67 | } |
| 68 | |
| 69 | |
| 70 | static bool __init |
| 71 | __check_eq_bitmap(const char *srcfile, unsigned int line, |
Yury Norov | 3aa5688 | 2018-02-06 15:38:06 -0800 | [diff] [blame] | 72 | const unsigned long *exp_bmap, const unsigned long *bmap, |
| 73 | unsigned int nbits) |
David Decotigny | 5fd003f | 2016-02-19 09:24:00 -0500 | [diff] [blame] | 74 | { |
David Decotigny | 5fd003f | 2016-02-19 09:24:00 -0500 | [diff] [blame] | 75 | if (!bitmap_equal(exp_bmap, bmap, nbits)) { |
| 76 | pr_warn("[%s:%u] bitmaps contents differ: expected \"%*pbl\", got \"%*pbl\"\n", |
| 77 | srcfile, line, |
Yury Norov | 3aa5688 | 2018-02-06 15:38:06 -0800 | [diff] [blame] | 78 | nbits, exp_bmap, nbits, bmap); |
David Decotigny | 5fd003f | 2016-02-19 09:24:00 -0500 | [diff] [blame] | 79 | return false; |
| 80 | } |
| 81 | return true; |
| 82 | } |
| 83 | |
| 84 | static bool __init |
| 85 | __check_eq_pbl(const char *srcfile, unsigned int line, |
| 86 | const char *expected_pbl, |
| 87 | const unsigned long *bitmap, unsigned int nbits) |
| 88 | { |
| 89 | snprintf(pbl_buffer, sizeof(pbl_buffer), "%*pbl", nbits, bitmap); |
| 90 | if (strcmp(expected_pbl, pbl_buffer)) { |
| 91 | pr_warn("[%s:%u] expected \"%s\", got \"%s\"\n", |
| 92 | srcfile, line, |
| 93 | expected_pbl, pbl_buffer); |
| 94 | return false; |
| 95 | } |
| 96 | return true; |
| 97 | } |
| 98 | |
| 99 | static bool __init |
| 100 | __check_eq_u32_array(const char *srcfile, unsigned int line, |
| 101 | const u32 *exp_arr, unsigned int exp_len, |
Yury Norov | 3aa5688 | 2018-02-06 15:38:06 -0800 | [diff] [blame] | 102 | const u32 *arr, unsigned int len) __used; |
| 103 | static bool __init |
| 104 | __check_eq_u32_array(const char *srcfile, unsigned int line, |
| 105 | const u32 *exp_arr, unsigned int exp_len, |
David Decotigny | 5fd003f | 2016-02-19 09:24:00 -0500 | [diff] [blame] | 106 | const u32 *arr, unsigned int len) |
| 107 | { |
| 108 | if (exp_len != len) { |
| 109 | pr_warn("[%s:%u] array length differ: expected %u, got %u\n", |
| 110 | srcfile, line, |
| 111 | exp_len, len); |
| 112 | return false; |
| 113 | } |
| 114 | |
| 115 | if (memcmp(exp_arr, arr, len*sizeof(*arr))) { |
| 116 | pr_warn("[%s:%u] array contents differ\n", srcfile, line); |
| 117 | print_hex_dump(KERN_WARNING, " exp: ", DUMP_PREFIX_OFFSET, |
| 118 | 32, 4, exp_arr, exp_len*sizeof(*exp_arr), false); |
| 119 | print_hex_dump(KERN_WARNING, " got: ", DUMP_PREFIX_OFFSET, |
| 120 | 32, 4, arr, len*sizeof(*arr), false); |
| 121 | return false; |
| 122 | } |
| 123 | |
| 124 | return true; |
| 125 | } |
| 126 | |
William Breathitt Gray | e4aa168 | 2019-12-04 16:51:01 -0800 | [diff] [blame] | 127 | static bool __init __check_eq_clump8(const char *srcfile, unsigned int line, |
| 128 | const unsigned int offset, |
| 129 | const unsigned int size, |
| 130 | const unsigned char *const clump_exp, |
| 131 | const unsigned long *const clump) |
| 132 | { |
| 133 | unsigned long exp; |
| 134 | |
| 135 | if (offset >= size) { |
| 136 | pr_warn("[%s:%u] bit offset for clump out-of-bounds: expected less than %u, got %u\n", |
| 137 | srcfile, line, size, offset); |
| 138 | return false; |
| 139 | } |
| 140 | |
| 141 | exp = clump_exp[offset / 8]; |
| 142 | if (!exp) { |
| 143 | pr_warn("[%s:%u] bit offset for zero clump: expected nonzero clump, got bit offset %u with clump value 0", |
| 144 | srcfile, line, offset); |
| 145 | return false; |
| 146 | } |
| 147 | |
| 148 | if (*clump != exp) { |
| 149 | pr_warn("[%s:%u] expected clump value of 0x%lX, got clump value of 0x%lX", |
| 150 | srcfile, line, exp, *clump); |
| 151 | return false; |
| 152 | } |
| 153 | |
| 154 | return true; |
| 155 | } |
| 156 | |
David Decotigny | 5fd003f | 2016-02-19 09:24:00 -0500 | [diff] [blame] | 157 | #define __expect_eq(suffix, ...) \ |
| 158 | ({ \ |
| 159 | int result = 0; \ |
| 160 | total_tests++; \ |
| 161 | if (!__check_eq_ ## suffix(__FILE__, __LINE__, \ |
| 162 | ##__VA_ARGS__)) { \ |
| 163 | failed_tests++; \ |
| 164 | result = 1; \ |
| 165 | } \ |
| 166 | result; \ |
| 167 | }) |
| 168 | |
| 169 | #define expect_eq_uint(...) __expect_eq(uint, ##__VA_ARGS__) |
| 170 | #define expect_eq_bitmap(...) __expect_eq(bitmap, ##__VA_ARGS__) |
| 171 | #define expect_eq_pbl(...) __expect_eq(pbl, ##__VA_ARGS__) |
| 172 | #define expect_eq_u32_array(...) __expect_eq(u32_array, ##__VA_ARGS__) |
William Breathitt Gray | e4aa168 | 2019-12-04 16:51:01 -0800 | [diff] [blame] | 173 | #define expect_eq_clump8(...) __expect_eq(clump8, ##__VA_ARGS__) |
David Decotigny | 5fd003f | 2016-02-19 09:24:00 -0500 | [diff] [blame] | 174 | |
Andy Shevchenko | ee3527bd | 2018-02-06 15:38:10 -0800 | [diff] [blame] | 175 | static void __init test_zero_clear(void) |
| 176 | { |
| 177 | DECLARE_BITMAP(bmap, 1024); |
| 178 | |
| 179 | /* Known way to set all bits */ |
| 180 | memset(bmap, 0xff, 128); |
| 181 | |
| 182 | expect_eq_pbl("0-22", bmap, 23); |
| 183 | expect_eq_pbl("0-1023", bmap, 1024); |
| 184 | |
| 185 | /* single-word bitmaps */ |
| 186 | bitmap_clear(bmap, 0, 9); |
| 187 | expect_eq_pbl("9-1023", bmap, 1024); |
| 188 | |
| 189 | bitmap_zero(bmap, 35); |
| 190 | expect_eq_pbl("64-1023", bmap, 1024); |
| 191 | |
| 192 | /* cross boundaries operations */ |
| 193 | bitmap_clear(bmap, 79, 19); |
| 194 | expect_eq_pbl("64-78,98-1023", bmap, 1024); |
| 195 | |
| 196 | bitmap_zero(bmap, 115); |
| 197 | expect_eq_pbl("128-1023", bmap, 1024); |
| 198 | |
| 199 | /* Zeroing entire area */ |
| 200 | bitmap_zero(bmap, 1024); |
| 201 | expect_eq_pbl("", bmap, 1024); |
| 202 | } |
| 203 | |
Andy Shevchenko | 978f369 | 2018-02-06 15:38:13 -0800 | [diff] [blame] | 204 | static void __init test_fill_set(void) |
| 205 | { |
| 206 | DECLARE_BITMAP(bmap, 1024); |
| 207 | |
| 208 | /* Known way to clear all bits */ |
| 209 | memset(bmap, 0x00, 128); |
| 210 | |
| 211 | expect_eq_pbl("", bmap, 23); |
| 212 | expect_eq_pbl("", bmap, 1024); |
| 213 | |
| 214 | /* single-word bitmaps */ |
| 215 | bitmap_set(bmap, 0, 9); |
| 216 | expect_eq_pbl("0-8", bmap, 1024); |
| 217 | |
| 218 | bitmap_fill(bmap, 35); |
| 219 | expect_eq_pbl("0-63", bmap, 1024); |
| 220 | |
| 221 | /* cross boundaries operations */ |
| 222 | bitmap_set(bmap, 79, 19); |
| 223 | expect_eq_pbl("0-63,79-97", bmap, 1024); |
| 224 | |
| 225 | bitmap_fill(bmap, 115); |
| 226 | expect_eq_pbl("0-127", bmap, 1024); |
| 227 | |
| 228 | /* Zeroing entire area */ |
| 229 | bitmap_fill(bmap, 1024); |
| 230 | expect_eq_pbl("0-1023", bmap, 1024); |
| 231 | } |
| 232 | |
Andy Shevchenko | fe81814 | 2018-02-06 15:38:17 -0800 | [diff] [blame] | 233 | static void __init test_copy(void) |
David Decotigny | 5fd003f | 2016-02-19 09:24:00 -0500 | [diff] [blame] | 234 | { |
| 235 | DECLARE_BITMAP(bmap1, 1024); |
| 236 | DECLARE_BITMAP(bmap2, 1024); |
| 237 | |
| 238 | bitmap_zero(bmap1, 1024); |
| 239 | bitmap_zero(bmap2, 1024); |
| 240 | |
| 241 | /* single-word bitmaps */ |
Andy Shevchenko | fe81814 | 2018-02-06 15:38:17 -0800 | [diff] [blame] | 242 | bitmap_set(bmap1, 0, 19); |
David Decotigny | 5fd003f | 2016-02-19 09:24:00 -0500 | [diff] [blame] | 243 | bitmap_copy(bmap2, bmap1, 23); |
| 244 | expect_eq_pbl("0-18", bmap2, 1024); |
| 245 | |
Andy Shevchenko | fe81814 | 2018-02-06 15:38:17 -0800 | [diff] [blame] | 246 | bitmap_set(bmap2, 0, 23); |
David Decotigny | 5fd003f | 2016-02-19 09:24:00 -0500 | [diff] [blame] | 247 | bitmap_copy(bmap2, bmap1, 23); |
| 248 | expect_eq_pbl("0-18", bmap2, 1024); |
| 249 | |
David Decotigny | 5fd003f | 2016-02-19 09:24:00 -0500 | [diff] [blame] | 250 | /* multi-word bitmaps */ |
Andy Shevchenko | fe81814 | 2018-02-06 15:38:17 -0800 | [diff] [blame] | 251 | bitmap_set(bmap1, 0, 109); |
David Decotigny | 5fd003f | 2016-02-19 09:24:00 -0500 | [diff] [blame] | 252 | bitmap_copy(bmap2, bmap1, 1024); |
| 253 | expect_eq_pbl("0-108", bmap2, 1024); |
| 254 | |
| 255 | bitmap_fill(bmap2, 1024); |
David Decotigny | 5fd003f | 2016-02-19 09:24:00 -0500 | [diff] [blame] | 256 | bitmap_copy(bmap2, bmap1, 1024); |
| 257 | expect_eq_pbl("0-108", bmap2, 1024); |
| 258 | |
| 259 | /* the following tests assume a 32- or 64-bit arch (even 128b |
| 260 | * if we care) |
| 261 | */ |
| 262 | |
| 263 | bitmap_fill(bmap2, 1024); |
| 264 | bitmap_copy(bmap2, bmap1, 109); /* ... but 0-padded til word length */ |
| 265 | expect_eq_pbl("0-108,128-1023", bmap2, 1024); |
| 266 | |
| 267 | bitmap_fill(bmap2, 1024); |
| 268 | bitmap_copy(bmap2, bmap1, 97); /* ... but aligned on word length */ |
| 269 | expect_eq_pbl("0-108,128-1023", bmap2, 1024); |
David Decotigny | 5fd003f | 2016-02-19 09:24:00 -0500 | [diff] [blame] | 270 | } |
| 271 | |
Andy Shevchenko | 30544ed | 2019-12-04 16:53:26 -0800 | [diff] [blame] | 272 | #define EXP2_IN_BITS (sizeof(exp2) * 8) |
| 273 | |
| 274 | static void __init test_replace(void) |
| 275 | { |
| 276 | unsigned int nbits = 64; |
Andy Shevchenko | 69334ca | 2020-01-30 22:11:01 -0800 | [diff] [blame] | 277 | unsigned int nlongs = DIV_ROUND_UP(nbits, BITS_PER_LONG); |
Andy Shevchenko | 30544ed | 2019-12-04 16:53:26 -0800 | [diff] [blame] | 278 | DECLARE_BITMAP(bmap, 1024); |
| 279 | |
Andy Shevchenko | caa7f77 | 2020-04-06 20:10:28 -0700 | [diff] [blame] | 280 | BUILD_BUG_ON(EXP2_IN_BITS < nbits * 2); |
| 281 | |
Andy Shevchenko | 30544ed | 2019-12-04 16:53:26 -0800 | [diff] [blame] | 282 | bitmap_zero(bmap, 1024); |
Andy Shevchenko | 69334ca | 2020-01-30 22:11:01 -0800 | [diff] [blame] | 283 | bitmap_replace(bmap, &exp2[0 * nlongs], &exp2[1 * nlongs], exp2_to_exp3_mask, nbits); |
Andy Shevchenko | 30544ed | 2019-12-04 16:53:26 -0800 | [diff] [blame] | 284 | expect_eq_bitmap(bmap, exp3_0_1, nbits); |
| 285 | |
| 286 | bitmap_zero(bmap, 1024); |
Andy Shevchenko | 69334ca | 2020-01-30 22:11:01 -0800 | [diff] [blame] | 287 | bitmap_replace(bmap, &exp2[1 * nlongs], &exp2[0 * nlongs], exp2_to_exp3_mask, nbits); |
Andy Shevchenko | 30544ed | 2019-12-04 16:53:26 -0800 | [diff] [blame] | 288 | expect_eq_bitmap(bmap, exp3_1_0, nbits); |
| 289 | |
| 290 | bitmap_fill(bmap, 1024); |
Andy Shevchenko | 69334ca | 2020-01-30 22:11:01 -0800 | [diff] [blame] | 291 | bitmap_replace(bmap, &exp2[0 * nlongs], &exp2[1 * nlongs], exp2_to_exp3_mask, nbits); |
Andy Shevchenko | 30544ed | 2019-12-04 16:53:26 -0800 | [diff] [blame] | 292 | expect_eq_bitmap(bmap, exp3_0_1, nbits); |
| 293 | |
| 294 | bitmap_fill(bmap, 1024); |
Andy Shevchenko | 69334ca | 2020-01-30 22:11:01 -0800 | [diff] [blame] | 295 | bitmap_replace(bmap, &exp2[1 * nlongs], &exp2[0 * nlongs], exp2_to_exp3_mask, nbits); |
Andy Shevchenko | 30544ed | 2019-12-04 16:53:26 -0800 | [diff] [blame] | 296 | expect_eq_bitmap(bmap, exp3_1_0, nbits); |
| 297 | } |
| 298 | |
Yury Norov | 7eb2e94 | 2020-02-03 17:37:27 -0800 | [diff] [blame] | 299 | #define PARSE_TIME 0x1 |
| 300 | #define NO_LEN 0x2 |
Yury Norov | 6df0d46 | 2017-09-08 16:15:38 -0700 | [diff] [blame] | 301 | |
| 302 | struct test_bitmap_parselist{ |
| 303 | const int errno; |
| 304 | const char *in; |
| 305 | const unsigned long *expected; |
| 306 | const int nbits; |
| 307 | const int flags; |
| 308 | }; |
| 309 | |
Yury Norov | 6df0d46 | 2017-09-08 16:15:38 -0700 | [diff] [blame] | 310 | static const struct test_bitmap_parselist parselist_tests[] __initconst = { |
Yury Norov | 60ef690 | 2017-09-08 16:15:41 -0700 | [diff] [blame] | 311 | #define step (sizeof(u64) / sizeof(unsigned long)) |
| 312 | |
Andy Shevchenko | 0ee312e | 2019-12-04 16:53:17 -0800 | [diff] [blame] | 313 | {0, "0", &exp1[0], 8, 0}, |
| 314 | {0, "1", &exp1[1 * step], 8, 0}, |
| 315 | {0, "0-15", &exp1[2 * step], 32, 0}, |
| 316 | {0, "16-31", &exp1[3 * step], 32, 0}, |
| 317 | {0, "0-31:1/2", &exp1[4 * step], 32, 0}, |
| 318 | {0, "1-31:1/2", &exp1[5 * step], 32, 0}, |
| 319 | {0, "0-31:1/4", &exp1[6 * step], 32, 0}, |
| 320 | {0, "1-31:1/4", &exp1[7 * step], 32, 0}, |
| 321 | {0, "0-31:4/4", &exp1[8 * step], 32, 0}, |
| 322 | {0, "1-31:4/4", &exp1[9 * step], 32, 0}, |
| 323 | {0, "0-31:1/4,32-63:2/4", &exp1[10 * step], 64, 0}, |
| 324 | {0, "0-31:3/4,32-63:4/4", &exp1[11 * step], 64, 0}, |
| 325 | {0, " ,, 0-31:3/4 ,, 32-63:4/4 ,, ", &exp1[11 * step], 64, 0}, |
Yury Norov | 6df0d46 | 2017-09-08 16:15:38 -0700 | [diff] [blame] | 326 | |
| 327 | {0, "0-31:1/4,32-63:2/4,64-95:3/4,96-127:4/4", exp2, 128, 0}, |
| 328 | |
| 329 | {0, "0-2047:128/256", NULL, 2048, PARSE_TIME}, |
| 330 | |
Andy Shevchenko | 0ee312e | 2019-12-04 16:53:17 -0800 | [diff] [blame] | 331 | {0, "", &exp1[12 * step], 8, 0}, |
| 332 | {0, "\n", &exp1[12 * step], 8, 0}, |
| 333 | {0, ",, ,, , , ,", &exp1[12 * step], 8, 0}, |
| 334 | {0, " , ,, , , ", &exp1[12 * step], 8, 0}, |
| 335 | {0, " , ,, , , \n", &exp1[12 * step], 8, 0}, |
Yury Norov | a4ab505 | 2019-05-14 15:43:21 -0700 | [diff] [blame] | 336 | |
Yury Norov | 6df0d46 | 2017-09-08 16:15:38 -0700 | [diff] [blame] | 337 | {-EINVAL, "-1", NULL, 8, 0}, |
| 338 | {-EINVAL, "-0", NULL, 8, 0}, |
| 339 | {-EINVAL, "10-1", NULL, 8, 0}, |
Paul Gortmaker | 6fef590 | 2021-02-21 03:08:21 -0500 | [diff] [blame^] | 340 | {-ERANGE, "8-8", NULL, 8, 0}, |
| 341 | {-ERANGE, "0-31", NULL, 8, 0}, |
Paul Gortmaker | 494215f | 2021-02-21 03:08:20 -0500 | [diff] [blame] | 342 | {-EINVAL, "0-31:", NULL, 32, 0}, |
| 343 | {-EINVAL, "0-31:0", NULL, 32, 0}, |
| 344 | {-EINVAL, "0-31:0/", NULL, 32, 0}, |
| 345 | {-EINVAL, "0-31:0/0", NULL, 32, 0}, |
| 346 | {-EINVAL, "0-31:1/0", NULL, 32, 0}, |
| 347 | {-EINVAL, "0-31:10/1", NULL, 32, 0}, |
Yury Norov | a4ab505 | 2019-05-14 15:43:21 -0700 | [diff] [blame] | 348 | {-EOVERFLOW, "0-98765432123456789:10/1", NULL, 8, 0}, |
| 349 | |
| 350 | {-EINVAL, "a-31", NULL, 8, 0}, |
| 351 | {-EINVAL, "0-a1", NULL, 8, 0}, |
| 352 | {-EINVAL, "a-31:10/1", NULL, 8, 0}, |
| 353 | {-EINVAL, "0-31:a/1", NULL, 8, 0}, |
| 354 | {-EINVAL, "0-\n", NULL, 8, 0}, |
Andy Shevchenko | 5422404 | 2019-12-04 16:53:09 -0800 | [diff] [blame] | 355 | |
Yury Norov | 6df0d46 | 2017-09-08 16:15:38 -0700 | [diff] [blame] | 356 | }; |
| 357 | |
Christoph Hellwig | 81b1e24 | 2020-09-03 16:22:36 +0200 | [diff] [blame] | 358 | static void __init test_bitmap_parselist(void) |
Yury Norov | 6df0d46 | 2017-09-08 16:15:38 -0700 | [diff] [blame] | 359 | { |
| 360 | int i; |
| 361 | int err; |
Yury Norov | 0c2111a | 2019-05-14 15:43:18 -0700 | [diff] [blame] | 362 | ktime_t time; |
Yury Norov | 6df0d46 | 2017-09-08 16:15:38 -0700 | [diff] [blame] | 363 | DECLARE_BITMAP(bmap, 2048); |
| 364 | |
| 365 | for (i = 0; i < ARRAY_SIZE(parselist_tests); i++) { |
| 366 | #define ptest parselist_tests[i] |
| 367 | |
Christoph Hellwig | 81b1e24 | 2020-09-03 16:22:36 +0200 | [diff] [blame] | 368 | time = ktime_get(); |
| 369 | err = bitmap_parselist(ptest.in, bmap, ptest.nbits); |
| 370 | time = ktime_get() - time; |
Yury Norov | 6df0d46 | 2017-09-08 16:15:38 -0700 | [diff] [blame] | 371 | |
| 372 | if (err != ptest.errno) { |
Christoph Hellwig | 81b1e24 | 2020-09-03 16:22:36 +0200 | [diff] [blame] | 373 | pr_err("parselist: %d: input is %s, errno is %d, expected %d\n", |
| 374 | i, ptest.in, err, ptest.errno); |
Yury Norov | 6df0d46 | 2017-09-08 16:15:38 -0700 | [diff] [blame] | 375 | continue; |
| 376 | } |
| 377 | |
| 378 | if (!err && ptest.expected |
| 379 | && !__bitmap_equal(bmap, ptest.expected, ptest.nbits)) { |
Christoph Hellwig | 81b1e24 | 2020-09-03 16:22:36 +0200 | [diff] [blame] | 380 | pr_err("parselist: %d: input is %s, result is 0x%lx, expected 0x%lx\n", |
| 381 | i, ptest.in, bmap[0], |
Yury Norov | 6ea86bd | 2019-05-14 15:43:24 -0700 | [diff] [blame] | 382 | *ptest.expected); |
Yury Norov | 6df0d46 | 2017-09-08 16:15:38 -0700 | [diff] [blame] | 383 | continue; |
| 384 | } |
| 385 | |
| 386 | if (ptest.flags & PARSE_TIME) |
Christoph Hellwig | 81b1e24 | 2020-09-03 16:22:36 +0200 | [diff] [blame] | 387 | pr_err("parselist: %d: input is '%s' OK, Time: %llu\n", |
| 388 | i, ptest.in, time); |
Andy Shevchenko | 5422404 | 2019-12-04 16:53:09 -0800 | [diff] [blame] | 389 | |
| 390 | #undef ptest |
Yury Norov | 6df0d46 | 2017-09-08 16:15:38 -0700 | [diff] [blame] | 391 | } |
| 392 | } |
| 393 | |
Yury Norov | 7eb2e94 | 2020-02-03 17:37:27 -0800 | [diff] [blame] | 394 | static const unsigned long parse_test[] __initconst = { |
| 395 | BITMAP_FROM_U64(0), |
| 396 | BITMAP_FROM_U64(1), |
| 397 | BITMAP_FROM_U64(0xdeadbeef), |
| 398 | BITMAP_FROM_U64(0x100000000ULL), |
| 399 | }; |
| 400 | |
| 401 | static const unsigned long parse_test2[] __initconst = { |
| 402 | BITMAP_FROM_U64(0x100000000ULL), BITMAP_FROM_U64(0xdeadbeef), |
| 403 | BITMAP_FROM_U64(0x100000000ULL), BITMAP_FROM_U64(0xbaadf00ddeadbeef), |
| 404 | BITMAP_FROM_U64(0x100000000ULL), BITMAP_FROM_U64(0x0badf00ddeadbeef), |
| 405 | }; |
| 406 | |
| 407 | static const struct test_bitmap_parselist parse_tests[] __initconst = { |
Yury Norov | 809e308 | 2020-02-03 17:37:38 -0800 | [diff] [blame] | 408 | {0, "", &parse_test[0 * step], 32, 0}, |
| 409 | {0, " ", &parse_test[0 * step], 32, 0}, |
Yury Norov | 7eb2e94 | 2020-02-03 17:37:27 -0800 | [diff] [blame] | 410 | {0, "0", &parse_test[0 * step], 32, 0}, |
Yury Norov | 809e308 | 2020-02-03 17:37:38 -0800 | [diff] [blame] | 411 | {0, "0\n", &parse_test[0 * step], 32, 0}, |
Yury Norov | 7eb2e94 | 2020-02-03 17:37:27 -0800 | [diff] [blame] | 412 | {0, "1", &parse_test[1 * step], 32, 0}, |
| 413 | {0, "deadbeef", &parse_test[2 * step], 32, 0}, |
| 414 | {0, "1,0", &parse_test[3 * step], 33, 0}, |
Yury Norov | 809e308 | 2020-02-03 17:37:38 -0800 | [diff] [blame] | 415 | {0, "deadbeef,\n,0,1", &parse_test[2 * step], 96, 0}, |
Yury Norov | 7eb2e94 | 2020-02-03 17:37:27 -0800 | [diff] [blame] | 416 | |
| 417 | {0, "deadbeef,1,0", &parse_test2[0 * 2 * step], 96, 0}, |
| 418 | {0, "baadf00d,deadbeef,1,0", &parse_test2[1 * 2 * step], 128, 0}, |
| 419 | {0, "badf00d,deadbeef,1,0", &parse_test2[2 * 2 * step], 124, 0}, |
Yury Norov | 809e308 | 2020-02-03 17:37:38 -0800 | [diff] [blame] | 420 | {0, "badf00d,deadbeef,1,0", &parse_test2[2 * 2 * step], 124, NO_LEN}, |
| 421 | {0, " badf00d,deadbeef,1,0 ", &parse_test2[2 * 2 * step], 124, 0}, |
| 422 | {0, " , badf00d,deadbeef,1,0 , ", &parse_test2[2 * 2 * step], 124, 0}, |
| 423 | {0, " , badf00d, ,, ,,deadbeef,1,0 , ", &parse_test2[2 * 2 * step], 124, 0}, |
Yury Norov | 7eb2e94 | 2020-02-03 17:37:27 -0800 | [diff] [blame] | 424 | |
| 425 | {-EINVAL, "goodfood,deadbeef,1,0", NULL, 128, 0}, |
| 426 | {-EOVERFLOW, "3,0", NULL, 33, 0}, |
| 427 | {-EOVERFLOW, "123badf00d,deadbeef,1,0", NULL, 128, 0}, |
| 428 | {-EOVERFLOW, "badf00d,deadbeef,1,0", NULL, 90, 0}, |
| 429 | {-EOVERFLOW, "fbadf00d,deadbeef,1,0", NULL, 95, 0}, |
| 430 | {-EOVERFLOW, "badf00d,deadbeef,1,0", NULL, 100, 0}, |
| 431 | #undef step |
| 432 | }; |
| 433 | |
Christoph Hellwig | 81b1e24 | 2020-09-03 16:22:36 +0200 | [diff] [blame] | 434 | static void __init test_bitmap_parse(void) |
Yury Norov | 7eb2e94 | 2020-02-03 17:37:27 -0800 | [diff] [blame] | 435 | { |
| 436 | int i; |
| 437 | int err; |
| 438 | ktime_t time; |
| 439 | DECLARE_BITMAP(bmap, 2048); |
Yury Norov | 7eb2e94 | 2020-02-03 17:37:27 -0800 | [diff] [blame] | 440 | |
| 441 | for (i = 0; i < ARRAY_SIZE(parse_tests); i++) { |
| 442 | struct test_bitmap_parselist test = parse_tests[i]; |
Christoph Hellwig | 81b1e24 | 2020-09-03 16:22:36 +0200 | [diff] [blame] | 443 | size_t len = test.flags & NO_LEN ? UINT_MAX : strlen(test.in); |
Yury Norov | 7eb2e94 | 2020-02-03 17:37:27 -0800 | [diff] [blame] | 444 | |
Christoph Hellwig | 81b1e24 | 2020-09-03 16:22:36 +0200 | [diff] [blame] | 445 | time = ktime_get(); |
| 446 | err = bitmap_parse(test.in, len, bmap, test.nbits); |
| 447 | time = ktime_get() - time; |
Yury Norov | 7eb2e94 | 2020-02-03 17:37:27 -0800 | [diff] [blame] | 448 | |
| 449 | if (err != test.errno) { |
Christoph Hellwig | 81b1e24 | 2020-09-03 16:22:36 +0200 | [diff] [blame] | 450 | pr_err("parse: %d: input is %s, errno is %d, expected %d\n", |
| 451 | i, test.in, err, test.errno); |
Yury Norov | 7eb2e94 | 2020-02-03 17:37:27 -0800 | [diff] [blame] | 452 | continue; |
| 453 | } |
| 454 | |
| 455 | if (!err && test.expected |
| 456 | && !__bitmap_equal(bmap, test.expected, test.nbits)) { |
Christoph Hellwig | 81b1e24 | 2020-09-03 16:22:36 +0200 | [diff] [blame] | 457 | pr_err("parse: %d: input is %s, result is 0x%lx, expected 0x%lx\n", |
| 458 | i, test.in, bmap[0], |
Yury Norov | 7eb2e94 | 2020-02-03 17:37:27 -0800 | [diff] [blame] | 459 | *test.expected); |
| 460 | continue; |
| 461 | } |
| 462 | |
| 463 | if (test.flags & PARSE_TIME) |
Christoph Hellwig | 81b1e24 | 2020-09-03 16:22:36 +0200 | [diff] [blame] | 464 | pr_err("parse: %d: input is '%s' OK, Time: %llu\n", |
| 465 | i, test.in, time); |
Yury Norov | 7eb2e94 | 2020-02-03 17:37:27 -0800 | [diff] [blame] | 466 | } |
| 467 | } |
| 468 | |
Andy Shevchenko | 0ee312e | 2019-12-04 16:53:17 -0800 | [diff] [blame] | 469 | #define EXP1_IN_BITS (sizeof(exp1) * 8) |
Kees Cook | f6f66c1 | 2018-04-10 16:32:54 -0700 | [diff] [blame] | 470 | |
Yury Norov | 3aa5688 | 2018-02-06 15:38:06 -0800 | [diff] [blame] | 471 | static void __init test_bitmap_arr32(void) |
David Decotigny | 5fd003f | 2016-02-19 09:24:00 -0500 | [diff] [blame] | 472 | { |
Kees Cook | f6f66c1 | 2018-04-10 16:32:54 -0700 | [diff] [blame] | 473 | unsigned int nbits, next_bit; |
Andy Shevchenko | a4881d1 | 2019-12-04 16:53:13 -0800 | [diff] [blame] | 474 | u32 arr[EXP1_IN_BITS / 32]; |
| 475 | DECLARE_BITMAP(bmap2, EXP1_IN_BITS); |
David Decotigny | 5fd003f | 2016-02-19 09:24:00 -0500 | [diff] [blame] | 476 | |
Yury Norov | 3aa5688 | 2018-02-06 15:38:06 -0800 | [diff] [blame] | 477 | memset(arr, 0xa5, sizeof(arr)); |
David Decotigny | 5fd003f | 2016-02-19 09:24:00 -0500 | [diff] [blame] | 478 | |
Andy Shevchenko | a4881d1 | 2019-12-04 16:53:13 -0800 | [diff] [blame] | 479 | for (nbits = 0; nbits < EXP1_IN_BITS; ++nbits) { |
Andy Shevchenko | 0ee312e | 2019-12-04 16:53:17 -0800 | [diff] [blame] | 480 | bitmap_to_arr32(arr, exp1, nbits); |
Yury Norov | 3aa5688 | 2018-02-06 15:38:06 -0800 | [diff] [blame] | 481 | bitmap_from_arr32(bmap2, arr, nbits); |
Andy Shevchenko | 0ee312e | 2019-12-04 16:53:17 -0800 | [diff] [blame] | 482 | expect_eq_bitmap(bmap2, exp1, nbits); |
David Decotigny | 5fd003f | 2016-02-19 09:24:00 -0500 | [diff] [blame] | 483 | |
Yury Norov | 3aa5688 | 2018-02-06 15:38:06 -0800 | [diff] [blame] | 484 | next_bit = find_next_bit(bmap2, |
| 485 | round_up(nbits, BITS_PER_LONG), nbits); |
| 486 | if (next_bit < round_up(nbits, BITS_PER_LONG)) |
| 487 | pr_err("bitmap_copy_arr32(nbits == %d:" |
| 488 | " tail is not safely cleared: %d\n", |
| 489 | nbits, next_bit); |
David Decotigny | 5fd003f | 2016-02-19 09:24:00 -0500 | [diff] [blame] | 490 | |
Andy Shevchenko | a4881d1 | 2019-12-04 16:53:13 -0800 | [diff] [blame] | 491 | if (nbits < EXP1_IN_BITS - 32) |
Yury Norov | 3aa5688 | 2018-02-06 15:38:06 -0800 | [diff] [blame] | 492 | expect_eq_uint(arr[DIV_ROUND_UP(nbits, 32)], |
| 493 | 0xa5a5a5a5); |
David Decotigny | 5fd003f | 2016-02-19 09:24:00 -0500 | [diff] [blame] | 494 | } |
| 495 | } |
| 496 | |
Matthew Wilcox | 3cc7812 | 2017-07-10 15:51:26 -0700 | [diff] [blame] | 497 | static void noinline __init test_mem_optimisations(void) |
| 498 | { |
| 499 | DECLARE_BITMAP(bmap1, 1024); |
| 500 | DECLARE_BITMAP(bmap2, 1024); |
| 501 | unsigned int start, nbits; |
| 502 | |
| 503 | for (start = 0; start < 1024; start += 8) { |
Matthew Wilcox | 3cc7812 | 2017-07-10 15:51:26 -0700 | [diff] [blame] | 504 | for (nbits = 0; nbits < 1024 - start; nbits += 8) { |
Matthew Wilcox | 1e3054b | 2018-05-18 16:08:44 -0700 | [diff] [blame] | 505 | memset(bmap1, 0x5a, sizeof(bmap1)); |
| 506 | memset(bmap2, 0x5a, sizeof(bmap2)); |
| 507 | |
Matthew Wilcox | 3cc7812 | 2017-07-10 15:51:26 -0700 | [diff] [blame] | 508 | bitmap_set(bmap1, start, nbits); |
| 509 | __bitmap_set(bmap2, start, nbits); |
Matthew Wilcox | 1e3054b | 2018-05-18 16:08:44 -0700 | [diff] [blame] | 510 | if (!bitmap_equal(bmap1, bmap2, 1024)) { |
Matthew Wilcox | 3cc7812 | 2017-07-10 15:51:26 -0700 | [diff] [blame] | 511 | printk("set not equal %d %d\n", start, nbits); |
Matthew Wilcox | 1e3054b | 2018-05-18 16:08:44 -0700 | [diff] [blame] | 512 | failed_tests++; |
| 513 | } |
| 514 | if (!__bitmap_equal(bmap1, bmap2, 1024)) { |
Matthew Wilcox | 3cc7812 | 2017-07-10 15:51:26 -0700 | [diff] [blame] | 515 | printk("set not __equal %d %d\n", start, nbits); |
Matthew Wilcox | 1e3054b | 2018-05-18 16:08:44 -0700 | [diff] [blame] | 516 | failed_tests++; |
| 517 | } |
Matthew Wilcox | 3cc7812 | 2017-07-10 15:51:26 -0700 | [diff] [blame] | 518 | |
| 519 | bitmap_clear(bmap1, start, nbits); |
| 520 | __bitmap_clear(bmap2, start, nbits); |
Matthew Wilcox | 1e3054b | 2018-05-18 16:08:44 -0700 | [diff] [blame] | 521 | if (!bitmap_equal(bmap1, bmap2, 1024)) { |
Matthew Wilcox | 3cc7812 | 2017-07-10 15:51:26 -0700 | [diff] [blame] | 522 | printk("clear not equal %d %d\n", start, nbits); |
Matthew Wilcox | 1e3054b | 2018-05-18 16:08:44 -0700 | [diff] [blame] | 523 | failed_tests++; |
| 524 | } |
| 525 | if (!__bitmap_equal(bmap1, bmap2, 1024)) { |
Matthew Wilcox | 3cc7812 | 2017-07-10 15:51:26 -0700 | [diff] [blame] | 526 | printk("clear not __equal %d %d\n", start, |
| 527 | nbits); |
Matthew Wilcox | 1e3054b | 2018-05-18 16:08:44 -0700 | [diff] [blame] | 528 | failed_tests++; |
| 529 | } |
Matthew Wilcox | 3cc7812 | 2017-07-10 15:51:26 -0700 | [diff] [blame] | 530 | } |
| 531 | } |
| 532 | } |
| 533 | |
William Breathitt Gray | e4aa168 | 2019-12-04 16:51:01 -0800 | [diff] [blame] | 534 | static const unsigned char clump_exp[] __initconst = { |
| 535 | 0x01, /* 1 bit set */ |
| 536 | 0x02, /* non-edge 1 bit set */ |
| 537 | 0x00, /* zero bits set */ |
| 538 | 0x38, /* 3 bits set across 4-bit boundary */ |
| 539 | 0x38, /* Repeated clump */ |
| 540 | 0x0F, /* 4 bits set */ |
| 541 | 0xFF, /* all bits set */ |
| 542 | 0x05, /* non-adjacent 2 bits set */ |
| 543 | }; |
| 544 | |
| 545 | static void __init test_for_each_set_clump8(void) |
| 546 | { |
| 547 | #define CLUMP_EXP_NUMBITS 64 |
| 548 | DECLARE_BITMAP(bits, CLUMP_EXP_NUMBITS); |
| 549 | unsigned int start; |
| 550 | unsigned long clump; |
| 551 | |
| 552 | /* set bitmap to test case */ |
| 553 | bitmap_zero(bits, CLUMP_EXP_NUMBITS); |
| 554 | bitmap_set(bits, 0, 1); /* 0x01 */ |
| 555 | bitmap_set(bits, 9, 1); /* 0x02 */ |
| 556 | bitmap_set(bits, 27, 3); /* 0x28 */ |
| 557 | bitmap_set(bits, 35, 3); /* 0x28 */ |
| 558 | bitmap_set(bits, 40, 4); /* 0x0F */ |
| 559 | bitmap_set(bits, 48, 8); /* 0xFF */ |
| 560 | bitmap_set(bits, 56, 1); /* 0x05 - part 1 */ |
| 561 | bitmap_set(bits, 58, 1); /* 0x05 - part 2 */ |
| 562 | |
| 563 | for_each_set_clump8(start, clump, bits, CLUMP_EXP_NUMBITS) |
| 564 | expect_eq_clump8(start, CLUMP_EXP_NUMBITS, clump_exp, &clump); |
| 565 | } |
| 566 | |
Stefano Brivio | bcb32a1 | 2020-08-11 18:34:32 -0700 | [diff] [blame] | 567 | struct test_bitmap_cut { |
| 568 | unsigned int first; |
| 569 | unsigned int cut; |
| 570 | unsigned int nbits; |
| 571 | unsigned long in[4]; |
| 572 | unsigned long expected[4]; |
| 573 | }; |
| 574 | |
| 575 | static struct test_bitmap_cut test_cut[] = { |
| 576 | { 0, 0, 8, { 0x0000000aUL, }, { 0x0000000aUL, }, }, |
| 577 | { 0, 0, 32, { 0xdadadeadUL, }, { 0xdadadeadUL, }, }, |
| 578 | { 0, 3, 8, { 0x000000aaUL, }, { 0x00000015UL, }, }, |
| 579 | { 3, 3, 8, { 0x000000aaUL, }, { 0x00000012UL, }, }, |
| 580 | { 0, 1, 32, { 0xa5a5a5a5UL, }, { 0x52d2d2d2UL, }, }, |
| 581 | { 0, 8, 32, { 0xdeadc0deUL, }, { 0x00deadc0UL, }, }, |
| 582 | { 1, 1, 32, { 0x5a5a5a5aUL, }, { 0x2d2d2d2cUL, }, }, |
| 583 | { 0, 15, 32, { 0xa5a5a5a5UL, }, { 0x00014b4bUL, }, }, |
| 584 | { 0, 16, 32, { 0xa5a5a5a5UL, }, { 0x0000a5a5UL, }, }, |
| 585 | { 15, 15, 32, { 0xa5a5a5a5UL, }, { 0x000125a5UL, }, }, |
| 586 | { 15, 16, 32, { 0xa5a5a5a5UL, }, { 0x0000a5a5UL, }, }, |
| 587 | { 16, 15, 32, { 0xa5a5a5a5UL, }, { 0x0001a5a5UL, }, }, |
| 588 | |
| 589 | { BITS_PER_LONG, BITS_PER_LONG, BITS_PER_LONG, |
| 590 | { 0xa5a5a5a5UL, 0xa5a5a5a5UL, }, |
| 591 | { 0xa5a5a5a5UL, 0xa5a5a5a5UL, }, |
| 592 | }, |
| 593 | { 1, BITS_PER_LONG - 1, BITS_PER_LONG, |
| 594 | { 0xa5a5a5a5UL, 0xa5a5a5a5UL, }, |
| 595 | { 0x00000001UL, 0x00000001UL, }, |
| 596 | }, |
| 597 | |
| 598 | { 0, BITS_PER_LONG * 2, BITS_PER_LONG * 2 + 1, |
| 599 | { 0xa5a5a5a5UL, 0x00000001UL, 0x00000001UL, 0x00000001UL }, |
| 600 | { 0x00000001UL, }, |
| 601 | }, |
| 602 | { 16, BITS_PER_LONG * 2 + 1, BITS_PER_LONG * 2 + 1 + 16, |
| 603 | { 0x0000ffffUL, 0x5a5a5a5aUL, 0x5a5a5a5aUL, 0x5a5a5a5aUL }, |
| 604 | { 0x2d2dffffUL, }, |
| 605 | }, |
| 606 | }; |
| 607 | |
| 608 | static void __init test_bitmap_cut(void) |
| 609 | { |
| 610 | unsigned long b[5], *in = &b[1], *out = &b[0]; /* Partial overlap */ |
| 611 | int i; |
| 612 | |
| 613 | for (i = 0; i < ARRAY_SIZE(test_cut); i++) { |
| 614 | struct test_bitmap_cut *t = &test_cut[i]; |
| 615 | |
| 616 | memcpy(in, t->in, sizeof(t->in)); |
| 617 | |
| 618 | bitmap_cut(out, in, t->first, t->cut, t->nbits); |
| 619 | |
| 620 | expect_eq_bitmap(t->expected, out, t->nbits); |
| 621 | } |
| 622 | } |
| 623 | |
Tobin C. Harding | 6b1a4d5 | 2019-04-05 12:58:57 +1100 | [diff] [blame] | 624 | static void __init selftest(void) |
David Decotigny | 5fd003f | 2016-02-19 09:24:00 -0500 | [diff] [blame] | 625 | { |
Andy Shevchenko | ee3527bd | 2018-02-06 15:38:10 -0800 | [diff] [blame] | 626 | test_zero_clear(); |
Andy Shevchenko | 978f369 | 2018-02-06 15:38:13 -0800 | [diff] [blame] | 627 | test_fill_set(); |
Andy Shevchenko | fe81814 | 2018-02-06 15:38:17 -0800 | [diff] [blame] | 628 | test_copy(); |
Andy Shevchenko | 30544ed | 2019-12-04 16:53:26 -0800 | [diff] [blame] | 629 | test_replace(); |
Yury Norov | 3aa5688 | 2018-02-06 15:38:06 -0800 | [diff] [blame] | 630 | test_bitmap_arr32(); |
Yury Norov | 7eb2e94 | 2020-02-03 17:37:27 -0800 | [diff] [blame] | 631 | test_bitmap_parse(); |
Yury Norov | 6df0d46 | 2017-09-08 16:15:38 -0700 | [diff] [blame] | 632 | test_bitmap_parselist(); |
Matthew Wilcox | 3cc7812 | 2017-07-10 15:51:26 -0700 | [diff] [blame] | 633 | test_mem_optimisations(); |
William Breathitt Gray | e4aa168 | 2019-12-04 16:51:01 -0800 | [diff] [blame] | 634 | test_for_each_set_clump8(); |
Stefano Brivio | bcb32a1 | 2020-08-11 18:34:32 -0700 | [diff] [blame] | 635 | test_bitmap_cut(); |
David Decotigny | 5fd003f | 2016-02-19 09:24:00 -0500 | [diff] [blame] | 636 | } |
| 637 | |
Tobin C. Harding | 6b1a4d5 | 2019-04-05 12:58:57 +1100 | [diff] [blame] | 638 | KSTM_MODULE_LOADERS(test_bitmap); |
David Decotigny | 5fd003f | 2016-02-19 09:24:00 -0500 | [diff] [blame] | 639 | MODULE_AUTHOR("david decotigny <david.decotigny@googlers.com>"); |
| 640 | MODULE_LICENSE("GPL"); |