Skip to contentSkip to conversation

drm/tests: Add back seed value information

PATCH Superseded Arthur Grillo 2 participants 2 messages Oct 27, 2022

Subsystems (2)

v2 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 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 where refactored into KUnit. This patch add back this important information to assure reproducibility and convert them to the KUnit API.

---
v1->v2: https://lore.kernel.org/all/[email protected]/
- Correct compilation issues
- Change tags order
- Remove useless line change
- Write commit message in imperative form
- Remove redundant message part
- Correct some grammars nits
- Correct checkpatch issues

---
 drivers/gpu/drm/tests/drm_buddy_test.c | 4 ++++
 drivers/gpu/drm/tests/drm_mm_test.c    | 4 ++++
 2 files changed, 8 insertions(+)
drivers/gpu/drm/tests/drm_buddy_test.c +4 -0
index 62f69589a72d..258137e9c047 100644
@@ -731,6 +731,10 @@ static int drm_buddy_init_test(struct kunit *test)
 	while (!random_seed)
 		random_seed = get_random_u32();
 
+	kunit_info(test,
+		   "Testing DRM buddy manager, with random_seed=0x%x\n",
+		   random_seed);
+
 	return 0;
 }
 
drivers/gpu/drm/tests/drm_mm_test.c +4 -0
index c4b66eeae203..bec006e044a4 100644
@@ -2214,6 +2214,10 @@ static int drm_mm_init_test(struct kunit *test)
 	while (!random_seed)
 		random_seed = get_random_u32();
 
+	kunit_info(test,
+		   "Testing DRM range manager, with random_seed=0x%x max_iterations=%u max_prime=%u\n",
+		   random_seed, max_iterations, max_prime);
+
 	return 0;
 }
 
Signature · 1 line
2.37.3
#1 lore raw

Hi Arthur,

Quoted 4 lines · Arthur Grillo

As reported by Michał the drm_mm and drm_buddy unit tests lost the printk with seed value after they where refactored into KUnit. This patch add back this important information to assure reproducibility and convert them to the KUnit API.

Some grammar nits:
- s/where/were
- s/add/adds

Moreover, you could write the commit message as André indicated, that is: in imperative form.

Quoted 23 lines

---
v1->v2: https://lore.kernel.org/all/[email protected]/
- Correct compilation issues
- Change tags order
- Remove useless line change
- Write commit message in imperative form
- Remove redundant message part
- Correct some grammars nits
- Correct checkpatch issues

---
  drivers/gpu/drm/tests/drm_buddy_test.c | 4 ++++
  drivers/gpu/drm/tests/drm_mm_test.c    | 4 ++++
  2 files changed, 8 insertions(+)
drivers/gpu/drm/tests/drm_buddy_test.c +0 -0
index 62f69589a72d..258137e9c047 100644

drivers/gpu/drm/tests/drm_buddy_test.c static int drm_buddy_init_test(struct kunit *test) · line 740

Quoted 10 lines
drivers/gpu/drm/tests/drm_buddy_test.c +4 -0
@@ -731,6 +731,10 @@ static int drm_buddy_init_test(struct kunit *test)
  	while (!random_seed)
  		random_seed = get_random_u32();
 
+	kunit_info(test,
+		   "Testing DRM buddy manager, with random_seed=0x%x\n",
+		   random_seed);
+
  	return 0;
  }
 

As I was checking the log, I realized that the random_seed only needs to be generated by the start of the test suite, so this drm_buddy_init_test could be a suite_init function, instead of an init function. This way the random_seed will be generated by the start of the suite and the log will be printed just once.

drivers/gpu/drm/tests/drm_mm_test.c static int drm_mm_init_test(struct kunit *test) · line 2220

Quoted 12 lines
drivers/gpu/drm/tests/drm_mm_test.c +4 -0
index c4b66eeae203..bec006e044a4 100644
@@ -2214,6 +2214,10 @@ static int drm_mm_init_test(struct kunit *test)
  	while (!random_seed)
  		random_seed = get_random_u32();
 
+	kunit_info(test,
+		   "Testing DRM range manager, with random_seed=0x%x max_iterations=%u max_prime=%u\n",
+		   random_seed, max_iterations, max_prime);
+

Same here.

Best Regards,
- Maíra Canal

Quoted 3 lines
drivers/gpu/drm/tests/drm_mm_test.c +0 -0
  	return 0;
  }