diff options
author | Tomasz Michalec <tm@semihalf.com> | 2022-07-15 12:46:34 +0200 |
---|---|---|
committer | Chromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2022-07-19 08:01:37 +0000 |
commit | 29791a4f18afed00ee11c76febc48808bccfbda7 (patch) | |
tree | 12b34bd3cd3fe51095b4b44c876299a9ba9c31d0 | |
parent | 944a72069d8efd7f2d53ea3a1dd32d0dcae011f9 (diff) | |
download | chrome-ec-29791a4f18afed00ee11c76febc48808bccfbda7.tar.gz |
zephyr: tests: Fix bb_retimer test conflict with PD task
Some bb_retimer tests require to set a PD data role. When the PD task is
running, it is possible that the data role changes after the test sets
it. To prevent that bb_retimer tests that require specific PD data role
are run before tasks are started.
BUG=b:238880607
TEST=zmake -D test test-drivers
BRANCH=None
Signed-off-by: Tomasz Michalec <tm@semihalf.com>
Change-Id: Ia5f59a5c63f5089eeb4984672a786b96b0845877
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3763902
Tested-by: Tomasz Michalec <tmichalec@google.com>
Reviewed-by: Al Semjonovs <asemjonovs@google.com>
Commit-Queue: Tomasz Michalec <tmichalec@google.com>
-rw-r--r-- | zephyr/test/drivers/src/bb_retimer.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/zephyr/test/drivers/src/bb_retimer.c b/zephyr/test/drivers/src/bb_retimer.c index 97dc621948..a9db2eb052 100644 --- a/zephyr/test/drivers/src/bb_retimer.c +++ b/zephyr/test/drivers/src/bb_retimer.c @@ -40,7 +40,7 @@ ZTEST_USER(bb_retimer, test_bb_is_fw_update_capable) } /** Test is retimer fw update capable function. */ -ZTEST_USER(bb_retimer, test_bb_set_state) +ZTEST_USER(bb_retimer_no_tasks, test_bb_set_state) { struct pd_discovery *disc; uint32_t conn, exp_conn; @@ -67,6 +67,7 @@ ZTEST_USER(bb_retimer, test_bb_set_state) /* Set UFP role for whole test */ tc_set_data_role(USBC_PORT_C1, PD_ROLE_UFP); + zassume_equal(PD_ROLE_UFP, pd_get_data_role(USBC_PORT_C1), NULL); /* Test none mode */ bb_emul_set_reg(emul, BB_RETIMER_REG_CONNECTION_STATE, 0x12144678); @@ -194,7 +195,7 @@ ZTEST_USER(bb_retimer, test_bb_set_state) } /** Test setting different options for DFP role */ -ZTEST_USER(bb_retimer, test_bb_set_dfp_state) +ZTEST_USER(bb_retimer_no_tasks, test_bb_set_dfp_state) { union tbt_mode_resp_device device_resp; union tbt_mode_resp_cable cable_resp; @@ -208,6 +209,7 @@ ZTEST_USER(bb_retimer, test_bb_set_dfp_state) set_test_runner_tid(); tc_set_data_role(USBC_PORT_C1, PD_ROLE_DFP); + zassume_equal(PD_ROLE_DFP, pd_get_data_role(USBC_PORT_C1), NULL); /* Test PD mux none mode with DFP should clear all bits in state */ bb_emul_set_reg(emul, BB_RETIMER_REG_CONNECTION_STATE, 0x12144678); @@ -569,4 +571,7 @@ ZTEST_USER(bb_retimer, test_bb_console_cmd) zassert_equal(EC_ERROR_PARAM4, rv, "rv=%d", rv); } +ZTEST_SUITE(bb_retimer_no_tasks, drivers_predicate_pre_main, NULL, NULL, NULL, + NULL); + ZTEST_SUITE(bb_retimer, drivers_predicate_post_main, NULL, NULL, NULL, NULL); |