From mboxrd@z Thu Jan 1 00:00:00 1970 From: Simon Glass Date: Sat, 30 Jan 2021 20:32:21 -0700 Subject: [PATCH v2 13/40] test: Move do_autoprobe() to test_pre_run() In-Reply-To: <20210131033248.1502385-1-sjg@chromium.org> References: <20210131033248.1502385-1-sjg@chromium.org> Message-ID: <20210131033248.1502385-14-sjg@chromium.org> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Move this step over to the pre-run function. Signed-off-by: Simon Glass --- (no changes since v1) test/dm/test-dm.c | 17 ----------------- test/test-main.c | 18 ++++++++++++++++++ 2 files changed, 18 insertions(+), 17 deletions(-) diff --git a/test/dm/test-dm.c b/test/dm/test-dm.c index 3f9ce3d6fa8..3f76a1dc2c2 100644 --- a/test/dm/test-dm.c +++ b/test/dm/test-dm.c @@ -42,21 +42,6 @@ static int dm_test_init(struct unit_test_state *uts, bool of_live) return 0; } -/* 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; -} - static int dm_test_destroy(struct unit_test_state *uts) { int id; @@ -90,8 +75,6 @@ static int dm_do_test(struct unit_test_state *uts, struct unit_test *test, uts->start = mallinfo(); if (test->flags & UT_TESTF_SCAN_PDATA) ut_assertok(dm_scan_plat(false)); - if (test->flags & UT_TESTF_PROBE_TEST) - ut_assertok(do_autoprobe(uts)); ut_assertok(test_pre_run(uts, test)); diff --git a/test/test-main.c b/test/test-main.c index a971fe0e9c8..bd2f08a2b42 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)); -- 2.30.0.365.g02bc693789-goog