test: Add ut_run_test_live_flat() to run tests twice

Driver model tests are generally run twice, once with livetree enable and
again with it disabled. Add a function to handle this and call it from the
driver model test runner.

Make ut_run_test() private since it is not used outside test-main.c now.

Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
Simon Glass
2021-03-07 17:35:03 -07:00
committed by Tom Rini
parent c169d542bb
commit d2281bb09b
3 changed files with 73 additions and 44 deletions

View File

@@ -368,10 +368,13 @@ void ut_unsilence_console(struct unit_test_state *uts);
void ut_set_skip_delays(struct unit_test_state *uts, bool skip_delays);
/**
* ut_run_test() - Run a single test
* ut_run_test_live_flat() - Run a test with both live and flat tree
*
* This runs the test, handling any preparation and clean-up needed. It prints
* the name of each test before running it.
* This calls ut_run_test() with livetree enabled, which is the standard setup
* for runnig tests. Then, for driver model test, it calls it again with
* livetree disabled. This allows checking of flattree being used when OF_LIVE
* is enabled, as is the case in U-Boot proper before relocation, as well as in
* SPL.
*
* @uts: Test state to update. The caller should ensure that this is zeroed for
* the first call to this function. On exit, @uts->fail_count is
@@ -381,8 +384,8 @@ void ut_set_skip_delays(struct unit_test_state *uts, bool skip_delays);
* @return 0 if all tests passed, -EAGAIN if the test should be skipped, -1 if
* any failed
*/
int ut_run_test(struct unit_test_state *uts, struct unit_test *test,
const char *name);
int ut_run_test_live_flat(struct unit_test_state *uts, struct unit_test *test,
const char *name);
/**
* ut_run_tests() - Run a set of tests