Update libpldm api encode_*_req functions to have payload_length param
There were a few of the APIs in libpldm's fru and platform
that Hostboot was using downstream that did not have the
payload_length param which the Hostboot templates expect. All
encode_*_req functions should end with a payload_length parameter
and this commit moves us towards that goal.
Tested: I ran run-unit-test-docker.sh from the openbmc-build-scripts
repo with the script pointed at my pldm directory.
Change-Id: Ief825111970db2faffaf00e431bc0f43f7a11b02
Signed-off-by: Christian Geddes <crgeddes@us.ibm.com>
diff --git a/libpldm/tests/libpldm_fru_test.cpp b/libpldm/tests/libpldm_fru_test.cpp
index 97177c0..d79df4b 100644
--- a/libpldm/tests/libpldm_fru_test.cpp
+++ b/libpldm/tests/libpldm_fru_test.cpp
@@ -11,7 +11,8 @@
{
std::array<uint8_t, sizeof(pldm_msg_hdr)> requestMsg{};
auto requestPtr = reinterpret_cast<pldm_msg*>(requestMsg.data());
- auto rc = encode_get_fru_record_table_metadata_req(0, requestPtr);
+ auto rc = encode_get_fru_record_table_metadata_req(
+ 0, requestPtr, PLDM_GET_FRU_RECORD_TABLE_METADATA_REQ_BYTES);
ASSERT_EQ(rc, PLDM_SUCCESS);
ASSERT_EQ(requestPtr->hdr.request, PLDM_REQUEST);
ASSERT_EQ(requestPtr->hdr.instance_id, 0u);
@@ -21,8 +22,12 @@
TEST(GetFruRecordTableMetadata, testBadEncodeRequest)
{
- auto rc = encode_get_fru_record_table_metadata_req(0, NULL);
+ auto rc = encode_get_fru_record_table_metadata_req(0, NULL, 0);
ASSERT_EQ(rc, PLDM_ERROR_INVALID_DATA);
+ std::array<uint8_t, sizeof(pldm_msg_hdr)> requestMsg{};
+ auto requestPtr = reinterpret_cast<pldm_msg*>(requestMsg.data());
+ rc = encode_get_fru_record_table_metadata_req(0, requestPtr, 1);
+ ASSERT_EQ(rc, PLDM_ERROR_INVALID_LENGTH);
}
TEST(GetFruRecordTableMetadata, testGoodDecodeResponse)