Chris Wilson | 50f0033 | 2016-12-22 08:36:09 +0000 | [diff] [blame^] | 1 | /* |
| 2 | * Test cases for the drm_mm range manager |
| 3 | */ |
| 4 | |
| 5 | #define pr_fmt(fmt) "drm_mm: " fmt |
| 6 | |
| 7 | #include <linux/module.h> |
| 8 | #include <linux/prime_numbers.h> |
| 9 | #include <linux/slab.h> |
| 10 | #include <linux/random.h> |
| 11 | #include <linux/vmalloc.h> |
| 12 | |
| 13 | #include <drm/drm_mm.h> |
| 14 | |
| 15 | #include "../lib/drm_random.h" |
| 16 | |
| 17 | #define TESTS "drm_mm_selftests.h" |
| 18 | #include "drm_selftest.h" |
| 19 | |
| 20 | static unsigned int random_seed; |
| 21 | static unsigned int max_iterations = 8192; |
| 22 | static unsigned int max_prime = 128; |
| 23 | |
| 24 | static int igt_sanitycheck(void *ignored) |
| 25 | { |
| 26 | pr_info("%s - ok!\n", __func__); |
| 27 | return 0; |
| 28 | } |
| 29 | |
| 30 | #include "drm_selftest.c" |
| 31 | |
| 32 | static int __init test_drm_mm_init(void) |
| 33 | { |
| 34 | int err; |
| 35 | |
| 36 | while (!random_seed) |
| 37 | random_seed = get_random_int(); |
| 38 | |
| 39 | pr_info("Testing DRM range manger (struct drm_mm), with random_seed=0x%x max_iterations=%u max_prime=%u\n", |
| 40 | random_seed, max_iterations, max_prime); |
| 41 | err = run_selftests(selftests, ARRAY_SIZE(selftests), NULL); |
| 42 | |
| 43 | return err > 0 ? 0 : err; |
| 44 | } |
| 45 | |
| 46 | static void __exit test_drm_mm_exit(void) |
| 47 | { |
| 48 | } |
| 49 | |
| 50 | module_init(test_drm_mm_init); |
| 51 | module_exit(test_drm_mm_exit); |
| 52 | |
| 53 | module_param(random_seed, uint, 0400); |
| 54 | module_param(max_iterations, uint, 0400); |
| 55 | module_param(max_prime, uint, 0400); |
| 56 | |
| 57 | MODULE_AUTHOR("Intel Corporation"); |
| 58 | MODULE_LICENSE("GPL"); |