summaryrefslogtreecommitdiff
path: root/include/test
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2021-03-08 03:35:04 +0300
committerTom Rini <trini@konsulko.com>2021-03-12 17:57:30 +0300
commitfe806861a98b4ad524d070c6d7b9d20fd475ec6f (patch)
tree59df6d3172d2ec6758deb6ee14fa872be5837b6a /include/test
parentd2281bb09b0ebf580f8efe23c84c240a2f3ea9bb (diff)
downloadu-boot-fe806861a98b4ad524d070c6d7b9d20fd475ec6f.tar.xz
test: Use a local variable for test state
At present we use a global test state for all driver-model tests. Make use of a local struct like we do with the other tests. To make this work, add functions to get and set this state. When a test starts, the state is set (so it can be used in the test). When a test finishes, the state is unset, so it cannot be used by mistake. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'include/test')
-rw-r--r--include/test/ut.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/include/test/ut.h b/include/test/ut.h
index d06bc5089b..bed0e6eb5f 100644
--- a/include/test/ut.h
+++ b/include/test/ut.h
@@ -368,6 +368,20 @@ void ut_unsilence_console(struct unit_test_state *uts);
void ut_set_skip_delays(struct unit_test_state *uts, bool skip_delays);
/**
+ * test_get_state() - Get the active test state
+ *
+ * @return the currently active test state, or NULL if none
+ */
+struct unit_test_state *test_get_state(void);
+
+/**
+ * test_set_state() - Set the active test state
+ *
+ * @uts: Test state to use as currently active test state, or NULL if none
+ */
+void test_set_state(struct unit_test_state *uts);
+
+/**
* ut_run_test_live_flat() - Run a test with both live and flat tree
*
* This calls ut_run_test() with livetree enabled, which is the standard setup