Skip to content

Commit ce28ab1

Browse files
Grillo-0mairacanal
authored andcommitted
drm/tests: Add back seed value information
As reported by Michał, the drm_mm and drm_buddy unit tests lost the printk with seed value after they were refactored into KUnit. Add kunit_info with seed value information to assure reproducibility. Reported-by: Michał Winiarski <[email protected]> Signed-off-by: Arthur Grillo <[email protected]> Signed-off-by: Maíra Canal <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent 444bbba commit ce28ab1

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

drivers/gpu/drm/tests/drm_buddy_test.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -726,11 +726,13 @@ static void drm_test_buddy_alloc_limit(struct kunit *test)
726726
drm_buddy_fini(&mm);
727727
}
728728

729-
static int drm_buddy_init_test(struct kunit *test)
729+
static int drm_buddy_suite_init(struct kunit_suite *suite)
730730
{
731731
while (!random_seed)
732732
random_seed = get_random_u32();
733733

734+
kunit_info(suite, "Testing DRM buddy manager, with random_seed=0x%x\n", random_seed);
735+
734736
return 0;
735737
}
736738

@@ -746,7 +748,7 @@ static struct kunit_case drm_buddy_tests[] = {
746748

747749
static struct kunit_suite drm_buddy_test_suite = {
748750
.name = "drm_buddy",
749-
.init = drm_buddy_init_test,
751+
.suite_init = drm_buddy_suite_init,
750752
.test_cases = drm_buddy_tests,
751753
};
752754

drivers/gpu/drm/tests/drm_mm_test.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2209,11 +2209,15 @@ static void drm_test_mm_color_evict_range(struct kunit *test)
22092209
vfree(nodes);
22102210
}
22112211

2212-
static int drm_mm_init_test(struct kunit *test)
2212+
static int drm_mm_suite_init(struct kunit_suite *suite)
22132213
{
22142214
while (!random_seed)
22152215
random_seed = get_random_u32();
22162216

2217+
kunit_info(suite,
2218+
"Testing DRM range manager, with random_seed=0x%x max_iterations=%u max_prime=%u\n",
2219+
random_seed, max_iterations, max_prime);
2220+
22172221
return 0;
22182222
}
22192223

@@ -2246,7 +2250,7 @@ static struct kunit_case drm_mm_tests[] = {
22462250

22472251
static struct kunit_suite drm_mm_test_suite = {
22482252
.name = "drm_mm",
2249-
.init = drm_mm_init_test,
2253+
.suite_init = drm_mm_suite_init,
22502254
.test_cases = drm_mm_tests,
22512255
};
22522256

0 commit comments

Comments
 (0)