diff options
author | Simon Glass <sjg@chromium.org> | 2022-08-01 07:58:45 -0600 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2022-09-02 16:21:44 -0400 |
commit | ea94d053e19ee3341301cf999a8dd78e37b83cca (patch) | |
tree | 94bfae9af3d2f92815effcd7351db40577a32af5 /test/dm | |
parent | e033c180d0327e8fa791660ae26cdebd5e400153 (diff) | |
download | u-boot-ea94d053e19ee3341301cf999a8dd78e37b83cca.zip u-boot-ea94d053e19ee3341301cf999a8dd78e37b83cca.tar.gz u-boot-ea94d053e19ee3341301cf999a8dd78e37b83cca.tar.bz2 |
test: Allow running tests multiple times
Some tests can have race conditions which are hard to detect on a single
one. Add a way to run tests more than once, to help with this.
Each individual test is run the requested number of times before moving
to the next test. If any runs failed, a message is shown.
This is most useful when running a single test, since running all tests
multiple times can take a while.
Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'test/dm')
-rw-r--r-- | test/dm/test-dm.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/test/dm/test-dm.c b/test/dm/test-dm.c index f5cda81..eb35813 100644 --- a/test/dm/test-dm.c +++ b/test/dm/test-dm.c @@ -29,13 +29,14 @@ DECLARE_GLOBAL_DATA_PTR; * "fdt_pre_reloc"), or NULL to run all * Return: 0 if all tests passed, 1 if not */ -static int dm_test_run(const char *test_name) +static int dm_test_run(const char *test_name, int runs_per_text) { struct unit_test *tests = UNIT_TEST_SUITE_START(dm_test); const int n_ents = UNIT_TEST_SUITE_COUNT(dm_test); int ret; - ret = ut_run_list("driver model", "dm_test_", tests, n_ents, test_name); + ret = ut_run_list("driver model", "dm_test_", tests, n_ents, test_name, + runs_per_text); return ret ? CMD_RET_FAILURE : 0; } @@ -43,9 +44,15 @@ static int dm_test_run(const char *test_name) int do_ut_dm(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) { const char *test_name = NULL; + int runs_per_text = 1; + if (argc > 1 && !strncmp("-r", argv[1], 2)) { + runs_per_text = dectoul(argv[1] + 2, NULL); + argv++; + argc++; + } if (argc > 1) test_name = argv[1]; - return dm_test_run(test_name); + return dm_test_run(test_name, runs_per_text); } |