Skip to content

Add unit tests for isSecureDbgSrvUnlocked gating logic#218

Draft
Copilot wants to merge 4 commits into
topic/RDKEMW-13335from
copilot/sub-pr-205-one-more-time
Draft

Add unit tests for isSecureDbgSrvUnlocked gating logic#218
Copilot wants to merge 4 commits into
topic/RDKEMW-13335from
copilot/sub-pr-205-one-more-time

Conversation

Copy link
Copy Markdown

Copilot AI commented Mar 17, 2026

The new isSecureDbgSrvUnlocked ePROD unlock path (requires isDebugServicesEnabled RFC + deviceType == "test" RFC + LABSIGNED_ENABLED == "true") had no test coverage. Two existing GetServURL PROD+DebugEnabled tests were also broken by the new logic since they only mocked isDebugServicesEnabled without satisfying the additional LABSIGNED/deviceType conditions.

New tests — isSecureDbgSrvUnlocked

Seven tests covering all gate combinations directly against isSecureDbgSrvUnlocked(BUILDTYPE):

Scenario Expected
Non-PROD (eVBN) unlocked
ePROD + labsigned=true + deviceType=test + dbgServices=true unlocked
ePROD + labsigned=true + deviceType=prod locked
ePROD + labsigned=true + deviceType=unknown locked
ePROD + labsigned=false locked
ePROD + labsigned=true + deviceType=test + dbgServices=false locked
ePROD + getDevicePropertyData fails (-1) locked
TEST_F(DeviceApiTestFixture, TestName_isSecureDbgSrvUnlocked_Prod_Labsigned_DeviceTypeTest_DbgEnabled)
{
    EXPECT_CALL(*g_DeviceUtilsMock, isDebugServicesEnabled()).Times(1).WillOnce(Return(true));
    EXPECT_CALL(*g_DeviceUtilsMock, getDeviceTypeRFC(_, _))
        .Times(1)
        .WillOnce(Invoke([](char* deviceType, size_t size) {
            strncpy(deviceType, "test", size - 1);
            deviceType[size - 1] = '\0';
        }));
    EXPECT_CALL(*g_DeviceUtilsMock, getDevicePropertyData(StrEq("LABSIGNED_ENABLED"), _, _))
        .Times(1)
        .WillOnce(Invoke([](const char*, char* data, int size) {
            strncpy(data, "true", size - 1);
            data[size - 1] = '\0';
            return 0;
        }));
    EXPECT_TRUE(isSecureDbgSrvUnlocked(ePROD));
}

Fixed tests — GetServURL PROD+DebugServices_Enabled

TestName_GetServURL_SuccessStatered_Prod_DebugServices_Enabled and TestName_GetServURL_SuccessSwupdate_Prod_DebugServices_Enabled now mock getDeviceTypeRFC (→ "test") and getDevicePropertyData("LABSIGNED_ENABLED") (→ "true") to satisfy the full unlock gate, restoring the intended test behavior.


📱 Kick off Copilot coding agent tasks wherever you are with GitHub Mobile, available on iOS and Android.

Copilot AI and others added 3 commits March 17, 2026 07:14
… tests

Co-authored-by: KTirumalaSrihari <102281309+KTirumalaSrihari@users.noreply.github.com>
Co-authored-by: KTirumalaSrihari <102281309+KTirumalaSrihari@users.noreply.github.com>
…ailure cause

Co-authored-by: KTirumalaSrihari <102281309+KTirumalaSrihari@users.noreply.github.com>
Copilot AI changed the title [WIP] [WIP] Address feedback on unlocking debug service mechanism Add unit tests for isSecureDbgSrvUnlocked gating logic Mar 17, 2026
Copilot AI requested a review from KTirumalaSrihari March 17, 2026 07:19
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