sn5s330: Test I2C fail in sn5s330_set_vconn()
Test handling of a failed I2C read in sn5s330_set_vconn()
BRANCH=None
TEST=zmake -D configure --test test-drivers
@@ -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);
