libpldm: Fix logical errors between length check and cc decoding
When calling the encode_xxx_resp method in the registration method of
libpldmresponder, if the return value isn't PLDM_SUCCESS, the
payload_length value is only 1(return ccOnlyResponse method) and not a
complete responder data length, so we must first check cc in the
decode_xxx_resp method to avoid logic errors.
if cc != PLDM_SUCCESS, return PLDM_SUCCESS and don't need check
payload_length.
if cc == PLDM_SUCCESS, then check payload_length.
Signed-off-by: George Liu <liuxiwei@inspur.com>
Change-Id: Iaf27c3a6b45638375a4ad1542dd5c4067bbd67b1
diff --git a/test/libpldm_base_test.cpp b/test/libpldm_base_test.cpp
index ffa76de..b8b25d3 100644
--- a/test/libpldm_base_test.cpp
+++ b/test/libpldm_base_test.cpp
@@ -21,33 +21,33 @@
// PLDM header information pointer is NULL
auto rc = pack_pldm_header(hdr_ptr, &msg);
- ASSERT_EQ(rc, PLDM_ERROR_INVALID_DATA);
+ EXPECT_EQ(rc, PLDM_ERROR_INVALID_DATA);
// PLDM message pointer is NULL
rc = pack_pldm_header(&hdr, nullptr);
- ASSERT_EQ(rc, PLDM_ERROR_INVALID_DATA);
+ EXPECT_EQ(rc, PLDM_ERROR_INVALID_DATA);
// PLDM header information pointer and PLDM message pointer is NULL
rc = pack_pldm_header(hdr_ptr, nullptr);
- ASSERT_EQ(rc, PLDM_ERROR_INVALID_DATA);
+ EXPECT_EQ(rc, PLDM_ERROR_INVALID_DATA);
// RESERVED message type
hdr.msg_type = PLDM_RESERVED;
rc = pack_pldm_header(&hdr, &msg);
- ASSERT_EQ(rc, PLDM_ERROR_INVALID_DATA);
+ EXPECT_EQ(rc, PLDM_ERROR_INVALID_DATA);
// Instance ID out of range
hdr.msg_type = PLDM_REQUEST;
hdr.instance = 32;
rc = pack_pldm_header(&hdr, &msg);
- ASSERT_EQ(rc, PLDM_ERROR_INVALID_DATA);
+ EXPECT_EQ(rc, PLDM_ERROR_INVALID_DATA);
// PLDM type out of range
hdr.msg_type = PLDM_REQUEST;
hdr.instance = 31;
hdr.pldm_type = 64;
rc = pack_pldm_header(&hdr, &msg);
- ASSERT_EQ(rc, PLDM_ERROR_INVALID_PLDM_TYPE);
+ EXPECT_EQ(rc, PLDM_ERROR_INVALID_PLDM_TYPE);
}
TEST(PackPLDMMessage, RequestMessageGoodPath)
@@ -62,12 +62,12 @@
hdr.command = 0;
auto rc = pack_pldm_header(&hdr, &msg);
- ASSERT_EQ(rc, PLDM_SUCCESS);
- ASSERT_EQ(msg.request, 1);
- ASSERT_EQ(msg.datagram, 0);
- ASSERT_EQ(msg.instance_id, 0);
- ASSERT_EQ(msg.type, 0);
- ASSERT_EQ(msg.command, 0);
+ EXPECT_EQ(rc, PLDM_SUCCESS);
+ EXPECT_EQ(msg.request, 1);
+ EXPECT_EQ(msg.datagram, 0);
+ EXPECT_EQ(msg.instance_id, 0);
+ EXPECT_EQ(msg.type, 0);
+ EXPECT_EQ(msg.command, 0);
// Message type is REQUEST and upper range of the field values
hdr.instance = 31;
@@ -75,23 +75,23 @@
hdr.command = 255;
rc = pack_pldm_header(&hdr, &msg);
- ASSERT_EQ(rc, PLDM_SUCCESS);
- ASSERT_EQ(msg.request, 1);
- ASSERT_EQ(msg.datagram, 0);
- ASSERT_EQ(msg.instance_id, 31);
- ASSERT_EQ(msg.type, 63);
- ASSERT_EQ(msg.command, 255);
+ EXPECT_EQ(rc, PLDM_SUCCESS);
+ EXPECT_EQ(msg.request, 1);
+ EXPECT_EQ(msg.datagram, 0);
+ EXPECT_EQ(msg.instance_id, 31);
+ EXPECT_EQ(msg.type, 63);
+ EXPECT_EQ(msg.command, 255);
// Message type is PLDM_ASYNC_REQUEST_NOTIFY
hdr.msg_type = PLDM_ASYNC_REQUEST_NOTIFY;
rc = pack_pldm_header(&hdr, &msg);
- ASSERT_EQ(rc, PLDM_SUCCESS);
- ASSERT_EQ(msg.request, 1);
- ASSERT_EQ(msg.datagram, 1);
- ASSERT_EQ(msg.instance_id, 31);
- ASSERT_EQ(msg.type, 63);
- ASSERT_EQ(msg.command, 255);
+ EXPECT_EQ(rc, PLDM_SUCCESS);
+ EXPECT_EQ(msg.request, 1);
+ EXPECT_EQ(msg.datagram, 1);
+ EXPECT_EQ(msg.instance_id, 31);
+ EXPECT_EQ(msg.type, 63);
+ EXPECT_EQ(msg.command, 255);
}
TEST(PackPLDMMessage, ResponseMessageGoodPath)
@@ -106,12 +106,12 @@
hdr.command = 0;
auto rc = pack_pldm_header(&hdr, &msg);
- ASSERT_EQ(rc, PLDM_SUCCESS);
- ASSERT_EQ(msg.request, 0);
- ASSERT_EQ(msg.datagram, 0);
- ASSERT_EQ(msg.instance_id, 0);
- ASSERT_EQ(msg.type, 0);
- ASSERT_EQ(msg.command, 0);
+ EXPECT_EQ(rc, PLDM_SUCCESS);
+ EXPECT_EQ(msg.request, 0);
+ EXPECT_EQ(msg.datagram, 0);
+ EXPECT_EQ(msg.instance_id, 0);
+ EXPECT_EQ(msg.type, 0);
+ EXPECT_EQ(msg.command, 0);
// Message type is PLDM_RESPONSE and upper range of the field values
hdr.instance = 31;
@@ -119,12 +119,12 @@
hdr.command = 255;
rc = pack_pldm_header(&hdr, &msg);
- ASSERT_EQ(rc, PLDM_SUCCESS);
- ASSERT_EQ(msg.request, 0);
- ASSERT_EQ(msg.datagram, 0);
- ASSERT_EQ(msg.instance_id, 31);
- ASSERT_EQ(msg.type, 63);
- ASSERT_EQ(msg.command, 255);
+ EXPECT_EQ(rc, PLDM_SUCCESS);
+ EXPECT_EQ(msg.request, 0);
+ EXPECT_EQ(msg.datagram, 0);
+ EXPECT_EQ(msg.instance_id, 31);
+ EXPECT_EQ(msg.type, 63);
+ EXPECT_EQ(msg.command, 255);
}
TEST(UnpackPLDMMessage, BadPathTest)
@@ -133,7 +133,7 @@
// PLDM message pointer is NULL
auto rc = unpack_pldm_header(nullptr, &hdr);
- ASSERT_EQ(rc, PLDM_ERROR_INVALID_DATA);
+ EXPECT_EQ(rc, PLDM_ERROR_INVALID_DATA);
}
TEST(UnpackPLDMMessage, RequestMessageGoodPath)
@@ -144,17 +144,17 @@
// Unpack PLDM request message and lower range of field values
msg.request = 1;
auto rc = unpack_pldm_header(&msg, &hdr);
- ASSERT_EQ(rc, PLDM_SUCCESS);
- ASSERT_EQ(hdr.msg_type, PLDM_REQUEST);
- ASSERT_EQ(hdr.instance, 0);
- ASSERT_EQ(hdr.pldm_type, 0);
- ASSERT_EQ(hdr.command, 0);
+ EXPECT_EQ(rc, PLDM_SUCCESS);
+ EXPECT_EQ(hdr.msg_type, PLDM_REQUEST);
+ EXPECT_EQ(hdr.instance, 0);
+ EXPECT_EQ(hdr.pldm_type, 0);
+ EXPECT_EQ(hdr.command, 0);
// Unpack PLDM async request message and lower range of field values
msg.datagram = 1;
rc = unpack_pldm_header(&msg, &hdr);
- ASSERT_EQ(rc, PLDM_SUCCESS);
- ASSERT_EQ(hdr.msg_type, PLDM_ASYNC_REQUEST_NOTIFY);
+ EXPECT_EQ(rc, PLDM_SUCCESS);
+ EXPECT_EQ(hdr.msg_type, PLDM_ASYNC_REQUEST_NOTIFY);
// Unpack PLDM request message and upper range of field values
msg.datagram = 0;
@@ -162,11 +162,11 @@
msg.type = 63;
msg.command = 255;
rc = unpack_pldm_header(&msg, &hdr);
- ASSERT_EQ(rc, PLDM_SUCCESS);
- ASSERT_EQ(hdr.msg_type, PLDM_REQUEST);
- ASSERT_EQ(hdr.instance, 31);
- ASSERT_EQ(hdr.pldm_type, 63);
- ASSERT_EQ(hdr.command, 255);
+ EXPECT_EQ(rc, PLDM_SUCCESS);
+ EXPECT_EQ(hdr.msg_type, PLDM_REQUEST);
+ EXPECT_EQ(hdr.instance, 31);
+ EXPECT_EQ(hdr.pldm_type, 63);
+ EXPECT_EQ(hdr.command, 255);
}
TEST(UnpackPLDMMessage, ResponseMessageGoodPath)
@@ -176,22 +176,22 @@
// Unpack PLDM response message and lower range of field values
auto rc = unpack_pldm_header(&msg, &hdr);
- ASSERT_EQ(rc, PLDM_SUCCESS);
- ASSERT_EQ(hdr.msg_type, PLDM_RESPONSE);
- ASSERT_EQ(hdr.instance, 0);
- ASSERT_EQ(hdr.pldm_type, 0);
- ASSERT_EQ(hdr.command, 0);
+ EXPECT_EQ(rc, PLDM_SUCCESS);
+ EXPECT_EQ(hdr.msg_type, PLDM_RESPONSE);
+ EXPECT_EQ(hdr.instance, 0);
+ EXPECT_EQ(hdr.pldm_type, 0);
+ EXPECT_EQ(hdr.command, 0);
// Unpack PLDM response message and upper range of field values
msg.instance_id = 31;
msg.type = 63;
msg.command = 255;
rc = unpack_pldm_header(&msg, &hdr);
- ASSERT_EQ(rc, PLDM_SUCCESS);
- ASSERT_EQ(hdr.msg_type, PLDM_RESPONSE);
- ASSERT_EQ(hdr.instance, 31);
- ASSERT_EQ(hdr.pldm_type, 63);
- ASSERT_EQ(hdr.command, 255);
+ EXPECT_EQ(rc, PLDM_SUCCESS);
+ EXPECT_EQ(hdr.msg_type, PLDM_RESPONSE);
+ EXPECT_EQ(hdr.instance, 31);
+ EXPECT_EQ(hdr.pldm_type, 63);
+ EXPECT_EQ(hdr.command, 255);
}
TEST(GetPLDMCommands, testEncodeRequest)
@@ -203,9 +203,9 @@
auto request = reinterpret_cast<pldm_msg*>(requestMsg.data());
auto rc = encode_get_commands_req(0, pldmType, version, request);
- ASSERT_EQ(rc, PLDM_SUCCESS);
- ASSERT_EQ(0, memcmp(request->payload, &pldmType, sizeof(pldmType)));
- ASSERT_EQ(0, memcmp(request->payload + sizeof(pldmType), &version,
+ EXPECT_EQ(rc, PLDM_SUCCESS);
+ EXPECT_EQ(0, memcmp(request->payload, &pldmType, sizeof(pldmType)));
+ EXPECT_EQ(0, memcmp(request->payload + sizeof(pldmType), &version,
sizeof(version)));
}
@@ -225,9 +225,9 @@
auto rc = decode_get_commands_req(request, requestMsg.size() - hdrSize,
&pldmTypeOut, &versionOut);
- ASSERT_EQ(rc, PLDM_SUCCESS);
- ASSERT_EQ(pldmTypeOut, pldmType);
- ASSERT_EQ(0, memcmp(&versionOut, &version, sizeof(version)));
+ EXPECT_EQ(rc, PLDM_SUCCESS);
+ EXPECT_EQ(pldmTypeOut, pldmType);
+ EXPECT_EQ(0, memcmp(&versionOut, &version, sizeof(version)));
}
TEST(GetPLDMCommands, testEncodeResponse)
@@ -243,13 +243,13 @@
auto rc =
encode_get_commands_resp(0, PLDM_SUCCESS, commands.data(), response);
- ASSERT_EQ(rc, PLDM_SUCCESS);
+ EXPECT_EQ(rc, PLDM_SUCCESS);
uint8_t* payload_ptr = response->payload;
- ASSERT_EQ(completionCode, payload_ptr[0]);
- ASSERT_EQ(1, payload_ptr[sizeof(completionCode)]);
- ASSERT_EQ(2,
+ EXPECT_EQ(completionCode, payload_ptr[0]);
+ EXPECT_EQ(1, payload_ptr[sizeof(completionCode)]);
+ EXPECT_EQ(2,
payload_ptr[sizeof(completionCode) + sizeof(commands[0].byte)]);
- ASSERT_EQ(3, payload_ptr[sizeof(completionCode) + sizeof(commands[0].byte) +
+ EXPECT_EQ(3, payload_ptr[sizeof(completionCode) + sizeof(commands[0].byte) +
sizeof(commands[1].byte)]);
}
@@ -265,55 +265,98 @@
types[2].byte = 3;
auto rc = encode_get_types_resp(0, PLDM_SUCCESS, types.data(), response);
- ASSERT_EQ(rc, PLDM_SUCCESS);
+ EXPECT_EQ(rc, PLDM_SUCCESS);
uint8_t* payload_ptr = response->payload;
- ASSERT_EQ(completionCode, payload_ptr[0]);
- ASSERT_EQ(1, payload_ptr[sizeof(completionCode)]);
- ASSERT_EQ(2, payload_ptr[sizeof(completionCode) + sizeof(types[0].byte)]);
- ASSERT_EQ(3, payload_ptr[sizeof(completionCode) + sizeof(types[0].byte) +
+ EXPECT_EQ(completionCode, payload_ptr[0]);
+ EXPECT_EQ(1, payload_ptr[sizeof(completionCode)]);
+ EXPECT_EQ(2, payload_ptr[sizeof(completionCode) + sizeof(types[0].byte)]);
+ EXPECT_EQ(3, payload_ptr[sizeof(completionCode) + sizeof(types[0].byte) +
sizeof(types[1].byte)]);
}
-TEST(GetPLDMTypes, testDecodeResponse)
+TEST(GetPLDMTypes, testGoodDecodeResponse)
{
std::array<uint8_t, hdrSize + PLDM_GET_TYPES_RESP_BYTES> responseMsg{};
responseMsg[1 + hdrSize] = 1;
responseMsg[2 + hdrSize] = 2;
responseMsg[3 + hdrSize] = 3;
std::array<bitfield8_t, PLDM_MAX_TYPES / 8> outTypes{};
+
uint8_t completion_code;
+ responseMsg[hdrSize] = PLDM_SUCCESS;
auto response = reinterpret_cast<pldm_msg*>(responseMsg.data());
auto rc = decode_get_types_resp(response, responseMsg.size() - hdrSize,
&completion_code, outTypes.data());
- ASSERT_EQ(rc, PLDM_SUCCESS);
- ASSERT_EQ(completion_code, PLDM_SUCCESS);
- ASSERT_EQ(responseMsg[1 + hdrSize], outTypes[0].byte);
- ASSERT_EQ(responseMsg[2 + hdrSize], outTypes[1].byte);
- ASSERT_EQ(responseMsg[3 + hdrSize], outTypes[2].byte);
+ EXPECT_EQ(rc, PLDM_SUCCESS);
+ EXPECT_EQ(completion_code, PLDM_SUCCESS);
+ EXPECT_EQ(responseMsg[1 + hdrSize], outTypes[0].byte);
+ EXPECT_EQ(responseMsg[2 + hdrSize], outTypes[1].byte);
+ EXPECT_EQ(responseMsg[3 + hdrSize], outTypes[2].byte);
}
-TEST(GetPLDMCommands, testDecodeResponse)
+TEST(GetPLDMTypes, testBadDecodeResponse)
+{
+ std::array<uint8_t, hdrSize + PLDM_GET_TYPES_RESP_BYTES> responseMsg{};
+ responseMsg[1 + hdrSize] = 1;
+ responseMsg[2 + hdrSize] = 2;
+ responseMsg[3 + hdrSize] = 3;
+ std::array<bitfield8_t, PLDM_MAX_TYPES / 8> outTypes{};
+
+ uint8_t retcompletion_code = 0;
+ responseMsg[hdrSize] = PLDM_SUCCESS;
+
+ auto response = reinterpret_cast<pldm_msg*>(responseMsg.data());
+
+ auto rc = decode_get_types_resp(response, responseMsg.size() - hdrSize - 1,
+ &retcompletion_code, outTypes.data());
+
+ EXPECT_EQ(rc, PLDM_ERROR_INVALID_LENGTH);
+}
+
+TEST(GetPLDMCommands, testGoodDecodeResponse)
{
std::array<uint8_t, hdrSize + PLDM_GET_COMMANDS_RESP_BYTES> responseMsg{};
responseMsg[1 + hdrSize] = 1;
responseMsg[2 + hdrSize] = 2;
responseMsg[3 + hdrSize] = 3;
std::array<bitfield8_t, PLDM_MAX_CMDS_PER_TYPE / 8> outTypes{};
+
uint8_t completion_code;
+ responseMsg[hdrSize] = PLDM_SUCCESS;
auto response = reinterpret_cast<pldm_msg*>(responseMsg.data());
auto rc = decode_get_commands_resp(response, responseMsg.size() - hdrSize,
&completion_code, outTypes.data());
- ASSERT_EQ(rc, PLDM_SUCCESS);
- ASSERT_EQ(completion_code, PLDM_SUCCESS);
- ASSERT_EQ(responseMsg[1 + hdrSize], outTypes[0].byte);
- ASSERT_EQ(responseMsg[2 + hdrSize], outTypes[1].byte);
- ASSERT_EQ(responseMsg[3 + hdrSize], outTypes[2].byte);
+ EXPECT_EQ(rc, PLDM_SUCCESS);
+ EXPECT_EQ(completion_code, PLDM_SUCCESS);
+ EXPECT_EQ(responseMsg[1 + hdrSize], outTypes[0].byte);
+ EXPECT_EQ(responseMsg[2 + hdrSize], outTypes[1].byte);
+ EXPECT_EQ(responseMsg[3 + hdrSize], outTypes[2].byte);
+}
+
+TEST(GetPLDMCommands, testBadDecodeResponse)
+{
+ std::array<uint8_t, hdrSize + PLDM_GET_COMMANDS_RESP_BYTES> responseMsg{};
+ responseMsg[1 + hdrSize] = 1;
+ responseMsg[2 + hdrSize] = 2;
+ responseMsg[3 + hdrSize] = 3;
+ std::array<bitfield8_t, PLDM_MAX_CMDS_PER_TYPE / 8> outTypes{};
+
+ uint8_t retcompletion_code = 0;
+ responseMsg[hdrSize] = PLDM_SUCCESS;
+
+ auto response = reinterpret_cast<pldm_msg*>(responseMsg.data());
+
+ auto rc =
+ decode_get_commands_resp(response, responseMsg.size() - hdrSize - 1,
+ &retcompletion_code, outTypes.data());
+
+ EXPECT_EQ(rc, PLDM_ERROR_INVALID_LENGTH);
}
TEST(GetPLDMVersion, testGoodEncodeRequest)
@@ -327,12 +370,12 @@
auto rc =
encode_get_version_req(0, transferHandle, opFlag, pldmType, request);
- ASSERT_EQ(rc, PLDM_SUCCESS);
- ASSERT_EQ(
+ EXPECT_EQ(rc, PLDM_SUCCESS);
+ EXPECT_EQ(
0, memcmp(request->payload, &transferHandle, sizeof(transferHandle)));
- ASSERT_EQ(0, memcmp(request->payload + sizeof(transferHandle), &opFlag,
+ EXPECT_EQ(0, memcmp(request->payload + sizeof(transferHandle), &opFlag,
sizeof(opFlag)));
- ASSERT_EQ(0,
+ EXPECT_EQ(0,
memcmp(request->payload + sizeof(transferHandle) + sizeof(opFlag),
&pldmType, sizeof(pldmType)));
}
@@ -346,7 +389,7 @@
auto rc =
encode_get_version_req(0, transferHandle, opFlag, pldmType, nullptr);
- ASSERT_EQ(rc, PLDM_ERROR_INVALID_DATA);
+ EXPECT_EQ(rc, PLDM_ERROR_INVALID_DATA);
}
TEST(GetPLDMVersion, testEncodeResponse)
@@ -362,14 +405,14 @@
auto rc = encode_get_version_resp(0, PLDM_SUCCESS, 0, PLDM_START_AND_END,
&version, sizeof(ver32_t), response);
- ASSERT_EQ(rc, PLDM_SUCCESS);
- ASSERT_EQ(completionCode, response->payload[0]);
- ASSERT_EQ(0, memcmp(response->payload + sizeof(response->payload[0]),
+ EXPECT_EQ(rc, PLDM_SUCCESS);
+ EXPECT_EQ(completionCode, response->payload[0]);
+ EXPECT_EQ(0, memcmp(response->payload + sizeof(response->payload[0]),
&transferHandle, sizeof(transferHandle)));
- ASSERT_EQ(0, memcmp(response->payload + sizeof(response->payload[0]) +
+ EXPECT_EQ(0, memcmp(response->payload + sizeof(response->payload[0]) +
sizeof(transferHandle),
&flag, sizeof(flag)));
- ASSERT_EQ(0, memcmp(response->payload + sizeof(response->payload[0]) +
+ EXPECT_EQ(0, memcmp(response->payload + sizeof(response->payload[0]) +
sizeof(transferHandle) + sizeof(flag),
&version, sizeof(version)));
}
@@ -396,10 +439,10 @@
auto rc = decode_get_version_req(request, requestMsg.size() - hdrSize,
&retTransferHandle, &retFlag, &retType);
- ASSERT_EQ(rc, PLDM_SUCCESS);
- ASSERT_EQ(transferHandle, retTransferHandle);
- ASSERT_EQ(flag, retFlag);
- ASSERT_EQ(pldmType, retType);
+ EXPECT_EQ(rc, PLDM_SUCCESS);
+ EXPECT_EQ(transferHandle, retTransferHandle);
+ EXPECT_EQ(flag, retFlag);
+ EXPECT_EQ(pldmType, retType);
}
TEST(GetPLDMVersion, testDecodeResponse)
@@ -429,14 +472,14 @@
auto rc = decode_get_version_resp(response, responseMsg.size() - hdrSize,
&completion_code, &retTransferHandle,
&retFlag, &versionOut);
- ASSERT_EQ(rc, PLDM_SUCCESS);
- ASSERT_EQ(transferHandle, retTransferHandle);
- ASSERT_EQ(flag, retFlag);
+ EXPECT_EQ(rc, PLDM_SUCCESS);
+ EXPECT_EQ(transferHandle, retTransferHandle);
+ EXPECT_EQ(flag, retFlag);
- ASSERT_EQ(versionOut.major, version.major);
- ASSERT_EQ(versionOut.minor, version.minor);
- ASSERT_EQ(versionOut.update, version.update);
- ASSERT_EQ(versionOut.alpha, version.alpha);
+ EXPECT_EQ(versionOut.major, version.major);
+ EXPECT_EQ(versionOut.minor, version.minor);
+ EXPECT_EQ(versionOut.update, version.update);
+ EXPECT_EQ(versionOut.alpha, version.alpha);
}
TEST(GetTID, testEncodeRequest)
@@ -456,10 +499,10 @@
uint8_t tid = 1;
auto rc = encode_get_tid_resp(0, PLDM_SUCCESS, tid, response);
- ASSERT_EQ(rc, PLDM_SUCCESS);
+ EXPECT_EQ(rc, PLDM_SUCCESS);
uint8_t* payload = response->payload;
- ASSERT_EQ(completionCode, payload[0]);
- ASSERT_EQ(1, payload[sizeof(completionCode)]);
+ EXPECT_EQ(completionCode, payload[0]);
+ EXPECT_EQ(1, payload[sizeof(completionCode)]);
}
TEST(GetTID, testDecodeResponse)
@@ -469,15 +512,16 @@
uint8_t tid;
uint8_t completion_code;
+ responseMsg[hdrSize] = PLDM_SUCCESS;
auto response = reinterpret_cast<pldm_msg*>(responseMsg.data());
auto rc = decode_get_tid_resp(response, responseMsg.size() - hdrSize,
&completion_code, &tid);
- ASSERT_EQ(rc, PLDM_SUCCESS);
- ASSERT_EQ(completion_code, PLDM_SUCCESS);
- ASSERT_EQ(tid, 1);
+ EXPECT_EQ(rc, PLDM_SUCCESS);
+ EXPECT_EQ(completion_code, PLDM_SUCCESS);
+ EXPECT_EQ(tid, 1);
}
TEST(CcOnlyResponse, testEncode)