Fix broken IBM OEM Unit tests
Tested Log:
ninja: no work to do.
1/28 libpldm_base_test OK 0.05s
2/28 libpldm_platform_test OK 0.04s
3/28 libpldm_bios_test OK 0.04s
4/28 libpldm_fru_test OK 0.03s
5/28 libpldm_utils_test OK 0.02s
6/28 libpldm_pdr_test OK 0.02s
7/28 ../../oem/ibm/test/libpldm_fileio_test OK 0.05s
8/28 ../../oem/ibm/test/libpldm_host_test OK 0.05s
9/28 libpldmresponder_base_test OK 0.05s
10/28 libpldmresponder_bios_test OK 0.04s
11/28 libpldmresponder_bios_attribute_test OK 0.04s
12/28 libpldmresponder_bios_string_attribute_test OK 0.06s
13/28 libpldmresponder_bios_integer_attribute_test OK 0.06s
14/28 libpldmresponder_bios_config_test OK 0.07s
15/28 libpldmresponder_bios_enum_attribute_test OK 0.06s
16/28 libpldmresponder_pdr_effecter_test OK 0.06s
17/28 libpldmresponder_pdr_sensor_test OK 0.05s
18/28 libpldmresponder_bios_table_test OK 0.07s
19/28 pldmd_instanceid_test OK 0.05s
20/28 pldmd_registration_test OK 0.05s
21/28 libpldmresponder_platform_test OK 0.07s
22/28 pldm_utils_test OK 0.05s
23/28 libpldmresponder_fru_test OK 0.04s
24/28 libpldmresponder_dbus_to_host_effecter_test OK 0.04s
25/28 ../oem/ibm/test/libpldmresponder_oem_platform_test OK 0.02s
26/28 ../oem/ibm/test/host_bmc_lamp_test OK 0.02s
27/28 ../oem/ibm/test/libpldmresponder_fileio_test OK 0.04s
28/28 libpldm_bios_table_test OK 2.14s
Ok: 28
Expected Fail: 0
Fail: 0
Unexpected Pass: 0
Skipped: 0
Timeout: 0
Signed-off-by: Manojkiran Eda <manojkiran.eda@gmail.com>
Change-Id: Iaacbefffebee252f0588db267c3e26f583a9edba
diff --git a/oem/ibm/libpldmresponder/oem_ibm_handler.cpp b/oem/ibm/libpldmresponder/oem_ibm_handler.cpp
index d595c2e..7fa7570 100644
--- a/oem/ibm/libpldmresponder/oem_ibm_handler.cpp
+++ b/oem/ibm/libpldmresponder/oem_ibm_handler.cpp
@@ -146,7 +146,7 @@
return rc;
}
-void buildAllCodeUpdateEffecterPDR(platform::Handler* platformHandler,
+void buildAllCodeUpdateEffecterPDR(oem_ibm_platform::Handler* platformHandler,
uint16_t entityType, uint16_t entityInstance,
uint16_t stateSetID, pdr_utils::Repo& repo)
{
@@ -197,7 +197,7 @@
repo.addRecord(pdrEntry);
}
-void buildAllCodeUpdateSensorPDR(platform::Handler* platformHandler,
+void buildAllCodeUpdateSensorPDR(oem_ibm_platform::Handler* platformHandler,
uint16_t entityType, uint16_t entityInstance,
uint16_t stateSetID, pdr_utils::Repo& repo)
{
@@ -249,31 +249,31 @@
void pldm::responder::oem_ibm_platform::Handler::buildOEMPDR(
pdr_utils::Repo& repo)
{
- buildAllCodeUpdateEffecterPDR(
- platformHandler, PLDM_OEM_IBM_ENTITY_FIRMWARE_UPDATE, ENTITY_INSTANCE_0,
- PLDM_OEM_IBM_BOOT_STATE, repo);
- buildAllCodeUpdateEffecterPDR(
- platformHandler, PLDM_OEM_IBM_ENTITY_FIRMWARE_UPDATE, ENTITY_INSTANCE_1,
- PLDM_OEM_IBM_BOOT_STATE, repo);
- buildAllCodeUpdateEffecterPDR(
- platformHandler, PLDM_OEM_IBM_ENTITY_FIRMWARE_UPDATE, ENTITY_INSTANCE_0,
- PLDM_OEM_IBM_FIRMWARE_UPDATE_STATE, repo);
- buildAllCodeUpdateEffecterPDR(platformHandler, PLDM_ENTITY_SYSTEM_CHASSIS,
+ buildAllCodeUpdateEffecterPDR(this, PLDM_OEM_IBM_ENTITY_FIRMWARE_UPDATE,
+ ENTITY_INSTANCE_0, PLDM_OEM_IBM_BOOT_STATE,
+ repo);
+ buildAllCodeUpdateEffecterPDR(this, PLDM_OEM_IBM_ENTITY_FIRMWARE_UPDATE,
+ ENTITY_INSTANCE_1, PLDM_OEM_IBM_BOOT_STATE,
+ repo);
+ buildAllCodeUpdateEffecterPDR(this, PLDM_OEM_IBM_ENTITY_FIRMWARE_UPDATE,
+ ENTITY_INSTANCE_0,
+ PLDM_OEM_IBM_FIRMWARE_UPDATE_STATE, repo);
+ buildAllCodeUpdateEffecterPDR(this, PLDM_ENTITY_SYSTEM_CHASSIS,
ENTITY_INSTANCE_0,
PLDM_OEM_IBM_SYSTEM_POWER_STATE, repo);
- buildAllCodeUpdateSensorPDR(
- platformHandler, PLDM_OEM_IBM_ENTITY_FIRMWARE_UPDATE, ENTITY_INSTANCE_0,
- PLDM_OEM_IBM_BOOT_STATE, repo);
- buildAllCodeUpdateSensorPDR(
- platformHandler, PLDM_OEM_IBM_ENTITY_FIRMWARE_UPDATE, ENTITY_INSTANCE_1,
- PLDM_OEM_IBM_BOOT_STATE, repo);
- buildAllCodeUpdateSensorPDR(
- platformHandler, PLDM_OEM_IBM_ENTITY_FIRMWARE_UPDATE, ENTITY_INSTANCE_0,
- PLDM_OEM_IBM_FIRMWARE_UPDATE_STATE, repo);
- buildAllCodeUpdateSensorPDR(
- platformHandler, PLDM_OEM_IBM_ENTITY_FIRMWARE_UPDATE, ENTITY_INSTANCE_0,
- PLDM_OEM_IBM_VERIFICATION_STATE, repo);
+ buildAllCodeUpdateSensorPDR(this, PLDM_OEM_IBM_ENTITY_FIRMWARE_UPDATE,
+ ENTITY_INSTANCE_0, PLDM_OEM_IBM_BOOT_STATE,
+ repo);
+ buildAllCodeUpdateSensorPDR(this, PLDM_OEM_IBM_ENTITY_FIRMWARE_UPDATE,
+ ENTITY_INSTANCE_1, PLDM_OEM_IBM_BOOT_STATE,
+ repo);
+ buildAllCodeUpdateSensorPDR(this, PLDM_OEM_IBM_ENTITY_FIRMWARE_UPDATE,
+ ENTITY_INSTANCE_0,
+ PLDM_OEM_IBM_FIRMWARE_UPDATE_STATE, repo);
+ buildAllCodeUpdateSensorPDR(this, PLDM_OEM_IBM_ENTITY_FIRMWARE_UPDATE,
+ ENTITY_INSTANCE_0,
+ PLDM_OEM_IBM_VERIFICATION_STATE, repo);
auto sensorId = findStateSensorId(
repo.getPdr(), 0, PLDM_OEM_IBM_ENTITY_FIRMWARE_UPDATE,
ENTITY_INSTANCE_0, 0, PLDM_OEM_IBM_VERIFICATION_STATE);
diff --git a/oem/ibm/libpldmresponder/oem_ibm_handler.hpp b/oem/ibm/libpldmresponder/oem_ibm_handler.hpp
index b574262..ee1081e 100644
--- a/oem/ibm/libpldmresponder/oem_ibm_handler.hpp
+++ b/oem/ibm/libpldmresponder/oem_ibm_handler.hpp
@@ -80,7 +80,7 @@
* @return platformHandler->getNextEffecterId() - returns the
* effecter ID from the platform handler
*/
- uint16_t getNextEffecterId()
+ virtual uint16_t getNextEffecterId()
{
return platformHandler->getNextEffecterId();
}
@@ -90,7 +90,7 @@
* @return platformHandler->getNextSensorId() - returns the
* Sensor ID from the platform handler
*/
- uint16_t getNextSensorId()
+ virtual uint16_t getNextSensorId()
{
return platformHandler->getNextSensorId();
}
diff --git a/oem/ibm/test/libpldmresponder_fileio_test.cpp b/oem/ibm/test/libpldmresponder_fileio_test.cpp
index a0b5a5e..e7a5945 100644
--- a/oem/ibm/test/libpldmresponder_fileio_test.cpp
+++ b/oem/ibm/test/libpldmresponder_fileio_test.cpp
@@ -209,6 +209,8 @@
uint32_t offset = 0;
uint32_t length = 10;
uint64_t address = 0;
+ uint8_t host_eid = 0;
+ int hostSocketFd = 0;
std::array<uint8_t, sizeof(pldm_msg_hdr) + PLDM_RW_FILE_MEM_REQ_BYTES>
requestMsg{};
@@ -223,7 +225,8 @@
// Pass invalid payload length
std::unique_ptr<oem_platform::Handler> oemPlatformHandler{};
- oem_ibm::Handler handler(oemPlatformHandler.get());
+ oem_ibm::Handler handler(oemPlatformHandler.get(), hostSocketFd, host_eid,
+ nullptr);
auto response = handler.readFileIntoMemory(request, 0);
auto responsePtr = reinterpret_cast<pldm_msg*>(response.data());
ASSERT_EQ(responsePtr->payload[0], PLDM_ERROR_INVALID_LENGTH);
@@ -236,6 +239,8 @@
uint32_t offset = 0;
uint32_t length = 0;
uint64_t address = 0;
+ uint8_t host_eid = 0;
+ int hostSocketFd = 0;
std::array<uint8_t, sizeof(pldm_msg_hdr) + PLDM_RW_FILE_MEM_REQ_BYTES>
requestMsg{};
@@ -254,7 +259,8 @@
auto& table = buildFileTable(fileTableConfig.c_str());
std::unique_ptr<oem_platform::Handler> oemPlatformHandler{};
- oem_ibm::Handler handler(oemPlatformHandler.get());
+ oem_ibm::Handler handler(oemPlatformHandler.get(), hostSocketFd, host_eid,
+ nullptr);
auto response = handler.readFileIntoMemory(request, requestPayloadLength);
auto responsePtr = reinterpret_cast<pldm_msg*>(response.data());
ASSERT_EQ(responsePtr->payload[0], PLDM_INVALID_FILE_HANDLE);
@@ -269,6 +275,8 @@
uint32_t offset = 1024;
uint32_t length = 0;
uint64_t address = 0;
+ uint8_t host_eid = 0;
+ int hostSocketFd = 0;
std::array<uint8_t, sizeof(pldm_msg_hdr) + PLDM_RW_FILE_MEM_REQ_BYTES>
requestMsg{};
@@ -286,7 +294,8 @@
auto& table = buildFileTable(fileTableConfig.c_str());
std::unique_ptr<oem_platform::Handler> oemPlatformHandler{};
- oem_ibm::Handler handler(oemPlatformHandler.get());
+ oem_ibm::Handler handler(oemPlatformHandler.get(), hostSocketFd, host_eid,
+ nullptr);
auto response = handler.readFileIntoMemory(request, requestPayloadLength);
auto responsePtr = reinterpret_cast<pldm_msg*>(response.data());
ASSERT_EQ(responsePtr->payload[0], PLDM_DATA_OUT_OF_RANGE);
@@ -301,6 +310,8 @@
// Length should be a multiple of dma min size(16)
uint32_t length = 10;
uint64_t address = 0;
+ uint8_t host_eid = 0;
+ int hostSocketFd = 0;
std::array<uint8_t, sizeof(pldm_msg_hdr) + PLDM_RW_FILE_MEM_REQ_BYTES>
requestMsg{};
@@ -318,7 +329,8 @@
auto& table = buildFileTable(fileTableConfig.c_str());
std::unique_ptr<oem_platform::Handler> oemPlatformHandler{};
- oem_ibm::Handler handler(oemPlatformHandler.get());
+ oem_ibm::Handler handler(oemPlatformHandler.get(), hostSocketFd, host_eid,
+ nullptr);
auto response = handler.readFileIntoMemory(request, requestPayloadLength);
auto responsePtr = reinterpret_cast<pldm_msg*>(response.data());
ASSERT_EQ(responsePtr->payload[0], PLDM_ERROR_INVALID_LENGTH);
@@ -336,6 +348,8 @@
// DMA min size(16)
uint32_t length = 1024;
uint64_t address = 0;
+ uint8_t host_eid = 0;
+ int hostSocketFd = 0;
std::array<uint8_t, sizeof(pldm_msg_hdr) + PLDM_RW_FILE_MEM_REQ_BYTES>
requestMsg{};
@@ -353,7 +367,8 @@
auto& table = buildFileTable(fileTableConfig.c_str());
std::unique_ptr<oem_platform::Handler> oemPlatformHandler{};
- oem_ibm::Handler handler(oemPlatformHandler.get());
+ oem_ibm::Handler handler(oemPlatformHandler.get(), hostSocketFd, host_eid,
+ nullptr);
auto response = handler.readFileIntoMemory(request, requestPayloadLength);
auto responsePtr = reinterpret_cast<pldm_msg*>(response.data());
ASSERT_EQ(responsePtr->payload[0], PLDM_ERROR_INVALID_LENGTH);
@@ -367,6 +382,8 @@
uint32_t offset = 0;
uint32_t length = 10;
uint64_t address = 0;
+ uint8_t host_eid = 0;
+ int hostSocketFd = 0;
std::array<uint8_t, sizeof(pldm_msg_hdr) + PLDM_RW_FILE_MEM_REQ_BYTES>
requestMsg{};
@@ -382,7 +399,8 @@
// Pass invalid payload length
std::unique_ptr<oem_platform::Handler> oemPlatformHandler{};
- oem_ibm::Handler handler(oemPlatformHandler.get());
+ oem_ibm::Handler handler(oemPlatformHandler.get(), hostSocketFd, host_eid,
+ nullptr);
auto response = handler.writeFileFromMemory(request, 0);
auto responsePtr = reinterpret_cast<pldm_msg*>(response.data());
ASSERT_EQ(responsePtr->payload[0], PLDM_ERROR_INVALID_LENGTH);
@@ -400,6 +418,8 @@
uint32_t offset = 0;
uint32_t length = 16;
uint64_t address = 0;
+ uint8_t host_eid = 0;
+ int hostSocketFd = 0;
std::array<uint8_t, sizeof(pldm_msg_hdr) + PLDM_RW_FILE_MEM_REQ_BYTES>
requestMsg{};
@@ -418,7 +438,8 @@
auto& table = buildFileTable(fileTableConfig.c_str());
std::unique_ptr<oem_platform::Handler> oemPlatformHandler{};
- oem_ibm::Handler handler(oemPlatformHandler.get());
+ oem_ibm::Handler handler(oemPlatformHandler.get(), hostSocketFd, host_eid,
+ nullptr);
auto response = handler.writeFileFromMemory(request, requestPayloadLength);
auto responsePtr = reinterpret_cast<pldm_msg*>(response.data());
ASSERT_EQ(responsePtr->payload[0], PLDM_INVALID_FILE_HANDLE);
@@ -433,6 +454,8 @@
uint32_t offset = 1024;
uint32_t length = 16;
uint64_t address = 0;
+ uint8_t host_eid = 0;
+ int hostSocketFd = 0;
std::array<uint8_t, sizeof(pldm_msg_hdr) + PLDM_RW_FILE_MEM_REQ_BYTES>
requestMsg{};
@@ -451,7 +474,8 @@
auto& table = buildFileTable(TestFileTable::fileTableConfig.c_str());
std::unique_ptr<oem_platform::Handler> oemPlatformHandler{};
- oem_ibm::Handler handler(oemPlatformHandler.get());
+ oem_ibm::Handler handler(oemPlatformHandler.get(), hostSocketFd, host_eid,
+ nullptr);
auto response = handler.writeFileFromMemory(request, requestPayloadLength);
auto responsePtr = reinterpret_cast<pldm_msg*>(response.data());
ASSERT_EQ(responsePtr->payload[0], PLDM_DATA_OUT_OF_RANGE);
@@ -509,6 +533,8 @@
uint8_t type = PLDM_FILE_ATTRIBUTE_TABLE;
uint32_t nextTransferHandle = 0;
uint8_t transferFlag = PLDM_START_AND_END;
+ uint8_t host_eid = 0;
+ int hostSocketFd = 0;
std::array<uint8_t, sizeof(pldm_msg_hdr) + PLDM_GET_FILE_TABLE_REQ_BYTES>
requestMsg{};
@@ -521,7 +547,8 @@
request->table_type = type;
std::unique_ptr<oem_platform::Handler> oemPlatformHandler{};
- oem_ibm::Handler handler(oemPlatformHandler.get());
+ oem_ibm::Handler handler(oemPlatformHandler.get(), hostSocketFd, host_eid,
+ nullptr);
auto response = handler.getFileTable(requestMsgPtr, requestPayloadLength);
auto responsePtr = reinterpret_cast<pldm_msg*>(response.data());
ASSERT_EQ(responsePtr->payload[0], PLDM_SUCCESS);
@@ -539,13 +566,16 @@
TEST_F(TestFileTable, GetFileTableCommandReqLengthMismatch)
{
+ uint8_t host_eid = 0;
+ int hostSocketFd = 0;
std::array<uint8_t, sizeof(pldm_msg_hdr) + PLDM_GET_FILE_TABLE_REQ_BYTES>
requestMsg{};
auto request = reinterpret_cast<pldm_msg*>(requestMsg.data());
// Pass invalid command payload length
std::unique_ptr<oem_platform::Handler> oemPlatformHandler{};
- oem_ibm::Handler handler(oemPlatformHandler.get());
+ oem_ibm::Handler handler(oemPlatformHandler.get(), hostSocketFd, host_eid,
+ nullptr);
auto response = handler.getFileTable(request, 0);
auto responsePtr = reinterpret_cast<pldm_msg*>(response.data());
ASSERT_EQ(responsePtr->payload[0], PLDM_ERROR_INVALID_LENGTH);
@@ -556,6 +586,8 @@
uint32_t transferHandle = 0;
uint8_t opFlag = 0;
uint8_t type = PLDM_OEM_FILE_ATTRIBUTE_TABLE;
+ uint8_t host_eid = 0;
+ int hostSocketFd = 0;
std::array<uint8_t, sizeof(pldm_msg_hdr) + PLDM_GET_FILE_TABLE_REQ_BYTES>
requestMsg{};
@@ -568,7 +600,8 @@
request->table_type = type;
std::unique_ptr<oem_platform::Handler> oemPlatformHandler{};
- oem_ibm::Handler handler(oemPlatformHandler.get());
+ oem_ibm::Handler handler(oemPlatformHandler.get(), hostSocketFd, host_eid,
+ nullptr);
auto response = handler.getFileTable(requestMsgPtr, requestPayloadLength);
auto responsePtr = reinterpret_cast<pldm_msg*>(response.data());
ASSERT_EQ(responsePtr->payload[0], PLDM_INVALID_FILE_TABLE_TYPE);
@@ -579,6 +612,8 @@
uint32_t fileHandle = 1;
uint32_t offset = 0;
uint32_t length = 0x4;
+ uint8_t host_eid = 0;
+ int hostSocketFd = 0;
std::array<uint8_t, sizeof(pldm_msg_hdr) + PLDM_READ_FILE_REQ_BYTES>
requestMsg{};
@@ -597,7 +632,8 @@
// Invalid payload length
std::unique_ptr<oem_platform::Handler> oemPlatformHandler{};
- oem_ibm::Handler handler(oemPlatformHandler.get());
+ oem_ibm::Handler handler(oemPlatformHandler.get(), hostSocketFd, host_eid,
+ nullptr);
auto response = handler.readFile(requestMsgPtr, 0);
auto responsePtr = reinterpret_cast<pldm_msg*>(response.data());
ASSERT_EQ(responsePtr->payload[0], PLDM_ERROR_INVALID_LENGTH);
@@ -624,6 +660,8 @@
uint32_t fileHandle = 0;
uint32_t offset = 0;
uint32_t length = 0x4;
+ uint8_t host_eid = 0;
+ int hostSocketFd = 0;
std::array<uint8_t, sizeof(pldm_msg_hdr) + PLDM_READ_FILE_REQ_BYTES>
requestMsg{};
@@ -648,7 +686,8 @@
stream.read(buffer.data(), length);
std::unique_ptr<oem_platform::Handler> oemPlatformHandler{};
- oem_ibm::Handler handler(oemPlatformHandler.get());
+ oem_ibm::Handler handler(oemPlatformHandler.get(), hostSocketFd, host_eid,
+ nullptr);
auto responseMsg = handler.readFile(requestMsgPtr, payload_length);
auto response = reinterpret_cast<pldm_read_file_resp*>(
responseMsg.data() + sizeof(pldm_msg_hdr));
@@ -681,6 +720,8 @@
uint32_t fileHandle = 0;
uint32_t offset = 0;
uint32_t length = 0x10;
+ uint8_t host_eid = 0;
+ int hostSocketFd = 0;
std::vector<uint8_t> requestMsg(sizeof(pldm_msg_hdr) +
PLDM_WRITE_FILE_REQ_BYTES + length);
@@ -699,7 +740,8 @@
// Invalid payload length
std::unique_ptr<oem_platform::Handler> oemPlatformHandler{};
- oem_ibm::Handler handler(oemPlatformHandler.get());
+ oem_ibm::Handler handler(oemPlatformHandler.get(), hostSocketFd, host_eid,
+ nullptr);
auto response = handler.writeFile(requestMsgPtr, 0);
auto responsePtr = reinterpret_cast<pldm_msg*>(response.data());
ASSERT_EQ(responsePtr->payload[0], PLDM_ERROR_INVALID_LENGTH);
@@ -727,6 +769,8 @@
uint32_t offset = 0;
std::array<uint8_t, 4> fileData = {0x41, 0x42, 0x43, 0x44};
uint32_t length = fileData.size();
+ uint8_t host_eid = 0;
+ int hostSocketFd = 0;
std::vector<uint8_t> requestMsg(sizeof(pldm_msg_hdr) +
PLDM_WRITE_FILE_REQ_BYTES + length);
@@ -747,7 +791,8 @@
memcpy(request->file_data, fileData.data(), fileData.size());
std::unique_ptr<oem_platform::Handler> oemPlatformHandler{};
- oem_ibm::Handler handler(oemPlatformHandler.get());
+ oem_ibm::Handler handler(oemPlatformHandler.get(), hostSocketFd, host_eid,
+ nullptr);
auto responseMsg = handler.writeFile(requestMsgPtr, payload_length);
auto response = reinterpret_cast<pldm_read_file_resp*>(
responseMsg.data() + sizeof(pldm_msg_hdr));
@@ -766,6 +811,9 @@
TEST(writeFileByTypeFromMemory, testBadPath)
{
+ uint8_t host_eid = 0;
+ int hostSocketFd = 0;
+
const auto hdr_size = sizeof(pldm_msg_hdr);
std::array<uint8_t, hdr_size + PLDM_RW_FILE_BY_TYPE_MEM_REQ_BYTES>
requestMsg{};
@@ -781,7 +829,8 @@
request->address = 0;
std::unique_ptr<oem_platform::Handler> oemPlatformHandler{};
- oem_ibm::Handler handler(oemPlatformHandler.get());
+ oem_ibm::Handler handler(oemPlatformHandler.get(), hostSocketFd, host_eid,
+ nullptr);
auto response = handler.writeFileByTypeFromMemory(req, 0);
auto responsePtr = reinterpret_cast<pldm_msg*>(response.data());
@@ -844,6 +893,8 @@
TEST(readFileByTypeIntoMemory, testBadPath)
{
+ uint8_t host_eid = 0;
+ int hostSocketFd = 0;
const auto hdr_size = sizeof(pldm_msg_hdr);
std::array<uint8_t, hdr_size + PLDM_RW_FILE_BY_TYPE_MEM_REQ_BYTES>
requestMsg{};
@@ -858,7 +909,8 @@
request->address = 0;
std::unique_ptr<oem_platform::Handler> oemPlatformHandler{};
- oem_ibm::Handler handler(oemPlatformHandler.get());
+ oem_ibm::Handler handler(oemPlatformHandler.get(), hostSocketFd, host_eid,
+ nullptr);
auto response = handler.readFileByTypeIntoMemory(req, 0);
auto responsePtr = reinterpret_cast<pldm_msg*>(response.data());
struct pldm_read_write_file_by_type_memory_resp* resp =
@@ -884,6 +936,8 @@
TEST(readFileByType, testBadPath)
{
+ uint8_t host_eid = 0;
+ int hostSocketFd = 0;
const auto hdr_size = sizeof(pldm_msg_hdr);
std::array<uint8_t, hdr_size + PLDM_RW_FILE_BY_TYPE_REQ_BYTES> requestMsg{};
auto payloadLength = requestMsg.size() - hdr_size;
@@ -897,7 +951,8 @@
request->length = 13;
std::unique_ptr<oem_platform::Handler> oemPlatformHandler{};
- oem_ibm::Handler handler(oemPlatformHandler.get());
+ oem_ibm::Handler handler(oemPlatformHandler.get(), hostSocketFd, host_eid,
+ nullptr);
auto response = handler.readFileByType(req, 0);
auto responsePtr = reinterpret_cast<pldm_msg*>(response.data());
struct pldm_read_write_file_by_type_resp* resp =
@@ -924,7 +979,7 @@
char tmplt[] = "/tmp/lid.XXXXXX";
auto fd = mkstemp(tmplt);
std::vector<uint8_t> in = {100, 10, 56, 78, 34, 56, 79, 235, 111};
- write(fd, in.data(), in.size());
+ rc = write(fd, in.data(), in.size());
close(fd);
length = in.size() + 1000;
rc = handler.readFile(tmplt, 0, length, response);
diff --git a/oem/ibm/test/libpldmresponder_oem_platform_test.cpp b/oem/ibm/test/libpldmresponder_oem_platform_test.cpp
index 09132cf..62ca129 100644
--- a/oem/ibm/test/libpldmresponder_oem_platform_test.cpp
+++ b/oem/ibm/test/libpldmresponder_oem_platform_test.cpp
@@ -189,26 +189,13 @@
auto event = sdeventplus::Event::get_default();
std::unique_ptr<CodeUpdate> mockCodeUpdate =
std::make_unique<MockCodeUpdate>(mockDbusHandler.get());
- std::unique_ptr<oem_platform::Handler> oemPlatformHandler{};
-
- oemPlatformHandler = std::make_unique<oem_ibm_platform::Handler>(
- mockDbusHandler.get(), mockCodeUpdate.get(), 0x1, 0x9, requester,
- event);
std::unique_ptr<oem_ibm_platform::Handler> mockoemPlatformHandler =
std::make_unique<MockOemPlatformHandler>(mockDbusHandler.get(),
mockCodeUpdate.get(), 0x1, 0x9,
requester, event);
- pldm::responder::oem_ibm_platform::Handler* oemIbmPlatformHandler =
- dynamic_cast<pldm::responder::oem_ibm_platform::Handler*>(
- oemPlatformHandler.get());
- pldm::responder::platform::Handler* mckPltHandler =
- reinterpret_cast<pldm::responder::platform::Handler*>(
- mockoemPlatformHandler.get());
- oemIbmPlatformHandler->setPlatformHandler(mckPltHandler);
-
Repo inRepo(inPDRRepo);
- oemPlatformHandler->buildOEMPDR(inRepo);
+ mockoemPlatformHandler->buildOEMPDR(inRepo);
ASSERT_EQ(inRepo.empty(), false);
pdr_utils::PdrEntry e;
@@ -308,37 +295,24 @@
auto event = sdeventplus::Event::get_default();
std::unique_ptr<CodeUpdate> mockCodeUpdate =
std::make_unique<MockCodeUpdate>(mockDbusHandler.get());
- std::unique_ptr<oem_platform::Handler> oemPlatformHandler{};
-
- oemPlatformHandler = std::make_unique<oem_ibm_platform::Handler>(
- mockDbusHandler.get(), mockCodeUpdate.get(), 0x1, 0x9, requester,
- event);
std::unique_ptr<oem_ibm_platform::Handler> mockoemPlatformHandler =
std::make_unique<MockOemPlatformHandler>(mockDbusHandler.get(),
mockCodeUpdate.get(), 0x1, 0x9,
requester, event);
- pldm::responder::oem_ibm_platform::Handler* oemIbmPlatformHandler =
- dynamic_cast<pldm::responder::oem_ibm_platform::Handler*>(
- oemPlatformHandler.get());
- pldm::responder::platform::Handler* mckPltHandler =
- reinterpret_cast<pldm::responder::platform::Handler*>(
- mockoemPlatformHandler.get());
- oemIbmPlatformHandler->setPlatformHandler(mckPltHandler);
Repo inRepo(inPDRRepo);
-
- oemPlatformHandler->buildOEMPDR(inRepo);
+ mockoemPlatformHandler->buildOEMPDR(inRepo);
ASSERT_EQ(inRepo.empty(), false);
pdr_utils::PdrEntry e;
// Test for sensor number 1, for current boot side state
- auto record1 = pdr::getRecordByHandle(inRepo, 4, e);
+ auto record1 = pdr::getRecordByHandle(inRepo, 5, e);
ASSERT_NE(record1, nullptr);
pldm_state_sensor_pdr* pdr =
reinterpret_cast<pldm_state_sensor_pdr*>(e.data);
- ASSERT_EQ(pdr->hdr.record_handle, 4);
+ ASSERT_EQ(pdr->hdr.record_handle, 5);
ASSERT_EQ(pdr->hdr.version, 1);
ASSERT_EQ(pdr->hdr.type, PLDM_STATE_SENSOR_PDR);
ASSERT_EQ(pdr->hdr.record_change_num, 0);
@@ -359,12 +333,12 @@
ASSERT_EQ(states->states[0].byte, bf1.byte);
// Test for sensor number 2, for next boot side state
- auto record2 = pdr::getRecordByHandle(inRepo, 5, e);
+ auto record2 = pdr::getRecordByHandle(inRepo, 6, e);
ASSERT_NE(record2, nullptr);
pdr = reinterpret_cast<pldm_state_sensor_pdr*>(e.data);
- ASSERT_EQ(pdr->hdr.record_handle, 5);
+ ASSERT_EQ(pdr->hdr.record_handle, 6);
ASSERT_EQ(pdr->hdr.version, 1);
ASSERT_EQ(pdr->hdr.type, PLDM_STATE_SENSOR_PDR);
ASSERT_EQ(pdr->hdr.record_change_num, 0);
@@ -385,12 +359,12 @@
ASSERT_EQ(states->states[0].byte, bf2.byte);
// Test for sensor number 3, for firmware update state control
- auto record3 = pdr::getRecordByHandle(inRepo, 6, e);
+ auto record3 = pdr::getRecordByHandle(inRepo, 7, e);
ASSERT_NE(record3, nullptr);
pdr = reinterpret_cast<pldm_state_sensor_pdr*>(e.data);
- ASSERT_EQ(pdr->hdr.record_handle, 6);
+ ASSERT_EQ(pdr->hdr.record_handle, 7);
ASSERT_EQ(pdr->hdr.version, 1);
ASSERT_EQ(pdr->hdr.type, PLDM_STATE_SENSOR_PDR);
ASSERT_EQ(pdr->hdr.record_change_num, 0);