mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-11-10 15:14:43 +00:00
test: Move delay skipping to test_pre_run()
This allows delays to be skipped in sandbox tests. Move it to the common pre-init function. Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
parent
7452471287
commit
47ec3ede4e
4 changed files with 20 additions and 2 deletions
|
@ -356,6 +356,17 @@ void ut_silence_console(struct unit_test_state *uts);
|
||||||
*/
|
*/
|
||||||
void ut_unsilence_console(struct unit_test_state *uts);
|
void ut_unsilence_console(struct unit_test_state *uts);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ut_set_skip_delays() - Sets whether delays should be skipped
|
||||||
|
*
|
||||||
|
* Normally functions like mdelay() cause U-Boot to wait for a while. This
|
||||||
|
* allows all such delays to be skipped on sandbox, to speed up tests
|
||||||
|
*
|
||||||
|
* @uts: Test state (in case in future we want to keep state here)
|
||||||
|
* @skip_delays: true to skip delays, false to process them normally
|
||||||
|
*/
|
||||||
|
void ut_set_skip_delays(struct unit_test_state *uts, bool skip_delays);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* test_pre_run() - Handle any preparation needed to run a test
|
* test_pre_run() - Handle any preparation needed to run a test
|
||||||
*
|
*
|
||||||
|
|
|
@ -78,8 +78,6 @@ static int dm_do_test(struct unit_test_state *uts, struct unit_test *test,
|
||||||
|
|
||||||
ut_assertok(test_post_run(uts, test));
|
ut_assertok(test_post_run(uts, test));
|
||||||
|
|
||||||
state_set_skip_delays(false);
|
|
||||||
|
|
||||||
ut_assertok(dm_test_destroy(uts));
|
ut_assertok(dm_test_destroy(uts));
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -30,6 +30,8 @@ static int do_autoprobe(struct unit_test_state *uts)
|
||||||
|
|
||||||
int test_pre_run(struct unit_test_state *uts, struct unit_test *test)
|
int test_pre_run(struct unit_test_state *uts, struct unit_test *test)
|
||||||
{
|
{
|
||||||
|
ut_set_skip_delays(uts, false);
|
||||||
|
|
||||||
uts->start = mallinfo();
|
uts->start = mallinfo();
|
||||||
|
|
||||||
if (test->flags & UT_TESTF_SCAN_PDATA)
|
if (test->flags & UT_TESTF_SCAN_PDATA)
|
||||||
|
|
|
@ -133,3 +133,10 @@ void ut_unsilence_console(struct unit_test_state *uts)
|
||||||
{
|
{
|
||||||
gd->flags &= ~(GD_FLG_SILENT | GD_FLG_RECORD);
|
gd->flags &= ~(GD_FLG_SILENT | GD_FLG_RECORD);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ut_set_skip_delays(struct unit_test_state *uts, bool skip_delays)
|
||||||
|
{
|
||||||
|
#ifdef CONFIG_SANDBOX
|
||||||
|
state_set_skip_delays(skip_delays);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue