diff options
author | Aaron Massey <aaronmassey@google.com> | 2022-09-06 09:14:26 -0600 |
---|---|---|
committer | Chromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2022-09-08 23:14:24 +0000 |
commit | cca2696f57c77335934b701ffaace6f757a8962d (patch) | |
tree | d8d9d14c0fb0e5618c8b9410377ee7ba060fe559 /zephyr | |
parent | 8144a533deda65a104883c6e88ecc01c9053b54b (diff) | |
download | chrome-ec-cca2696f57c77335934b701ffaace6f757a8962d.tar.gz |
test: mkbp_fifo_depth_update
Verify updating mkbp_fifo queue depth.
BRANCH=none
BUG=b:244476858
TEST=./twister --clobber -s zephyr/test/drivers/drivers.mkbp -i
Signed-off-by: Aaron Massey <aaronmassey@google.com>
Change-Id: I222122af86fb19ff8fcfd1ab05c00a1f3cbb5b4c
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3873117
Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com>
Diffstat (limited to 'zephyr')
-rw-r--r-- | zephyr/test/drivers/mkbp/src/mkbp_fifo.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/zephyr/test/drivers/mkbp/src/mkbp_fifo.c b/zephyr/test/drivers/mkbp/src/mkbp_fifo.c index 5fe50edb9b..072d313888 100644 --- a/zephyr/test/drivers/mkbp/src/mkbp_fifo.c +++ b/zephyr/test/drivers/mkbp/src/mkbp_fifo.c @@ -37,11 +37,13 @@ static void mkbp_fifo_before(void *data) mkbp_clear_fifo(); memset(fixture->input_event_data, 0, MAX_EVENT_DATA_SIZE); + mkbp_fifo_depth_update(FIFO_DEPTH); } static void mkbp_fifo_after(void *data) { mkbp_clear_fifo(); + mkbp_fifo_depth_update(FIFO_DEPTH); } static void fill_array_with_incrementing_numbers(int8_t *dst, int size) @@ -74,5 +76,27 @@ ZTEST_F(mkbp_fifo, test_fifo_add_keyboard_key_matrix_event) zassert_equal(out[KEY_MATRIX_EVENT_DATA_SIZE], 0, NULL); } +ZTEST_F(mkbp_fifo, test_fifo_depth_update) +{ + uint8_t out[KEY_MATRIX_EVENT_DATA_SIZE + 1]; + uint8_t new_depth = 0; + + mkbp_fifo_depth_update(new_depth); + fill_array_with_incrementing_numbers(fixture->input_event_data, + MAX_EVENT_DATA_SIZE); + zassert_equal(EC_ERROR_OVERFLOW, + mkbp_fifo_add(EC_MKBP_EVENT_KEY_MATRIX, + fixture->input_event_data), + NULL); + zassert_equal(-1, /* get_next_event explicitly returns -1 */ + mkbp_fifo_get_next_event(out, EC_MKBP_EVENT_KEY_MATRIX), + NULL); + + mkbp_fifo_depth_update(FIFO_DEPTH); + zassert_ok(mkbp_fifo_add(EC_MKBP_EVENT_KEY_MATRIX, + fixture->input_event_data), + NULL); +} + ZTEST_SUITE(mkbp_fifo, drivers_predicate_post_main, mkbp_fifo_setup, mkbp_fifo_before, mkbp_fifo_after, NULL); |