Skip to content

RDKEMW-18541: While configuring the report profile telemetry.txt.0 logs contains garbage data#378

Open
AravindanNC wants to merge 3 commits into
developfrom
topic/RDKEMW-18541_UT
Open

RDKEMW-18541: While configuring the report profile telemetry.txt.0 logs contains garbage data#378
AravindanNC wants to merge 3 commits into
developfrom
topic/RDKEMW-18541_UT

Conversation

@AravindanNC
Copy link
Copy Markdown
Contributor

Reason for change: Update L1 tests for RDKEMW-18541 fix PR 377
Test Procedure: Build RDKE image

Signed-off-by: nc.aravindan@gmail.com

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 updates the BulkData L1 Google Test suite to add coverage related to RDKEMW-18541, specifically aiming to validate behavior when an RBUS_METHOD profile repeatedly fails and should be deleted without causing use-after-free / “garbage profile name” logs.

Changes:

  • Added two new ProfileTest cases intended to validate the “async delete” behavior after repeated RBUS_METHOD failures.
  • Added additional mock expectations and manual Profile test setup/teardown to support these scenarios.

Comment on lines +1539 to +1541
EXPECT_CALL(*g_vectorMock, Vector_Size(_))
.Times(::testing::AtLeast(5))
.WillRepeatedly(Return(0));
Comment on lines +1559 to +1561
ASSERT_GT(testProfile->SendErr, 3);
ASSERT_FALSE(rbusCheckMethodExists(testProfile->t2RBUSDest->rbusMethodName));

Comment on lines +1488 to +1495
/*
* Test: Verify that when an RBUS_METHOD profile fails SendErr > 3 times
* and rbusCheckMethodExists returns false, the profile is queued for
* async deletion (not deleted synchronously from CollectAndReport).
*
* This test ensures the fix prevents use-after-free by deferring deletion
* to a separate thread after CollectAndReport exits.
*/
Comment on lines +1625 to +1627
EXPECT_CALL(*g_vectorMock, Vector_Size(_))
.Times(::testing::AtLeast(5))
.WillRepeatedly(Return(0));
Comment on lines +1633 to +1636
// Verify the conditions that trigger async delete
ASSERT_GT(testProfile->SendErr, 3);
ASSERT_FALSE(rbusCheckMethodExists(testProfile->t2RBUSDest->rbusMethodName));
ASSERT_TRUE(testProfile->enable); // Should be true before delete path
Comment on lines +1581 to +1588
/*
* Test: Verify that CollectAndReport exits the do/while loop correctly
* after the async delete is queued, not attempting to access freed
* profile memory.
*
* This test ensures profile->enable is not read from freed memory,
* preventing the garbage profile name log observed in the bug.
*/
Copilot AI review requested due to automatic review settings June 2, 2026 15:54
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 1 out of 1 changed files in this pull request and generated 7 comments.

Comment on lines +1567 to +1569
if (testProfile->grepSeekProfile) {
// logFileSeekMap cleanup: hash_map_remove requires a key argument,
// so we skip it here since we're freeing the entire structure
Comment on lines +1646 to +1648
free(testProfile->t2RBUSDest);
if (testProfile->grepSeekProfile) {
// logFileSeekMap cleanup: hash_map_remove requires a key argument,
Comment on lines +1538 to +1541
EXPECT_CALL(*g_vectorMock, Vector_Size(_))
.Times(::testing::AtLeast(5))
.WillRepeatedly(Return(0));

Comment on lines +1624 to +1627
// Mock expectations
EXPECT_CALL(*g_vectorMock, Vector_Size(_))
.Times(::testing::AtLeast(5))
.WillRepeatedly(Return(0));
Comment on lines +1487 to +1495
TEST_F(ProfileTest, CollectAndReport_AsyncDeleteOnRBUSMethodFailure) {
/*
* Test: Verify that when an RBUS_METHOD profile fails SendErr > 3 times
* and rbusCheckMethodExists returns false, the profile is queued for
* async deletion (not deleted synchronously from CollectAndReport).
*
* This test ensures the fix prevents use-after-free by deferring deletion
* to a separate thread after CollectAndReport exits.
*/
Comment on lines +1546 to +1550
// Mock rbusCheckMethodExists to return false (method provider not found)
// This is the key condition for triggering the async delete path
EXPECT_CALL(*g_rbusMock, rbusCheckMethodExists(StrEq("Device.X_FAILED_Method")))
.Times(::testing::AtLeast(1))
.WillRepeatedly(Return(false));
Comment on lines +1628 to +1630

EXPECT_CALL(*g_rbusMock, rbusCheckMethodExists(_))
.Times(::testing::AtLeast(1))
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