diff options
author | Jett Rink <jettrink@chromium.org> | 2020-07-09 14:45:56 -0600 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-07-10 22:21:55 +0000 |
commit | 0f713b36be38449cddea2196d1a135d7bdcfb82a (patch) | |
tree | 039710aee8c2d3c2b6108e26e8b54da36243592c /test/usb_typec_drp_acc_trysrc.c | |
parent | 3b05afd87d249c1318989fda9d0e341ab0d69f91 (diff) | |
download | chrome-ec-0f713b36be38449cddea2196d1a135d7bdcfb82a.tar.gz |
tests: reset the PD task before every test case
In order to isolate each test and make each test run from a
clean state, reuse the TASK_RESET_DONE event to signal to
the test code that we should just jump back to the beginning
of the PD task
BRANCH=none
BUG=none
TEST=see that tests are reset in child CLs
Signed-off-by: Jett Rink <jettrink@chromium.org>
Change-Id: I3c0408ab0dbc3ad3a26f17aadbda1577ffc7d32f
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2290650
Reviewed-by: Paul Fagerburg <pfagerburg@chromium.org>
Reviewed-by: Denis Brockus <dbrockus@chromium.org>
Diffstat (limited to 'test/usb_typec_drp_acc_trysrc.c')
-rw-r--r-- | test/usb_typec_drp_acc_trysrc.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/test/usb_typec_drp_acc_trysrc.c b/test/usb_typec_drp_acc_trysrc.c index 525c3bd18c..fbaa8018aa 100644 --- a/test/usb_typec_drp_acc_trysrc.c +++ b/test/usb_typec_drp_acc_trysrc.c @@ -135,6 +135,12 @@ __maybe_unused static int test_power_role_set(void) { mock_tcpc.num_calls_to_set_header = 0; + /* + * We need to allow auto toggling to see the port partner attach + * as a sink + */ + pd_set_dual_role(PORT0, PD_DRP_TOGGLE_ON); + /* Update CC lines send state machine event to process */ mock_tcpc.cc1 = TYPEC_CC_VOLT_OPEN; mock_tcpc.cc2 = TYPEC_CC_VOLT_RD; @@ -603,10 +609,8 @@ void before_test(void) mock_usb_mux_reset(); mock_tcpc_reset(); - tc_try_src_override(TRY_SRC_NO_OVERRIDE); - - /* Ensure that PD task initializes its state machine and settles */ - task_wake(TASK_ID_PD_C0); + /* Restart the PD task and let it settle */ + task_set_event(TASK_ID_PD_C0, TASK_EVENT_RESET_DONE, 0); task_wait_event(SECOND); /* Print out TCPC calls for easier debugging */ |