aboutsummaryrefslogtreecommitdiff
path: root/include/test
diff options
context:
space:
mode:
authorSimon Glass2021-03-07 17:34:48 -0700
committerTom Rini2021-03-12 09:57:29 -0500
commitd002a2764418fa8f054d94789e7814f60294318f (patch)
treed1c2a10f1ebb69d7101d5bdfc15aa540d10af0ed /include/test
parent1c7217511cd9a050183402b56c0371e4f9720bea (diff)
test: Create pre/post-run functions
Split out the test preparation into a separation function before expanding it. Add a post-run function as well, currently empty. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'include/test')
-rw-r--r--include/test/ut.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/include/test/ut.h b/include/test/ut.h
index 88e75ab791c..7cb5e10f3af 100644
--- a/include/test/ut.h
+++ b/include/test/ut.h
@@ -357,6 +357,26 @@ void ut_silence_console(struct unit_test_state *uts);
void ut_unsilence_console(struct unit_test_state *uts);
/**
+ * test_pre_run() - Handle any preparation needed to run a test
+ *
+ * @uts: Test state
+ * @test: Test to prepare for
+ * @return 0 if OK, -EAGAIN to skip this test since some required feature is not
+ * available, other -ve on error (meaning that testing cannot likely
+ * continue)
+ */
+int test_pre_run(struct unit_test_state *uts, struct unit_test *test);
+
+/**
+ * test_post_run() - Handle cleaning up after a test
+ *
+ * @uts: Test state
+ * @test: Test to clean up after
+ * @return 0 if OK, -ve on error (meaning that testing cannot likely continue)
+ */
+int test_post_run(struct unit_test_state *uts, struct unit_test *test);
+
+/**
* ut_run_tests() - Run a set of tests
*
* This runs the tests, handling any preparation and clean-up needed. It prints