diff options
author | Tristan Honscheid <honscheid@google.com> | 2022-03-18 23:41:55 -0600 |
---|---|---|
committer | Chromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2022-03-28 17:39:08 +0000 |
commit | 23236c1be4babc119ee4814cfb56cbffc7906112 (patch) | |
tree | a6f11594407eb0ce4217556e3c1dc6b13f5bcf6c /zephyr/test | |
parent | 35fe03cb6db57442da1577eae415b4a843e501c0 (diff) | |
download | chrome-ec-23236c1be4babc119ee4814cfb56cbffc7906112.tar.gz |
sn5s330: Test I2C fail in sn5s330_set_vconn()
Test handling of a failed I2C read in sn5s330_set_vconn()
BRANCH=None
BUG=b:225245353
TEST=zmake -D configure --test test-drivers
Signed-off-by: Tristan Honscheid <honscheid@google.com>
Change-Id: I1bb748a057b9b32e5340667546b698e7427539db
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3546942
Reviewed-by: Denis Brockus <dbrockus@chromium.org>
Diffstat (limited to 'zephyr/test')
-rw-r--r-- | zephyr/test/drivers/src/ppc_sn5s330.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/zephyr/test/drivers/src/ppc_sn5s330.c b/zephyr/test/drivers/src/ppc_sn5s330.c index 3eb97fed28..e0317cacf6 100644 --- a/zephyr/test/drivers/src/ppc_sn5s330.c +++ b/zephyr/test/drivers/src/ppc_sn5s330.c @@ -597,6 +597,19 @@ ZTEST(ppc_sn5s330, test_low_power_mode_fail) ret); } +ZTEST(ppc_sn5s330, test_sn5s330_set_vconn_fail) +{ + /* Test failed I2C operations in the set Vconn function */ + + struct i2c_emul *i2c_emul = sn5s330_emul_to_i2c_emul(EMUL); + int ret; + + i2c_common_emul_set_read_fail_reg(i2c_emul, SN5S330_FUNC_SET4); + ret = sn5s330_drv.set_vconn(SN5S330_PORT, 0); + zassert_equal(EC_ERROR_INVAL, ret, "Expected EC_ERROR_INVAL but got %d", + ret); +} + static inline void reset_sn5s330_state(void) { struct i2c_emul *i2c_emul = sn5s330_emul_to_i2c_emul(EMUL); |