From: Simon Glass <sjg@chromium.org>
To: u-boot@lists.denx.de
Subject: [PATCH 2/3] test: Allow tests to run on any board
Date: Thu, 25 Mar 2021 10:44:33 +1300 [thread overview]
Message-ID: <20210324214434.46584-2-sjg@chromium.org> (raw)
In-Reply-To: <20210324214434.46584-1-sjg@chromium.org>
Due to a recent change, tests are limited to running on sandbox only.
Correct this so that any architecture can run them.
Signed-off-by: Simon Glass <sjg@chromium.org>
Reported-by: Sean Anderson <seanga2@gmail.com>
Fixes: c79705ea938 ("test: Move dm_test_init() into test-main.c")
---
include/test/test.h | 9 +++++++++
test/test-main.c | 5 ++---
2 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/include/test/test.h b/include/test/test.h
index 0b124edd601..bf7d785d8ed 100644
--- a/include/test/test.h
+++ b/include/test/test.h
@@ -124,4 +124,13 @@ enum {
*/
struct udevice *testbus_get_clear_removed(void);
+static inline void arch_reset_for_test(void)
+{
+#ifdef CONFIG_SANDBOX
+#include <asm/state.h>
+
+ state_reset_for_test(state_get_current());
+#endif
+}
+
#endif /* __TEST_TEST_H */
diff --git a/test/test-main.c b/test/test-main.c
index e1b49e091ab..201e39d8b2a 100644
--- a/test/test-main.c
+++ b/test/test-main.c
@@ -7,7 +7,6 @@
#include <common.h>
#include <console.h>
#include <dm.h>
-#include <asm/state.h>
#include <dm/root.h>
#include <dm/test.h>
#include <dm/uclass-internal.h>
@@ -46,9 +45,9 @@ static int dm_test_pre_run(struct unit_test_state *uts)
uts->force_fail_alloc = false;
uts->skip_post_probe = false;
gd->dm_root = NULL;
- if (!CONFIG_IS_ENABLED(OF_PLATDATA))
+ if (IS_ENABLED(CONFIG_UT_DM) && !CONFIG_IS_ENABLED(OF_PLATDATA))
memset(dm_testdrv_op_count, '\0', sizeof(dm_testdrv_op_count));
- state_reset_for_test(state_get_current());
+ arch_reset_for_test();
/* Determine whether to make the live tree available */
gd_set_of_root(of_live ? uts->of_root : NULL);
--
2.31.0.291.g576ba9dcdaf-goog
next prev parent reply other threads:[~2021-03-24 21:44 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20210324214450epcas1p135757e7a696b0f939cce55d691fcb6de@epcas1p1.samsung.com>
2021-03-24 21:44 ` [PATCH 1/3] samsung: exynos: Convert SROMC interface to a driver Simon Glass
2021-03-24 21:44 ` Simon Glass [this message]
2021-03-26 1:46 ` [PATCH 2/3] test: Allow tests to run on any board Sean Anderson
2021-04-06 4:34 ` Simon Glass
2021-03-24 21:44 ` [PATCH 3/3] snow: Enable unit tests Simon Glass
2021-03-25 22:09 ` Jaehoon Chung
2021-04-23 8:32 ` Minkyu Kang
2021-03-25 22:08 ` [PATCH 1/3] samsung: exynos: Convert SROMC interface to a driver Jaehoon Chung
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210324214434.46584-2-sjg@chromium.org \
--to=sjg@chromium.org \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox