diff options
author | Vic Yang <victoryang@chromium.org> | 2013-09-04 10:14:43 +0800 |
---|---|---|
committer | chrome-internal-fetch <chrome-internal-fetch@google.com> | 2013-09-05 07:20:46 +0000 |
commit | 6c3be20539a3b336e2c1c83181ea6f9b0c1506d2 (patch) | |
tree | 9d4ba5f42126078e6244916017ad51624f1c474a /include/test_util.h | |
parent | 30136468c0352a2bcce1a948d9d5e9e4851b294d (diff) | |
download | chrome-ec-6c3be20539a3b336e2c1c83181ea6f9b0c1506d2.tar.gz |
Add multi-step test support
We already have a multi-step test. Let's move it to test_util.c so that
upcoming tests can also use it.
BUG=chrome-os-partner:19235
TEST=Pass all tests
BRANCH=None
Change-Id: I6b7a036297f3b4b2778687488d1dc5b5bb4fe255
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/167950
Diffstat (limited to 'include/test_util.h')
-rw-r--r-- | include/test_util.h | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/include/test_util.h b/include/test_util.h index fb333deb16..367a602ae1 100644 --- a/include/test_util.h +++ b/include/test_util.h @@ -62,6 +62,22 @@ return EC_ERROR_UNKNOWN; \ } while (0) +/* Mutlistep test states */ +enum test_state_t { + TEST_STATE_STEP_1 = 0, + TEST_STATE_STEP_2, + TEST_STATE_STEP_3, + TEST_STATE_STEP_4, + TEST_STATE_STEP_5, + TEST_STATE_STEP_6, + TEST_STATE_STEP_7, + TEST_STATE_STEP_8, + TEST_STATE_STEP_9, + TEST_STATE_PASSED, + TEST_STATE_FAILED, +}; +#define TEST_STATE_MASK(x) (1 << (x)) + /* Hooks gcov_flush() for test coverage report generation */ void register_test_end_hook(void); @@ -113,4 +129,34 @@ const char *test_get_captured_console(void); */ void emulator_flush(void); +/* + * Entry point of multi-step test. + * + * Depending on current test state, this function runs the corresponding + * test step. This function should be called in a dedicated task on every + * reboot. Also, run_test() is responsible for starting the test by kicking + * that task. + */ +void test_run_multistep(void); + +/* + * A function that runs the test step specified in 'state'. This function + * should be defined by all multi-step tests. + * + * @param state TEST_STATE_MASK(x) indicating the step to run. + */ +void test_run_step(uint32_t state); + +/* Get the current test state */ +uint32_t test_get_state(void); + +/* + * Multistep test clean up. If a multi-step test has this function defined, + * it will be called on test end. (i.e. when test passes or fails.) + */ +void test_clean_up(void); + +/* Set the next step and reboot */ +void test_reboot_to_next_step(enum test_state_t step); + #endif /* __CROS_EC_TEST_UTIL_H */ |