1
0
mirror of https://xff.cz/git/u-boot/ synced 2025-10-18 08:23:24 +02:00

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>
This commit is contained in:
Simon Glass
2022-08-01 07:58:45 -06:00
committed by Tom Rini
parent e033c180d0
commit ea94d053e1
7 changed files with 60 additions and 10 deletions

View File

@@ -18,10 +18,17 @@ int cmd_ut_category(const char *name, const char *prefix,
struct unit_test *tests, int n_ents,
int argc, char *const argv[])
{
int runs_per_text = 1;
int ret;
if (argc > 1 && !strncmp("-r", argv[1], 2)) {
runs_per_text = dectoul(argv[1] + 2, NULL);
argv++;
argc++;
}
ret = ut_run_list(name, prefix, tests, n_ents,
argc > 1 ? argv[1] : NULL);
argc > 1 ? argv[1] : NULL, runs_per_text);
return ret ? CMD_RET_FAILURE : 0;
}
@@ -168,7 +175,8 @@ static char ut_help_text[] =
#ifdef CONFIG_CMD_LOADM
"ut loadm [test-name]- test of parameters and load memory blob\n"
#endif
;
"All commands accept an optional [-r<runs>] flag before [test-name], to\n"
"run each test multiple times (<runs> is in decimal)";
#endif /* CONFIG_SYS_LONGHELP */
U_BOOT_CMD(