Skip to content

RDKEMW-14961 - Unit tests for Iarmmgr#5

Open
hgfell683 wants to merge 2 commits intodevelopfrom
feature/RDKEMW-14961-2
Open

RDKEMW-14961 - Unit tests for Iarmmgr#5
hgfell683 wants to merge 2 commits intodevelopfrom
feature/RDKEMW-14961-2

Conversation

@hgfell683
Copy link
Copy Markdown
Contributor

No description provided.

@hgfell683 hgfell683 requested a review from a team as a code owner April 8, 2026 16:59
Copilot AI review requested due to automatic review settings April 8, 2026 16:59
Copy link
Copy Markdown

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 extends the existing test/mock infrastructure to support new unit tests for Iarmmgr, primarily by adding additional wrapped libc APIs and expanding mocked IARM/Telemetry surfaces used by tests.

Changes:

  • Added Wraps support for fclose/fgets including linker __wrap_* entry points and mock interfaces.
  • Extended Telemetry mocks/API with a new t2_event_f entry point.
  • Extended IARM mocks/API with IARM_Bus_RegisterEvent and added additional SYSMgr/IARM type guards and fields to the mock header.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
Tests/mocks/WrapsMock.h Adds gmock methods for fclose/fgets.
Tests/mocks/Wraps.h Extends WrapsImpl and Wraps with fclose/fgets declarations.
Tests/mocks/Wraps.cpp Adds __wrap_fclose/__wrap_fgets and changes Wraps::fopen behavior to require a mock impl.
Tests/mocks/TelemetryMock.h Adds gmock method for t2_event_f.
Tests/mocks/Telemetry.h Extends Telemetry interface/API and function-pointer surface with t2_event_f.
Tests/mocks/Telemetry.cpp Implements TelemetryApi::t2_event_f and exports function pointer t2_event_f.
Tests/mocks/IarmBusMock.h Adds gmock method for IARM_Bus_RegisterEvent.
Tests/mocks/Iarm.h Extends IARM interface/API and adds additional type guards/fields for SYSMgr-related mock types.
Tests/mocks/Iarm.cpp Implements IARM_Bus_Disconnect, IARM_Bus_Term, IARM_Bus_RegisterEvent and exports corresponding function pointers.
Comments suppressed due to low confidence (1)

Tests/mocks/Wraps.cpp:533

  • Wraps::fopen no longer falls back to ::fopen when impl is null (it now hard-asserts). This is a behavior change relative to the previous implementation and is inconsistent with other wrappers here (e.g. Wraps::open / Wraps::stat still fall back to the real libc call). If tests rely on real file I/O when no mock is installed, this will now fail; either restore the fallback or apply a consistent policy across these wrappers.
FILE *Wraps::fopen(const char *pathname, const char *mode)
{
    FILE *result = nullptr;
    if (impl != nullptr)
    {

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

Comment thread Tests/mocks/Telemetry.h
Comment on lines 38 to 57
virtual void t2_init(char* component) = 0;
virtual void t2_uninit(void) = 0;
virtual T2ERROR t2_event_s(const char* marker, const char* value) = 0;
virtual T2ERROR t2_event_d(const char* marker, int value) = 0;
virtual T2ERROR t2_event_f(char* marker, double value) = 0;
};

class TelemetryApi {
protected:
static TelemetryApiImpl* impl;
public:
TelemetryApi();
TelemetryApi(const TelemetryApi &obj) = delete;
static void setImpl(TelemetryApiImpl* newImpl);
static void t2_init(char* component);
static void t2_uninit(void);
static T2ERROR t2_event_s(const char* marker, const char* value);
static T2ERROR t2_event_d(const char* marker, int value);
static T2ERROR t2_event_f(char* marker, double value);
};
Copy link

Copilot AI Apr 8, 2026

Choose a reason for hiding this comment

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

t2_event_f takes char* marker, which is inconsistent with t2_event_s/d (const char*) and unnecessarily drops constness. This makes common call sites like passing string literals or const char* markers fail to compile. Consider changing the marker parameter type to const char* (and update the corresponding mock method, implementation, and function pointer typedefs to match).

Copilot uses AI. Check for mistakes.
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