Skip to content

test#242

Open
rosemarybennyy wants to merge 7 commits into
developfrom
topic/test_rose_working_backup
Open

test#242
rosemarybennyy wants to merge 7 commits into
developfrom
topic/test_rose_working_backup

Conversation

@rosemarybennyy
Copy link
Copy Markdown
Contributor

No description provided.

@rosemarybennyy rosemarybennyy requested a review from a team as a code owner May 4, 2026 11:41
Copilot AI review requested due to automatic review settings May 4, 2026 11:41
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 route device_api.c PDRI 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.

Comment thread src/deviceutils/device_api.h Outdated
#define GETRDMMANIFESTVERSION_IN_SCRIPT
#endif

#ifdef defined(IARM_ENABLED)
Comment thread src/deviceutils/device_api.c Outdated
size_t GetPDRIFileName( char *pPDRIFilename, size_t szBufSize )
{
size_t len = 0;
#ifdef defined(IARM_ENABLED)
Comment on lines +242 to +245
size_t len = 0;
#ifdef defined(IARM_ENABLED)
len = GetPDRIFileNameUsingMFR(pPDRIFilename, szBufSize);
#endif
Comment on lines +242 to +245
size_t len = 0;
#ifdef defined(IARM_ENABLED)
len = GetPDRIFileNameUsingMFR(pPDRIFilename, szBufSize);
#endif
Comment on lines +178 to +180
#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;
Comment on lines +321 to +359
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(&param, 0, sizeof(param));
param.type = mfrSERIALIZED_TYPE_PDRIVERSION;

ret = IARM_Bus_Call(
IARM_BUS_MFRLIB_NAME,
IARM_BUS_MFRLIB_API_GetSerializedData,
(void *)&param,
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;
Comment on lines +276 to +284
// 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;
@rosemarybennyy rosemarybennyy force-pushed the topic/test_rose_working_backup branch from 1d7e05f to 85d7b73 Compare May 4, 2026 12:20
Copilot AI review requested due to automatic review settings May 4, 2026 12:56
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 _SOURCES assignment here and treats the next line as a separate make statement, which breaks autoreconf/make for the unit-test build.
    ../src/deviceutils/device_api.c \

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +240 to +245
size_t GetPDRIFileName( char *pPDRIFilename, size_t szBufSize )
{
size_t len = 0;
#if defined(IARM_ENABLED)
len = GetPDRIFileNameUsingMFR(pPDRIFilename, szBufSize);
#endif
Comment on lines +344 to +351
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);
Comment thread unittest/Makefile.am
Comment on lines 134 to +139
../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
Comment on lines +240 to +245
size_t GetPDRIFileName( char *pPDRIFilename, size_t szBufSize )
{
size_t len = 0;
#if defined(IARM_ENABLED)
len = GetPDRIFileNameUsingMFR(pPDRIFilename, szBufSize);
#endif
Comment on lines +276 to +283
// 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;
}
Comment on lines +147 to +155
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;
}
Comment on lines +35 to +42
// 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;
Copilot AI review requested due to automatic review settings May 4, 2026 15:00
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread unittest/mocks/rdkFwupdateMgr_mock.cpp Outdated
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");
Comment thread unittest/Makefile.am
../src/deviceutils/deviceutils.c \
deviceutils/json_parse.c \
./mocks/deviceutils_mock.cpp
./mocks/deviceutils_mock.cpp \
Comment on lines +242 to +245
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);
Comment on lines +347 to +352
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);
}
Comment on lines +276 to +283
// 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;
}
Comment on lines +326 to +333
// 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;
}
Comment on lines +147 to +155
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;
}
Comment on lines +35 to +42
// 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;
}
Comment on lines +321 to +325
size_t GetPDRIFileNameUsingMFR(char *pPDRIFilename, size_t szBufSize)
{
size_t len = 0;
IARM_Result_t ret;
IARM_Bus_MFRLib_GetSerializedData_Param_t param;
@rosemarybennyy rosemarybennyy force-pushed the topic/test_rose_working_backup branch from f80c847 to 0783367 Compare May 4, 2026 15:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants