[PATCH 08/19] test: Silenece the echo and print tests

Simon Glass sjg at chromium.org
Mon Mar 15 06:11:13 CET 2021


These tests current produce unwanted output on sandbox. Use the correct
functions to controller console output, to avoid this.

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

 test/cmd/test_echo.c  | 3 ++-
 test/lib/test_print.c | 8 ++++++--
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/test/cmd/test_echo.c b/test/cmd/test_echo.c
index aa5cebc4e78..9d60d7d1a0b 100644
--- a/test/cmd/test_echo.c
+++ b/test/cmd/test_echo.c
@@ -44,9 +44,10 @@ static int lib_test_hush_echo(struct unit_test_state *uts)
 	int i;
 
 	for (i = 0; i < ARRAY_SIZE(echo_data); ++i) {
+		ut_silence_console(uts);
 		console_record_reset_enable();
 		ut_assertok(run_command(echo_data[i].cmd, 0));
-		gd->flags &= ~GD_FLG_RECORD;
+		ut_unsilence_console(uts);
 		console_record_readline(uts->actual_str,
 					sizeof(uts->actual_str));
 		ut_asserteq_str(echo_data[i].expected, uts->actual_str);
diff --git a/test/lib/test_print.c b/test/lib/test_print.c
index 12972f1bcd6..a60a5a51f12 100644
--- a/test/lib/test_print.c
+++ b/test/lib/test_print.c
@@ -18,12 +18,14 @@ DECLARE_GLOBAL_DATA_PTR;
 static int test_print_freq(struct unit_test_state *uts,
 			   uint64_t freq, char *expected)
 {
+	ut_silence_console(uts);
 	console_record_reset_enable();
 	print_freq(freq, ";\n");
-	gd->flags &= ~GD_FLG_RECORD;
+	ut_unsilence_console(uts);
 	console_record_readline(uts->actual_str, sizeof(uts->actual_str));
 	ut_asserteq_str(expected, uts->actual_str);
 	ut_assertok(ut_check_console_end(uts));
+
 	return 0;
 }
 
@@ -46,12 +48,14 @@ LIB_TEST(lib_test_print_freq, 0);
 static int test_print_size(struct unit_test_state *uts,
 			   uint64_t freq, char *expected)
 {
+	ut_silence_console(uts);
 	console_record_reset_enable();
 	print_size(freq, ";\n");
-	gd->flags &= ~GD_FLG_RECORD;
+	ut_unsilence_console(uts);
 	console_record_readline(uts->actual_str, sizeof(uts->actual_str));
 	ut_asserteq_str(expected, uts->actual_str);
 	ut_assertok(ut_check_console_end(uts));
+
 	return 0;
 }
 
-- 
2.31.0.rc2.261.g7f71774620-goog



More information about the U-Boot mailing list