summaryrefslogtreecommitdiffstats
path: root/include/test
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2021-03-07 17:35:00 -0700
committerTom Rini <trini@konsulko.com>2021-03-12 09:57:30 -0500
commit99a88fe1bd98ad800ec0460e3174c2a846a991fe (patch)
tree8ab083a1a48489090d3f315dbda4a55f5a251329 /include/test
parente77615d3a78f43793f27cd4dbe04efc6522a05ef (diff)
downloadu-boot-99a88fe1bd98ad800ec0460e3174c2a846a991fe.tar.gz
u-boot-99a88fe1bd98ad800ec0460e3174c2a846a991fe.tar.xz
u-boot-99a88fe1bd98ad800ec0460e3174c2a846a991fe.zip
test: Move test running into a separate function
Add a function to handle the preparation for running a test and the post-test clean-up. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'include/test')
-rw-r--r--include/test/ut.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/include/test/ut.h b/include/test/ut.h
index 4e0aba9f70..98f699cbba 100644
--- a/include/test/ut.h
+++ b/include/test/ut.h
@@ -387,6 +387,22 @@ int test_pre_run(struct unit_test_state *uts, struct unit_test *test);
*/
int test_post_run(struct unit_test_state *uts, struct unit_test *test);
+/**
+ * ut_run_test() - Run a single test
+ *
+ * This runs the test, handling any preparation and clean-up needed. It prints
+ * the name of each test before running it.
+ *
+ * @uts: Test state to update. The caller should ensure that this is zeroed for
+ * the first call to this function. On exit, @uts->fail_count is
+ * incremented by the number of failures (0, one hopes)
+ * @test: Test to run
+ * @name: Name of test, possibly skipping a prefix that should not be displayed
+ * @return 0 if all tests passed, -EAGAIN if the test should be skipped, -1 if
+ * any failed
+ */
+int ut_run_test(struct unit_test_state *uts, struct unit_test *test,
+ const char *name);
/**
* ut_run_tests() - Run a set of tests