From mboxrd@z Thu Jan 1 00:00:00 1970 From: Simon Glass Date: Sat, 30 Jan 2021 20:32:24 -0700 Subject: [PATCH v2 16/40] test: Move console silencing to test_pre_run() In-Reply-To: <20210131033248.1502385-1-sjg@chromium.org> References: <20210131033248.1502385-1-sjg@chromium.org> Message-ID: <20210131033248.1502385-17-sjg@chromium.org> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de We already have a function for silencing the console during tests. Use this from test_pre_run() and drop this code from the driver model tests. Signed-off-by: Simon Glass --- (no changes since v1) test/dm/test-dm.c | 4 ---- test/test-main.c | 3 ++- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/test/dm/test-dm.c b/test/dm/test-dm.c index 57785e503ff..3ffbc382358 100644 --- a/test/dm/test-dm.c +++ b/test/dm/test-dm.c @@ -65,7 +65,6 @@ static int dm_test_destroy(struct unit_test_state *uts) static int dm_do_test(struct unit_test_state *uts, struct unit_test *test, bool of_live) { - struct sandbox_state *state = state_get_current(); const char *fname = strrchr(test->file, '/') + 1; printf("Test: %s: %s%s\n", test->name, fname, @@ -74,13 +73,10 @@ static int dm_do_test(struct unit_test_state *uts, struct unit_test *test, ut_assertok(test_pre_run(uts, test)); - if (!state->show_test_output) - gd->flags |= GD_FLG_SILENT; test->func(uts); ut_assertok(test_post_run(uts, test)); - gd->flags &= ~(GD_FLG_SILENT | GD_FLG_RECORD); state_set_skip_delays(false); ut_assertok(dm_test_destroy(uts)); diff --git a/test/test-main.c b/test/test-main.c index db0d82e36c3..e273777b6e2 100644 --- a/test/test-main.c +++ b/test/test-main.c @@ -50,13 +50,14 @@ int test_pre_run(struct unit_test_state *uts, struct unit_test *test) return -EAGAIN; } } + ut_silence_console(uts); return 0; } int test_post_run(struct unit_test_state *uts, struct unit_test *test) { - gd->flags &= ~GD_FLG_RECORD; + ut_unsilence_console(uts); return 0; } -- 2.30.0.365.g02bc693789-goog