test#242
Conversation
There was a problem hiding this comment.
Pull request overview
This PR attempts to move PDRI filename retrieval in the firmware-updater flow from the old command-based path to a new IARM/MFR-based helper, and updates unit-test mocks/build wiring to support that path. In the codebase, this affects how additionalFwVerInfo/PDRI data is gathered for update checks and how the IARM layer is exercised in tests.
Changes:
- Add
GetPDRIFileNameUsingMFR()to the IARM interface and routedevice_api.cPDRI lookup through it. - Extend multiple unit-test mocks and test build targets to expose the new helper and
IARM_Bus_Call. - Update build/CI files so fwutils can compile with IARM flags and L1 tests also run on
topic/*pushes.
Reviewed changes
Copilot reviewed 19 out of 19 changed files in this pull request and generated 13 comments.
Show a summary per file
| File | Description |
|---|---|
unittest/mocks/rdkFwupdateMgr_mock.h |
Adds mock interface entry for the new PDRI-via-MFR helper. |
unittest/mocks/rdkFwupdateMgr_mock.cpp |
Adds a C-linkage mock/stub for GetPDRIFileNameUsingMFR. |
unittest/mocks/interface_mock.h |
Extends the interface mock with IARM_Bus_Call. |
unittest/mocks/interface_mock.cpp |
Implements the new IARM_Bus_Call wrapper for tests. |
unittest/mocks/iarmInterface_mock.h |
Introduces a dedicated IARM mock header for the new helper. |
unittest/mocks/iarmInterface_mock.cpp |
Adds the dedicated IARM mock implementation/global pointer. |
unittest/mocks/deviceutils_mock.h |
Adds the new helper to the device-utils mock API. |
unittest/mocks/deviceutils_mock.cpp |
Adds a device-utils-side stub for GetPDRIFileNameUsingMFR. |
unittest/mocks/device_status_helper_mock.h |
Adds the helper to the device-status mock interface. |
unittest/mocks/device_status_helper_mock.cpp |
Adds a device-status-side stub for GetPDRIFileNameUsingMFR. |
unittest/Makefile.am |
Updates unit-test source lists to include the new mock plumbing. |
unittest/deviceutils/device_api_gtest.cpp |
Adjusts PDRI-related device API tests around the new path. |
src/include/iarmInterface.h |
Exposes MFR-related declarations/constants and the new helper prototype. |
src/iarmInterface/iarmInterface.c |
Implements PDRI retrieval through IARM_Bus_Call. |
src/deviceutils/device_api.h |
Pulls in the IARM interface for the new device API dependency. |
src/deviceutils/device_api.c |
Replaces the old PDRI lookup implementation with the IARM/MFR callout. |
run_ut.sh |
Minor formatting cleanup in the unit-test runner. |
Makefile.am |
Adds IARM compile flags to fwutils when IARM is enabled. |
.github/workflows/L1-Test.yaml |
Extends the L1 workflow trigger to topic/* pushes. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| #define GETRDMMANIFESTVERSION_IN_SCRIPT | ||
| #endif | ||
|
|
||
| #ifdef defined(IARM_ENABLED) |
| size_t GetPDRIFileName( char *pPDRIFilename, size_t szBufSize ) | ||
| { | ||
| size_t len = 0; | ||
| #ifdef defined(IARM_ENABLED) |
| size_t len = 0; | ||
| #ifdef defined(IARM_ENABLED) | ||
| len = GetPDRIFileNameUsingMFR(pPDRIFilename, szBufSize); | ||
| #endif |
| size_t len = 0; | ||
| #ifdef defined(IARM_ENABLED) | ||
| len = GetPDRIFileNameUsingMFR(pPDRIFilename, szBufSize); | ||
| #endif |
| #if 0 | ||
| TEST_F(DeviceApiTestFixture, TestName_Success) | ||
| { |
| extern "C" size_t GetPDRIFileNameUsingMFR(char *pPDRIFilename, size_t szBufSize) | ||
| { | ||
| if (!g_DeviceUtilsMock) { | ||
| cout << "GetPDRIFileNameUsingMFR g_IarmInterfaceMock object is NULL" << endl; |
| extern "C" size_t GetPDRIFileNameUsingMFR(char *pPDRIFilename, size_t szBufSize) | ||
| { | ||
| if (!g_DeviceStatusMock) { | ||
| cout << "GetPDRIFileNameUsingMFR g_IarmInterfaceMock object is NULL" << endl; |
| size_t GetPDRIFileNameUsingMFR(char *pPDRIFilename, size_t szBufSize) | ||
| { | ||
| size_t len = 0; | ||
| IARM_Result_t ret; | ||
| IARM_Bus_MFRLib_GetSerializedData_Param_t param; | ||
|
|
||
| if (pPDRIFilename == NULL) { | ||
| SWLOG_ERROR("GetPDRIFileName: Error, input argument NULL\n"); | ||
| return 0; | ||
| } | ||
|
|
||
| SWLOG_INFO("GetPDRIFileName: Fetching PDRI image name via IARM_Bus_Call (MFRMgr)"); | ||
|
|
||
| memset(¶m, 0, sizeof(param)); | ||
| param.type = mfrSERIALIZED_TYPE_PDRIVERSION; | ||
|
|
||
| ret = IARM_Bus_Call( | ||
| IARM_BUS_MFRLIB_NAME, | ||
| IARM_BUS_MFRLIB_API_GetSerializedData, | ||
| (void *)¶m, | ||
| sizeof(param) | ||
| ); | ||
|
|
||
| if (ret == IARM_RESULT_SUCCESS ) | ||
| { | ||
| SWLOG_INFO("GetPDRIFileName: IARM_Bus_Call Success , param.bufLen : %zu\n" , (size_t)param.bufLen); | ||
| if(param.bufLen > 0 && param.bufLen < szBufSize) { | ||
| memcpy(pPDRIFilename, param.buffer, param.bufLen); | ||
| pPDRIFilename[param.bufLen] = '\0'; | ||
| len = param.bufLen; | ||
| SWLOG_INFO("GetPDRIFileName: IARM_Bus_Call OK, PDRI Version = %s", pPDRIFilename); | ||
| } | ||
| } else { | ||
| // Error path: be explicit | ||
| SWLOG_ERROR("GetPDRIFileName: IARM_Bus_Call failed (ret=%d, bufLen=%zu). Cannot retrieve PDRI image name.", ret, (size_t)param.bufLen); | ||
|
|
||
| } | ||
|
|
||
| return len; |
| // Give a fake file name for tests unless you want to do more in your mock object | ||
| const char *mockPDRI = "mock-PDRI-image.bin"; | ||
| size_t len = strlen(mockPDRI); | ||
| if (pPDRIFilename && szBufSize > len) { | ||
| strncpy(pPDRIFilename, mockPDRI, szBufSize); | ||
| pPDRIFilename[szBufSize - 1] = '\0'; | ||
| return len; | ||
| } | ||
| return g_DeviceUtilsMock->GetPDRIFileNameUsingMFR(pPDRIFilename, szBufSize); |
| extern "C" size_t GetPDRIFileNameUsingMFR(char *pPDRIFilename, size_t szBufSize) | ||
| { | ||
| if (!g_RdkFwupdateMgrMock) { | ||
| cout << "GetPDRIFileNameUsingMFR g_IarmInterfaceMock object is NULL" << endl; |
1d7e05f to
85d7b73
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 19 out of 19 changed files in this pull request and generated 11 comments.
Comments suppressed due to low confidence (1)
unittest/Makefile.am:134
- This new source entry is missing the trailing
\line continuation. As written, Automake stops the_SOURCESassignment here and treats the next line as a separate make statement, which breaksautoreconf/makefor the unit-test build.
../src/deviceutils/device_api.c \
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| size_t GetPDRIFileName( char *pPDRIFilename, size_t szBufSize ) | ||
| { | ||
| size_t len = 0; | ||
| #if defined(IARM_ENABLED) | ||
| len = GetPDRIFileNameUsingMFR(pPDRIFilename, szBufSize); | ||
| #endif |
| if (ret == IARM_RESULT_SUCCESS ) | ||
| { | ||
| SWLOG_INFO("GetPDRIFileName: IARM_Bus_Call Success , param.bufLen : %zu\n" , (size_t)param.bufLen); | ||
| if(param.bufLen > 0 && param.bufLen < szBufSize) { | ||
| memcpy(pPDRIFilename, param.buffer, param.bufLen); | ||
| pPDRIFilename[param.bufLen] = '\0'; | ||
| len = param.bufLen; | ||
| SWLOG_INFO("GetPDRIFileName: IARM_Bus_Call OK, PDRI Version = %s", pPDRIFilename); |
| ../src/deviceutils/device_api.c \ | ||
| ../src/deviceutils/deviceutils.c \ | ||
| deviceutils/json_parse.c \ | ||
| miscellaneous_mock.cpp \ | ||
| ./mocks/deviceutils_mock.cpp | ||
| ./mocks/deviceutils_mock.cpp \ | ||
| ./mocks/iarmInterface_mock.cpp |
| size_t GetPDRIFileName( char *pPDRIFilename, size_t szBufSize ) | ||
| { | ||
| size_t len = 0; | ||
| #if defined(IARM_ENABLED) | ||
| len = GetPDRIFileNameUsingMFR(pPDRIFilename, szBufSize); | ||
| #endif |
| // Give a fake file name for tests unless you want to do more in your mock object | ||
| const char *mockPDRI = "mock-PDRI-image.bin"; | ||
| size_t len = strlen(mockPDRI); | ||
| if (pPDRIFilename && szBufSize > len) { | ||
| strncpy(pPDRIFilename, mockPDRI, szBufSize); | ||
| pPDRIFilename[szBufSize - 1] = '\0'; | ||
| return len; | ||
| } |
| printf("Inside Mock Function GetPDRIFileNameUsingMFR\n"); | ||
| // Give a fake file name for tests unless you want to do more in your mock object | ||
| const char *mockPDRI = "mock-PDRI-image.bin"; | ||
| size_t len = strlen(mockPDRI); | ||
| if (pPDRIFilename && szBufSize > len) { | ||
| strncpy(pPDRIFilename, mockPDRI, szBufSize); | ||
| pPDRIFilename[szBufSize - 1] = '\0'; | ||
| return len; | ||
| } |
| // Give a fake file name for tests unless you want to do more in your mock object | ||
| const char *mockPDRI = "mock-PDRI-image.bin"; | ||
| size_t len = strlen(mockPDRI); | ||
| if (pPDRIFilename && szBufSize > len) { | ||
| strncpy(pPDRIFilename, mockPDRI, szBufSize); | ||
| pPDRIFilename[szBufSize - 1] = '\0'; | ||
| return len; | ||
| } |
| extern "C" size_t GetPDRIFileNameUsingMFR(char *pPDRIFilename, size_t szBufSize) | ||
| { | ||
| if (!g_DeviceUtilsMock) { | ||
| cout << "GetPDRIFileNameUsingMFR g_IarmInterfaceMock object is NULL" << endl; |
| extern "C" size_t GetPDRIFileNameUsingMFR(char *pPDRIFilename, size_t szBufSize) | ||
| { | ||
| if (!g_DeviceStatusMock) { | ||
| cout << "GetPDRIFileNameUsingMFR g_IarmInterfaceMock object is NULL" << endl; |
| extern "C" size_t GetPDRIFileNameUsingMFR(char *pPDRIFilename, size_t szBufSize) | ||
| { | ||
| if (!g_RdkFwupdateMgrMock) { | ||
| cout << "GetPDRIFileNameUsingMFR g_IarmInterfaceMock object is NULL" << endl; |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 19 out of 19 changed files in this pull request and generated 12 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| extern "C" void eventManager(int event_type, const char *event_data) { | ||
| extern "C" void eventManager(const char *cur_event_name, const char *event_status) { | ||
| // Stub - event manager | ||
| printf("EventManager: type=%d, data=%s\n", event_type, event_data ? event_data : "NULL"); |
| ../src/deviceutils/deviceutils.c \ | ||
| deviceutils/json_parse.c \ | ||
| ./mocks/deviceutils_mock.cpp | ||
| ./mocks/deviceutils_mock.cpp \ |
| size_t len = 0; | ||
| #if defined(IARM_ENABLED) | ||
| len = GetPDRIFileNameUsingMFR(pPDRIFilename, szBufSize); | ||
| #endif |
| { | ||
| size_t len = 0; | ||
| #if defined(IARM_ENABLED) | ||
| len = GetPDRIFileNameUsingMFR(pPDRIFilename, szBufSize); |
| if(param.bufLen > 0 && param.bufLen < szBufSize) { | ||
| memcpy(pPDRIFilename, param.buffer, param.bufLen); | ||
| pPDRIFilename[param.bufLen] = '\0'; | ||
| len = param.bufLen; | ||
| SWLOG_INFO("GetPDRIFileName: IARM_Bus_Call OK, PDRI Version = %s", pPDRIFilename); | ||
| } |
| // Give a fake file name for tests unless you want to do more in your mock object | ||
| const char *mockPDRI = "mock-PDRI-image.bin"; | ||
| size_t len = strlen(mockPDRI); | ||
| if (pPDRIFilename && szBufSize > len) { | ||
| strncpy(pPDRIFilename, mockPDRI, szBufSize); | ||
| pPDRIFilename[szBufSize - 1] = '\0'; | ||
| return len; | ||
| } |
| // Give a fake file name for tests unless you want to do more in your mock object | ||
| const char *mockPDRI = "mock-PDRI-image.bin"; | ||
| size_t len = strlen(mockPDRI); | ||
| if (pPDRIFilename && szBufSize > len) { | ||
| strncpy(pPDRIFilename, mockPDRI, szBufSize); | ||
| pPDRIFilename[szBufSize - 1] = '\0'; | ||
| return len; | ||
| } |
| printf("Inside Mock Function GetPDRIFileNameUsingMFR\n"); | ||
| // Give a fake file name for tests unless you want to do more in your mock object | ||
| const char *mockPDRI = "mock-PDRI-image.bin"; | ||
| size_t len = strlen(mockPDRI); | ||
| if (pPDRIFilename && szBufSize > len) { | ||
| strncpy(pPDRIFilename, mockPDRI, szBufSize); | ||
| pPDRIFilename[szBufSize - 1] = '\0'; | ||
| return len; | ||
| } |
| // Give a fake file name for tests unless you want to do more in your mock object | ||
| const char *mockPDRI = "mock-PDRI-image.bin"; | ||
| size_t len = strlen(mockPDRI); | ||
| if (pPDRIFilename && szBufSize > len) { | ||
| strncpy(pPDRIFilename, mockPDRI, szBufSize); | ||
| pPDRIFilename[szBufSize - 1] = '\0'; | ||
| return len; | ||
| } |
| size_t GetPDRIFileNameUsingMFR(char *pPDRIFilename, size_t szBufSize) | ||
| { | ||
| size_t len = 0; | ||
| IARM_Result_t ret; | ||
| IARM_Bus_MFRLib_GetSerializedData_Param_t param; |
f80c847 to
0783367
Compare
No description provided.