test: Move console silencing to test_pre_run()
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 <sjg@chromium.org>
This commit is contained in:
@@ -66,7 +66,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,
|
static int dm_do_test(struct unit_test_state *uts, struct unit_test *test,
|
||||||
bool of_live)
|
bool of_live)
|
||||||
{
|
{
|
||||||
struct sandbox_state *state = state_get_current();
|
|
||||||
const char *fname = strrchr(test->file, '/') + 1;
|
const char *fname = strrchr(test->file, '/') + 1;
|
||||||
|
|
||||||
printf("Test: %s: %s%s\n", test->name, fname,
|
printf("Test: %s: %s%s\n", test->name, fname,
|
||||||
@@ -75,13 +74,10 @@ static int dm_do_test(struct unit_test_state *uts, struct unit_test *test,
|
|||||||
|
|
||||||
ut_assertok(test_pre_run(uts, test));
|
ut_assertok(test_pre_run(uts, test));
|
||||||
|
|
||||||
if (!state->show_test_output)
|
|
||||||
gd->flags |= GD_FLG_SILENT;
|
|
||||||
test->func(uts);
|
test->func(uts);
|
||||||
|
|
||||||
ut_assertok(test_post_run(uts, test));
|
ut_assertok(test_post_run(uts, test));
|
||||||
|
|
||||||
gd->flags &= ~(GD_FLG_SILENT | GD_FLG_RECORD);
|
|
||||||
state_set_skip_delays(false);
|
state_set_skip_delays(false);
|
||||||
|
|
||||||
ut_assertok(dm_test_destroy(uts));
|
ut_assertok(dm_test_destroy(uts));
|
||||||
|
|||||||
@@ -50,13 +50,14 @@ int test_pre_run(struct unit_test_state *uts, struct unit_test *test)
|
|||||||
return -EAGAIN;
|
return -EAGAIN;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
ut_silence_console(uts);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int test_post_run(struct unit_test_state *uts, struct unit_test *test)
|
int test_post_run(struct unit_test_state *uts, struct unit_test *test)
|
||||||
{
|
{
|
||||||
gd->flags &= ~GD_FLG_RECORD;
|
ut_unsilence_console(uts);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user