1 #include <linux/sort.h>
2 #include <linux/slab.h>
3 #include <linux/init.h>
6 * A simple boot-time regression test
12 static int __init cmpint(const void *a, const void *b)
14 return *(int *)a - *(int *)b;
17 static int __init test_sort_init(void)
19 int *a, i, r = 1, err = -ENOMEM;
21 a = kmalloc_array(TEST_LEN, sizeof(*a), GFP_KERNEL);
25 for (i = 0; i < TEST_LEN; i++) {
26 r = (r * 725861) % 6599;
30 sort(a, TEST_LEN, sizeof(*a), cmpint, NULL);
33 for (i = 0; i < TEST_LEN-1; i++)
35 pr_err("test has failed\n");
39 pr_info("test passed\n");
44 subsys_initcall(test_sort_init);