diff options
author | Abe Levkoy <alevkoy@chromium.org> | 2022-10-10 11:51:05 -0600 |
---|---|---|
committer | Chromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2022-10-11 00:59:20 +0000 |
commit | 909c3711b69361cdfd60e0ad9f20d4377f221e8e (patch) | |
tree | f6880d24bbfdde394b7ca22b3a8cf2ac9a66dbe4 | |
parent | 1fe446bc92ba7f267dd5f854795a8e0d5883d25f (diff) | |
download | chrome-ec-909c3711b69361cdfd60e0ad9f20d4377f221e8e.tar.gz |
zephyr test: Deflake PD rev 3.0 suite
In the before function for suite usb_attach_5v_3a_pd_source_rev3, set
the chipset power state to S0 before calling set_ac_enabled. Allow the
tests in this suite to run individually without failing an assumption
during set_ac_enabled.
Also, after entering S5, wait for the chipset to enter G3, which may
prompt a Hard Reset. Only send an Alert after that process has
completed, to avoid the Alert being lost.
BUG=b:251485312
TEST=twister-out/.../drivers.default/zephyr/zephyr.exe
-test=usb_attach_5v_3a_pd_source_rev3:verify_startup_on_pd_button_press
BRANCH=none
Signed-off-by: Abe Levkoy <alevkoy@chromium.org>
Change-Id: Icaa88ad977271c8738687106aba4e2a9eafb6b88
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3943258
Reviewed-by: Jameson Thies <jthies@google.com>
Reviewed-by: Al Semjonovs <asemjonovs@google.com>
Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com>
-rw-r--r-- | zephyr/test/drivers/default/src/integration/usbc/usb_pd_rev3.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/zephyr/test/drivers/default/src/integration/usbc/usb_pd_rev3.c b/zephyr/test/drivers/default/src/integration/usbc/usb_pd_rev3.c index d2c5f2a0dd..fdea74a691 100644 --- a/zephyr/test/drivers/default/src/integration/usbc/usb_pd_rev3.c +++ b/zephyr/test/drivers/default/src/integration/usbc/usb_pd_rev3.c @@ -50,6 +50,12 @@ static void usb_attach_5v_3a_pd_source_before(void *data) { struct usb_attach_5v_3a_pd_source_rev3_fixture *fixture = data; + /* Set chipset to ON, this will set TCPM to DRP */ + test_set_chipset_to_s0(); + + /* TODO(b/214401892): Check why need to give time TCPM to spin */ + k_sleep(K_SECONDS(1)); + connect_source_to_port(&fixture->source_5v_3a, &fixture->src_ext, 1, fixture->tcpci_emul, fixture->charger_emul); @@ -267,9 +273,12 @@ ZTEST_F(usb_attach_5v_3a_pd_source_rev3, verify_startup_on_pd_button_press) { uint32_t ado; - /* Shutdown device to test wake from USB PD power button */ + /* Shutdown device to test wake from USB PD power button. Shutting down + * the device may involve a Hard Reset upon entry to G3 (10 seconds + * after S5). Wait long enough for that process to complete. + */ chipset_force_shutdown(CHIPSET_SHUTDOWN_BUTTON); - k_sleep(K_SECONDS(10)); + k_sleep(K_SECONDS(15)); /* Clear alert and status flags set during shutdown */ tcpci_src_emul_clear_alert_received(&fixture->src_ext); |