All of lore.kernel.org
 help / color / mirror / Atom feed
From: Simon Glass <sjg@chromium.org>
To: u-boot@lists.denx.de
Subject: [PATCH v4 19/42] test: Move delay skipping to test_pre_run()
Date: Thu,  4 Mar 2021 06:50:55 -0700	[thread overview]
Message-ID: <20210304135118.643277-19-sjg@chromium.org> (raw)
In-Reply-To: <20210304135118.643277-1-sjg@chromium.org>

This allows delays to be skipped in sandbox tests. Move it to the
common pre-init function.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

(no changes since v1)

 include/test/ut.h | 11 +++++++++++
 test/dm/test-dm.c |  2 --
 test/test-main.c  |  2 ++
 test/ut.c         |  7 +++++++
 4 files changed, 20 insertions(+), 2 deletions(-)

diff --git a/include/test/ut.h b/include/test/ut.h
index 7cb5e10f3af..e5ec18e60b0 100644
--- a/include/test/ut.h
+++ b/include/test/ut.h
@@ -356,6 +356,17 @@ void ut_silence_console(struct unit_test_state *uts);
  */
 void ut_unsilence_console(struct unit_test_state *uts);
 
+/**
+ * ut_set_skip_delays() - Sets whether delays should be skipped
+ *
+ * Normally functions like mdelay() cause U-Boot to wait for a while. This
+ * allows all such delays to be skipped on sandbox, to speed up tests
+ *
+ * @uts: Test state (in case in future we want to keep state here)
+ * @skip_delays: true to skip delays, false to process them normally
+ */
+void ut_set_skip_delays(struct unit_test_state *uts, bool skip_delays);
+
 /**
  * test_pre_run() - Handle any preparation needed to run a test
  *
diff --git a/test/dm/test-dm.c b/test/dm/test-dm.c
index fdd35f663e4..569ffbbad93 100644
--- a/test/dm/test-dm.c
+++ b/test/dm/test-dm.c
@@ -78,8 +78,6 @@ static int dm_do_test(struct unit_test_state *uts, struct unit_test *test,
 
 	ut_assertok(test_post_run(uts, test));
 
-	state_set_skip_delays(false);
-
 	ut_assertok(dm_test_destroy(uts));
 
 	return 0;
diff --git a/test/test-main.c b/test/test-main.c
index e273777b6e2..6f0d32f7e27 100644
--- a/test/test-main.c
+++ b/test/test-main.c
@@ -30,6 +30,8 @@ static int do_autoprobe(struct unit_test_state *uts)
 
 int test_pre_run(struct unit_test_state *uts, struct unit_test *test)
 {
+	ut_set_skip_delays(uts, false);
+
 	uts->start = mallinfo();
 
 	if (test->flags & UT_TESTF_SCAN_PDATA)
diff --git a/test/ut.c b/test/ut.c
index 7328338731c..ea0af153e4a 100644
--- a/test/ut.c
+++ b/test/ut.c
@@ -133,3 +133,10 @@ void ut_unsilence_console(struct unit_test_state *uts)
 {
 	gd->flags &= ~(GD_FLG_SILENT | GD_FLG_RECORD);
 }
+
+void ut_set_skip_delays(struct unit_test_state *uts, bool skip_delays)
+{
+#ifdef CONFIG_SANDBOX
+	state_set_skip_delays(skip_delays);
+#endif
+}
-- 
2.30.1.766.gb4fecdf3b7-goog

  parent reply	other threads:[~2021-03-04 13:50 UTC|newest]

Thread overview: 54+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-04 13:50 [PATCH v4 00/42] test: Refactor tests to have a single test runner Simon Glass
2021-03-04 13:50 ` [PATCH v4 01/42] dm: core: Fix allocation of empty of-platdata Simon Glass
2021-03-04 13:50 ` [PATCH v4 02/42] doc: Tidy up testing section Simon Glass
2021-03-04 15:32   ` Heinrich Schuchardt
2021-03-04 13:50 ` [PATCH v4 03/42] doc: Document make tcheck Simon Glass
2021-03-04 13:50 ` [PATCH v4 04/42] sandbox: Drop the 'starting...' message unless testing Simon Glass
2021-03-04 15:38   ` Heinrich Schuchardt
2021-03-04 13:50 ` [PATCH v4 05/42] test: Re-enable test_ofplatdata Simon Glass
2021-03-04 13:50 ` [PATCH v4 06/42] doc: Explain how to run tests without pytest Simon Glass
2021-03-04 16:13   ` Heinrich Schuchardt
2021-03-07 22:49     ` Simon Glass
2021-03-04 13:50 ` [PATCH v4 07/42] doc: Document how sandbox_spl_tests are run Simon Glass
2021-03-04 13:50 ` [PATCH v4 08/42] test: Correct setexpr test prefix Simon Glass
2021-03-04 13:50 ` [PATCH v4 09/42] test: Mark all driver model tests with a flag Simon Glass
2021-03-04 13:50 ` [PATCH v4 10/42] test: Rename test-main.c to test-dm.c Simon Glass
2021-03-04 13:50 ` [PATCH v4 11/42] test: Add an overall test runner Simon Glass
2021-03-04 13:50 ` [PATCH v4 12/42] test: Create pre/post-run functions Simon Glass
2021-03-04 13:50 ` [PATCH v4 13/42] test: Call test_pre/post_run() from driver model tests Simon Glass
2021-03-04 13:50 ` [PATCH v4 14/42] test: Move dm_extended_scan() to test_pre_run() Simon Glass
2021-03-04 13:50 ` [PATCH v4 15/42] test: Move do_autoprobe() " Simon Glass
2021-03-04 13:50 ` [PATCH v4 16/42] test: Move dm_scan_plat() " Simon Glass
2021-03-04 13:50 ` [PATCH v4 17/42] test: Drop mallinfo() work-around Simon Glass
2021-03-04 13:50 ` [PATCH v4 18/42] test: Move console silencing to test_pre_run() Simon Glass
2021-03-04 13:50 ` Simon Glass [this message]
2021-03-04 13:50 ` [PATCH v4 20/42] test: Handle driver model reinit in test_pre_run() Simon Glass
2021-03-04 13:50 ` [PATCH v4 21/42] test: Drop struct dm_test_state Simon Glass
2021-03-04 13:50 ` [PATCH v4 22/42] test: Move dm_test_init() into test-main.c Simon Glass
2021-03-04 13:50 ` [PATCH v4 23/42] test: Move dm_test_destroy() " Simon Glass
2021-03-04 13:51 ` [PATCH v4 24/42] test: Move test running into a separate function Simon Glass
2021-03-04 13:51 ` [PATCH v4 25/42] test: Use ut_run_test() to run driver model tests Simon Glass
2021-03-04 13:51 ` [PATCH v4 26/42] test: Drop dm_do_test() Simon Glass
2021-03-04 13:51 ` [PATCH v4 27/42] test: Add ut_run_test_live_flat() to run tests twice Simon Glass
2021-03-04 13:51 ` [PATCH v4 28/42] test: Use a local variable for test state Simon Glass
2021-03-04 13:51 ` [PATCH v4 29/42] test: Run driver-model tests using ut_run_list() Simon Glass
2021-03-04 13:51 ` [PATCH v4 30/42] test: Use return values in dm_test_run() Simon Glass
2021-03-04 13:51 ` [PATCH v4 31/42] test: Move the devicetree check into ut_run_list() Simon Glass
2021-03-04 13:51 ` [PATCH v4 32/42] test: Move restoring of driver model state to ut_run_list() Simon Glass
2021-03-04 13:51 ` [PATCH v4 33/42] test: log: Rename log main test file to log_ut.c Simon Glass
2021-03-04 17:18   ` Heinrich Schuchardt
2021-03-04 13:51 ` [PATCH v4 34/42] test: Add a macros for finding tests in linker_lists Simon Glass
2021-03-04 13:51 ` [PATCH v4 35/42] test: Rename all linker lists to have a ut_ prefix Simon Glass
2021-03-04 15:28   ` Heinrich Schuchardt
2021-03-05  4:09     ` Simon Glass
2021-03-04 13:51 ` [PATCH v4 36/42] test: Allow SPL to run any available test Simon Glass
2021-03-04 13:51 ` [PATCH v4 37/42] sandbox: Update os_find_u_boot() to find the .img file Simon Glass
2021-03-04 13:51 ` [PATCH v4 38/42] spl: Convert spl_fit to work with sandbox Simon Glass
2021-03-04 13:51 ` [PATCH v4 39/42] doc: Move coccinelle into its own section Simon Glass
2021-03-04 17:23   ` Heinrich Schuchardt
2021-03-07 22:18     ` Simon Glass
2021-03-04 13:51 ` [PATCH v4 40/42] spl: test: Add a test for spl_load_simple_fit() Simon Glass
2021-03-04 13:51 ` [PATCH v4 41/42] test: sandbox: Move sandbox test docs into doc/develop Simon Glass
2021-03-04 13:51 ` [PATCH v4 42/42] doc: Explain briefly how to write new tests Simon Glass
2021-03-04 18:14   ` Heinrich Schuchardt
2021-03-07 23:21     ` Simon Glass

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=20210304135118.643277-19-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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.