[Concept,14/33] test: video: Reselect default font at start of video_silence

Message ID 20260416023021.626949-15-sjg@u-boot.org
State New
Headers
Series Fix memory leaks and test pollution in sandbox tests |

Commit Message

Simon Glass April 16, 2026, 2:29 a.m. UTC
  From: Simon Glass <sjg@chromium.org>

dm_test_video_silence() compares the framebuffer against an exact
compressed byte count, which only matches when the vidconsole is using
its default font. If an earlier test (for example expo or cedit)
switched the font and did not restore it, the messages that this test
writes rasterise to different pixels and the byte count no longer
matches.

Select the default font before clearing and writing, so the test does
its work with a known font regardless of what state a preceding test
left behind.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 test/dm/video.c | 6 ++++++
 1 file changed, 6 insertions(+)
  

Patch

diff --git a/test/dm/video.c b/test/dm/video.c
index 18d257e39f4..a0608ebc23f 100644
--- a/test/dm/video.c
+++ b/test/dm/video.c
@@ -1214,6 +1214,12 @@  static int dm_test_video_silence(struct unit_test_state *uts)
 	sdev = stdio_get_by_name("vidconsole");
 	ut_assertnonnull(sdev);
 	con = sdev->priv;
+	/*
+	 * Restore the default font so an earlier test that left a different
+	 * one selected does not change the pixels written by the messages
+	 * below.
+	 */
+	ut_assertok(vidconsole_select_font(con, NULL, NULL, 0));
 	ut_assertok(vidconsole_clear_and_reset(con));
 	ut_unsilence_console(uts);