diff options
Diffstat (limited to 'lib/test_xarray.c')
-rw-r--r-- | lib/test_xarray.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/lib/test_xarray.c b/lib/test_xarray.c index dc02eff562b8..6e0212a60b08 100644 --- a/lib/test_xarray.c +++ b/lib/test_xarray.c | |||
@@ -1184,6 +1184,35 @@ static noinline void check_store_range(struct xarray *xa) | |||
1184 | } | 1184 | } |
1185 | } | 1185 | } |
1186 | 1186 | ||
1187 | static void check_align_1(struct xarray *xa, char *name) | ||
1188 | { | ||
1189 | int i; | ||
1190 | unsigned int id; | ||
1191 | unsigned long index; | ||
1192 | void *entry; | ||
1193 | |||
1194 | for (i = 0; i < 8; i++) { | ||
1195 | id = 0; | ||
1196 | XA_BUG_ON(xa, xa_alloc(xa, &id, UINT_MAX, name + i, GFP_KERNEL) | ||
1197 | != 0); | ||
1198 | XA_BUG_ON(xa, id != i); | ||
1199 | } | ||
1200 | xa_for_each(xa, index, entry) | ||
1201 | XA_BUG_ON(xa, xa_is_err(entry)); | ||
1202 | xa_destroy(xa); | ||
1203 | } | ||
1204 | |||
1205 | static noinline void check_align(struct xarray *xa) | ||
1206 | { | ||
1207 | char name[] = "Motorola 68000"; | ||
1208 | |||
1209 | check_align_1(xa, name); | ||
1210 | check_align_1(xa, name + 1); | ||
1211 | check_align_1(xa, name + 2); | ||
1212 | check_align_1(xa, name + 3); | ||
1213 | // check_align_2(xa, name); | ||
1214 | } | ||
1215 | |||
1187 | static LIST_HEAD(shadow_nodes); | 1216 | static LIST_HEAD(shadow_nodes); |
1188 | 1217 | ||
1189 | static void test_update_node(struct xa_node *node) | 1218 | static void test_update_node(struct xa_node *node) |
@@ -1333,6 +1362,7 @@ static int xarray_checks(void) | |||
1333 | check_create_range(&array); | 1362 | check_create_range(&array); |
1334 | check_store_range(&array); | 1363 | check_store_range(&array); |
1335 | check_store_iter(&array); | 1364 | check_store_iter(&array); |
1365 | check_align(&xa0); | ||
1336 | 1366 | ||
1337 | check_workingset(&array, 0); | 1367 | check_workingset(&array, 0); |
1338 | check_workingset(&array, 64); | 1368 | check_workingset(&array, 64); |