summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2021-03-07 17:34:56 -0700
committerTom Rini <trini@konsulko.com>2021-03-12 09:57:30 -0500
commit72b524cf426697e764c9c63611d0f6743f50f0f5 (patch)
tree7496d35d4a59e8e3bb34d35dc918c4d61c956565 /include
parent47ec3ede4efe214b4debdaf845d6eb622154f405 (diff)
downloadu-boot-72b524cf426697e764c9c63611d0f6743f50f0f5.tar.gz
u-boot-72b524cf426697e764c9c63611d0f6743f50f0f5.tar.bz2
u-boot-72b524cf426697e764c9c63611d0f6743f50f0f5.zip
test: Handle driver model reinit in test_pre_run()
For driver model tests we want to reinit the data structures so that everything is in a known state before the test runs. This avoids one test changing something that breaks a subsequent tests. Move the call for this into test_pre_run(). Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'include')
-rw-r--r--include/test/test.h2
-rw-r--r--include/test/ut.h10
2 files changed, 12 insertions, 0 deletions
diff --git a/include/test/test.h b/include/test/test.h
index d282cb2362..6997568cc0 100644
--- a/include/test/test.h
+++ b/include/test/test.h
@@ -15,6 +15,7 @@
* @fail_count: Number of tests that failed
* @start: Store the starting mallinfo when doing leak test
* @priv: A pointer to some other info some suites want to track
+ * @of_live: true to use livetree if available, false to use flattree
* @of_root: Record of the livetree root node (used for setting up tests)
* @expect_str: Temporary string used to hold expected string value
* @actual_str: Temporary string used to hold actual string value
@@ -24,6 +25,7 @@ struct unit_test_state {
struct mallinfo start;
void *priv;
struct device_node *of_root;
+ bool of_live;
char expect_str[256];
char actual_str[256];
};
diff --git a/include/test/ut.h b/include/test/ut.h
index e5ec18e60b..6e56ca99c3 100644
--- a/include/test/ut.h
+++ b/include/test/ut.h
@@ -388,6 +388,16 @@ 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);
/**
+ * dm_test_init() - Get ready to run a driver model test
+ *
+ * This clears out the driver model data structures. For sandbox it resets the
+ * state structure.
+ *
+ * @uts: Test state
+ */
+int dm_test_init(struct unit_test_state *uts);
+
+/**
* ut_run_tests() - Run a set of tests
*
* This runs the tests, handling any preparation and clean-up needed. It prints