summaryrefslogtreecommitdiffstats
path: root/test/test-main.c
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2021-03-07 17:34:49 -0700
committerTom Rini <trini@konsulko.com>2021-03-12 09:57:29 -0500
commit30a0d2064d593bf357282071a938816de876c64b (patch)
tree1ffba2c09c279767da8cbffcfa917069abe25654 /test/test-main.c
parentd002a2764418fa8f054d94789e7814f60294318f (diff)
downloadu-boot-30a0d2064d593bf357282071a938816de876c64b.tar.gz
u-boot-30a0d2064d593bf357282071a938816de876c64b.tar.xz
u-boot-30a0d2064d593bf357282071a938816de876c64b.zip
test: Call test_pre/post_run() from driver model tests
Ultimately we want to get rid of the special driver model test init and use test_pre_run() and test_post_run() for all tests. As a first step, use those function to handle console recording. For now we need a special case for setting uts->start, but that wil go away once all init is in one place. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'test/test-main.c')
-rw-r--r--test/test-main.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/test/test-main.c b/test/test-main.c
index 7961fd8aa3..9c60009474 100644
--- a/test/test-main.c
+++ b/test/test-main.c
@@ -8,9 +8,13 @@
#include <console.h>
#include <test/test.h>
+DECLARE_GLOBAL_DATA_PTR;
+
int test_pre_run(struct unit_test_state *uts, struct unit_test *test)
{
- uts->start = mallinfo();
+ /* DM tests have already done this */
+ if (!(test->flags & UT_TESTF_DM))
+ uts->start = mallinfo();
if (test->flags & UT_TESTF_CONSOLE_REC) {
int ret = console_record_reset_enable();
@@ -26,6 +30,8 @@ int test_pre_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;
+
return 0;
}