diff options
author | Daisuke Nojiri <dnojiri@chromium.org> | 2022-08-30 21:56:26 +0000 |
---|---|---|
committer | Chromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2022-08-31 20:20:09 +0000 |
commit | 13a94b26a34077b2cc403386b2f398cec69ce2b0 (patch) | |
tree | d0be8fbb7086d5610e988769dd95bc2ca7a636ba | |
parent | d83d449317849cbb52907661cd00d7231325238d (diff) | |
download | chrome-ec-13a94b26a34077b2cc403386b2f398cec69ce2b0.tar.gz |
zephyr: test: Set start-up battery level to 50%
This will avoid the flakiness of the virtual battery test (specifically
test_read_regs) due to the power-on speed.
BUG=b:243816417
BRANCH=None
TEST=./twister -v -T zephyr/test
Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>
Change-Id: I10251fdd33acc184c3c0a86b93e646e326181829
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3865907
Reviewed-by: Wai-Hong Tam <waihong@google.com>
Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com>
Reviewed-by: Al Semjonovs <asemjonovs@google.com>
-rw-r--r-- | zephyr/test/drivers/common/src/utils.c | 7 | ||||
-rw-r--r-- | zephyr/test/drivers/default/src/virtual_battery.c | 10 |
2 files changed, 6 insertions, 11 deletions
diff --git a/zephyr/test/drivers/common/src/utils.c b/zephyr/test/drivers/common/src/utils.c index f559e8629a..62e1065f08 100644 --- a/zephyr/test/drivers/common/src/utils.c +++ b/zephyr/test/drivers/common/src/utils.c @@ -60,11 +60,12 @@ void test_set_chipset_to_s0(void) /* * Make sure that battery is in good condition to * not trigger hibernate in charge_state_v2.c - * Set battery voltage to expected value and capacity to 75%. Battery + * Set battery voltage to expected value and capacity to 50%. Battery * will not be full and accepts charging, but will not trigger - * hibernate. Charge level is chosen arbitrary. + * hibernate. Charge level is set to the default value of an emulator + * (emul/emul_smart_battery.c). b/244366201. */ - test_set_battery_level(75); + test_set_battery_level(50); /* The easiest way to power on seems to be the shell command. */ zassert_equal(EC_SUCCESS, shell_execute_cmd(get_ec_shell(), "power on"), diff --git a/zephyr/test/drivers/default/src/virtual_battery.c b/zephyr/test/drivers/default/src/virtual_battery.c index 5eed8296a6..6de4df6190 100644 --- a/zephyr/test/drivers/default/src/virtual_battery.c +++ b/zephyr/test/drivers/default/src/virtual_battery.c @@ -141,10 +141,7 @@ ZTEST_USER(virtual_battery, test_read_regs) expected = 100 * bat->cap / bat->full_cap; word = virtual_battery_read16(SB_RELATIVE_STATE_OF_CHARGE); - /* TODO(b/243816417): Flaky virtual battery test for mocked power */ - if (!IS_ENABLED(CONFIG_POWER_SEQUENCE_MOCK)) { - zassert_equal(expected, word, "%d != %d", expected, word); - } + zassert_equal(expected, word, "%d != %d", expected, word); word = virtual_battery_read16(SB_TEMPERATURE); zassert_equal(bat->temp, word, "%d != %d", bat->temp, word); @@ -171,10 +168,7 @@ ZTEST_USER(virtual_battery, test_read_regs) zassert_equal(bat->design_cap, word, "%d != %d", bat->design_cap, word); word = virtual_battery_read16(SB_REMAINING_CAPACITY); - /* TODO(b/243816417): Flaky virtual battery test for mocked power */ - if (!IS_ENABLED(CONFIG_POWER_SEQUENCE_MOCK)) { - zassert_equal(bat->cap, word, "%d != %d", bat->cap, word); - } + zassert_equal(bat->cap, word, "%d != %d", bat->cap, word); len = virtual_battery_read_str(SB_MANUFACTURER_NAME, &str, 32); zassert_equal(bat->mf_name_len, len, "%d != %d", bat->mf_name_len, len); |