summaryrefslogtreecommitdiff
path: root/test/dm/test-dm.c
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 /test/dm/test-dm.c
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 'test/dm/test-dm.c')
-rw-r--r--test/dm/test-dm.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/test/dm/test-dm.c b/test/dm/test-dm.c
index 826b64565e..cdaf27bf98 100644
--- a/test/dm/test-dm.c
+++ b/test/dm/test-dm.c
@@ -20,8 +20,6 @@
DECLARE_GLOBAL_DATA_PTR;
-struct unit_test_state global_dm_test_state;
-
static bool test_matches(const char *test_name, const char *find_name)
{
if (!find_name)
@@ -44,7 +42,7 @@ int dm_test_run(const char *test_name)
{
struct unit_test *tests = ll_entry_start(struct unit_test, dm_test);
const int n_ents = ll_entry_count(struct unit_test, dm_test);
- struct unit_test_state *uts = &global_dm_test_state;
+ struct unit_test_state uts_s = { .fail_count = 0 }, *uts = &uts_s;
struct unit_test *test;
int found;