summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEdward Hill <ecgh@chromium.org>2019-10-11 16:45:50 -0600
committerCommit Bot <commit-bot@chromium.org>2019-10-15 22:23:10 +0000
commit5a649192d901cdf099ac77d81791cdf647f97d52 (patch)
tree346bb0308e29c31263b497c9755d06319fc66ed7
parent397042ccdc53aa7e8de7cbb0d085adc189e275d8 (diff)
downloadchrome-ec-5a649192d901cdf099ac77d81791cdf647f97d52.tar.gz
usbc: fix flaky usb_typec_ctvpd test
When testing "Host Port VBUS Removed" at the end of test_vpd_host_src_detection_vbus(), we go to TC_UNATTACHED_SNK but then quickly move to TC_ATTACH_WAIT_SNK. Reduce the task_wait_event() timeout in wait_for_state_change() to make checking this transition more reliable. BRANCH=none BUG=none TEST=usb_typec_ctvpd test still passes Change-Id: I11a927fabbcff4a7adc50f5495fab796129b04ab Signed-off-by: Edward Hill <ecgh@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1857215 Reviewed-by: Denis Brockus <dbrockus@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org>
-rw-r--r--test/usb_typec_ctvpd.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/test/usb_typec_ctvpd.c b/test/usb_typec_ctvpd.c
index 61fc64f9b9..b16ac37b25 100644
--- a/test/usb_typec_ctvpd.c
+++ b/test/usb_typec_ctvpd.c
@@ -78,7 +78,7 @@ uint64_t wait_for_state_change(int port, uint64_t timeout)
start = get_time().val;
while (get_state_tc(port) == state && get_time().val < wait) {
task_wake(PD_PORT_TO_TASK_ID(port));
- task_wait_event(5 * MSEC);
+ task_wait_event(1 * MSEC);
}
return get_time().val - start;
@@ -464,6 +464,10 @@ static int test_vpd_host_src_detection_vbus(void)
TEST_ASSERT(get_state_tc(port) == TC_UNATTACHED_SNK);
+ wait_for_state_change(port, 10 * MSEC);
+
+ TEST_ASSERT(get_state_tc(port) == TC_ATTACH_WAIT_SNK);
+
return EC_SUCCESS;
}