libpldm: Fix test failure in fru and pdr
All the failures on big endian in libpldm_fru_test and libpldm_pdr_test
are related to the test cases themselves.
Fix the endian issues.
Tested: Verify the libpldm_fru/pdr_test cases pass on both little endian
and big endian systems.
Signed-off-by: Lei YU <mine260309@gmail.com>
Change-Id: I93533e96976342d401bfaf2cd6d6ff0a5b8b128b
diff --git a/libpldm/tests/libpldm_fru_test.cpp b/libpldm/tests/libpldm_fru_test.cpp
index 6be4d78..9e598c7 100644
--- a/libpldm/tests/libpldm_fru_test.cpp
+++ b/libpldm/tests/libpldm_fru_test.cpp
@@ -302,7 +302,7 @@
auto request =
reinterpret_cast<pldm_get_fru_record_table_req*>(requestPtr->payload);
- request->data_transfer_handle = data_transfer_handle;
+ request->data_transfer_handle = htole32(data_transfer_handle);
request->transfer_operation_flag = transfer_operation_flag;
uint32_t ret_data_transfer_handle = 0;
@@ -363,7 +363,8 @@
ASSERT_EQ(responsePtr->hdr.type, PLDM_FRU);
ASSERT_EQ(responsePtr->hdr.command, PLDM_GET_FRU_RECORD_TABLE);
ASSERT_EQ(response->completion_code, PLDM_SUCCESS);
- ASSERT_EQ(response->next_data_transfer_handle, next_data_transfer_handle);
+ ASSERT_EQ(le32toh(response->next_data_transfer_handle),
+ next_data_transfer_handle);
ASSERT_EQ(response->transfer_flag, transfer_flag);
}