platform/chrome: cros_ec_proto: update Kunit test for get_next_data_v3

Since commit 106d673982 ("platform/chrome: cros_ec_proto: Upgrade
get_next_event to v3"), (struct cros_ec_device *)->event_data becomes
struct ec_response_get_next_event_v3.

Update the Kunit test for fixing the following error:
> Expected mock->msg.insize == sizeof(union ec_response_get_next_data_v1), but
>     mock->msg.insize == 18 (0x12)
>     sizeof(union ec_response_get_next_data_v1) == 16 (0x10)

Reviewed-by: Guenter Roeck <groeck@chromium.org>
Link: https://lore.kernel.org/r/20240611033113.4154548-1-tzungbi@kernel.org
Signed-off-by: Tzung-Bi Shih <tzungbi@kernel.org>
This commit is contained in:
Tzung-Bi Shih 2024-06-11 03:31:13 +00:00
parent d11c00292a
commit 41f1242f62

View File

@ -2060,17 +2060,17 @@ static void cros_ec_proto_test_get_next_event_no_mkbp_event(struct kunit *test)
/* For get_keyboard_state_event(). */
{
union ec_response_get_next_data_v1 *data;
union ec_response_get_next_data_v3 *data;
mock = cros_kunit_ec_xfer_mock_add(test, sizeof(*data));
KUNIT_ASSERT_PTR_NE(test, mock, NULL);
data = (union ec_response_get_next_data_v1 *)mock->o_data;
data = (union ec_response_get_next_data_v3 *)mock->o_data;
data->host_event = 0xbeef;
}
ret = cros_ec_get_next_event(ec_dev, &wake_event, &more_events);
KUNIT_EXPECT_EQ(test, ret, sizeof(union ec_response_get_next_data_v1));
KUNIT_EXPECT_EQ(test, ret, sizeof(union ec_response_get_next_data_v3));
KUNIT_EXPECT_EQ(test, ec_dev->event_data.event_type, EC_MKBP_EVENT_KEY_MATRIX);
KUNIT_EXPECT_EQ(test, ec_dev->event_data.data.host_event, 0xbeef);
@ -2085,7 +2085,7 @@ static void cros_ec_proto_test_get_next_event_no_mkbp_event(struct kunit *test)
KUNIT_EXPECT_EQ(test, mock->msg.version, 0);
KUNIT_EXPECT_EQ(test, mock->msg.command, EC_CMD_MKBP_STATE);
KUNIT_EXPECT_EQ(test, mock->msg.insize, sizeof(union ec_response_get_next_data_v1));
KUNIT_EXPECT_EQ(test, mock->msg.insize, sizeof(union ec_response_get_next_data_v3));
KUNIT_EXPECT_EQ(test, mock->msg.outsize, 0);
}
}