RDKEMW-18541: While configuring the report profile telemetry.txt.0 logs contains garbage data#378
Open
AravindanNC wants to merge 3 commits into
Open
RDKEMW-18541: While configuring the report profile telemetry.txt.0 logs contains garbage data#378AravindanNC wants to merge 3 commits into
AravindanNC wants to merge 3 commits into
Conversation
Contributor
There was a problem hiding this comment.
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
ProfileTestcases intended to validate the “async delete” behavior after repeatedRBUS_METHODfailures. - Added additional mock expectations and manual
Profiletest 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. | ||
| */ |
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)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Reason for change: Update L1 tests for RDKEMW-18541 fix PR 377
Test Procedure: Build RDKE image
Signed-off-by: nc.aravindan@gmail.com