summaryrefslogtreecommitdiff
path: root/include/test
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2022-08-01 07:58:45 -0600
committerTom Rini <trini@konsulko.com>2022-09-02 16:21:44 -0400
commitea94d053e19ee3341301cf999a8dd78e37b83cca (patch)
tree94bfae9af3d2f92815effcd7351db40577a32af5 /include/test
parente033c180d0327e8fa791660ae26cdebd5e400153 (diff)
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 'include/test')
-rw-r--r--include/test/test.h2
-rw-r--r--include/test/ut.h3
2 files changed, 4 insertions, 1 deletions
diff --git a/include/test/test.h b/include/test/test.h
index c888d68b1e..2b68331b54 100644
--- a/include/test/test.h
+++ b/include/test/test.h
@@ -20,6 +20,7 @@
* @testdev: Test device
* @force_fail_alloc: Force all memory allocs to fail
* @skip_post_probe: Skip uclass post-probe processing
+ * @runs_per_test: Number of times to run each test (typically 1)
* @expect_str: Temporary string used to hold expected string value
* @actual_str: Temporary string used to hold actual string value
*/
@@ -32,6 +33,7 @@ struct unit_test_state {
struct udevice *testdev;
int force_fail_alloc;
int skip_post_probe;
+ int runs_per_test;
char expect_str[512];
char actual_str[512];
};
diff --git a/include/test/ut.h b/include/test/ut.h
index 18740f5807..f7d1d18f7c 100644
--- a/include/test/ut.h
+++ b/include/test/ut.h
@@ -403,9 +403,10 @@ void test_set_state(struct unit_test_state *uts);
* @count: Number of tests to run
* @select_name: Name of a single test to run (from the list provided). If NULL
* then all tests are run
+ * @runs_per_test: Number of times to run each test (typically 1)
* Return: 0 if all tests passed, -1 if any failed
*/
int ut_run_list(const char *name, const char *prefix, struct unit_test *tests,
- int count, const char *select_name);
+ int count, const char *select_name, int runs_per_test);
#endif