summaryrefslogtreecommitdiff
path: root/test/test-main.c
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2021-03-07 17:34:51 -0700
committerTom Rini <trini@konsulko.com>2021-03-12 09:57:29 -0500
commit4b8b27e3d2f0825c58f9982b36cf941ad007cbda (patch)
tree4472a2e24e2feb5a91b0b5db836190ae0cb19387 /test/test-main.c
parentd8ed234b29d070b980a5335e72ebd26cb923ae66 (diff)
downloadu-boot-4b8b27e3d2f0825c58f9982b36cf941ad007cbda.tar.gz
test: Move do_autoprobe() to test_pre_run()
Move this step over to the pre-run function. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'test/test-main.c')
-rw-r--r--test/test-main.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/test-main.c b/test/test-main.c
index a971fe0e9c..bd2f08a2b4 100644
--- a/test/test-main.c
+++ b/test/test-main.c
@@ -13,12 +13,30 @@
DECLARE_GLOBAL_DATA_PTR;
+/* Ensure all the test devices are probed */
+static int do_autoprobe(struct unit_test_state *uts)
+{
+ struct udevice *dev;
+ int ret;
+
+ /* Scanning the uclass is enough to probe all the devices */
+ for (ret = uclass_first_device(UCLASS_TEST, &dev);
+ dev;
+ ret = uclass_next_device(&dev))
+ ;
+
+ return ret;
+}
+
int test_pre_run(struct unit_test_state *uts, struct unit_test *test)
{
/* DM tests have already done this */
if (!(test->flags & UT_TESTF_DM))
uts->start = mallinfo();
+ if (test->flags & UT_TESTF_PROBE_TEST)
+ ut_assertok(do_autoprobe(uts));
+
if (!CONFIG_IS_ENABLED(OF_PLATDATA) &&
(test->flags & UT_TESTF_SCAN_FDT))
ut_assertok(dm_extended_scan(false));