Skip to content

Feature/rdk 60236 file#190

Open
Abhinavpv28 wants to merge 79 commits intodevelopfrom
feature/RDK-60236_file
Open

Feature/rdk 60236 file#190
Abhinavpv28 wants to merge 79 commits intodevelopfrom
feature/RDK-60236_file

Conversation

@Abhinavpv28
Copy link
Copy Markdown
Contributor

No description provided.

Copilot AI review requested due to automatic review settings May 3, 2026 15:53
@Abhinavpv28 Abhinavpv28 requested a review from a team as a code owner May 3, 2026 15:53
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 3, 2026

Code Coverage Summary

                               Total:|83.2%   5939|96.9%  1534|    -      0

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 adds support for issue type strings that include a dynamic suffix (e.g., identifiers appended after an underscore) by splitting the base issue type from its suffix and incorporating the suffix into the uploaded tar/log name.

Changes:

  • Added utilities to split an issue type into base + suffix and persist/retrieve the suffix via a temp file.
  • Updated issue event processing to use only the base issue type for JSON lookup/command execution, while using the persisted suffix for upload naming.
  • Expanded issue-type sanitization to allow _ and -.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 5 comments.

File Description
src/rrdJsonParser.h Exposes new suffix persistence and issue-type splitting helpers.
src/rrdJsonParser.c Implements suffix persistence/readback and uses it when building the upload name.
src/rrdEventProcess.c Splits issue types before processing; persists suffix for later upload; updates sanitization to retain _/-.

Comment thread src/rrdJsonParser.c Outdated
Comment thread src/rrdEventProcess.c
Comment thread src/rrdEventProcess.c Outdated
Comment on lines +82 to +85
char base[128] = {0};
char local_suffix[128] = {0};
split_issue_type(cmdMap[index], base, sizeof(base), local_suffix, sizeof(local_suffix));
dataMsgLen = strlen(base) + 1;
Comment thread src/rrdJsonParser.c
Comment thread src/rrdJsonParser.c Outdated
Comment on lines +641 to +652
// Use the persisted suffix from file for upload
char suffix[128] = {0};
read_suffix_from_file_to_buf(suffix, sizeof(suffix));
char tarName[512] = {0};
if (suffix[0] != '\0') {
snprintf(tarName, sizeof(tarName), "%s%s", buff->mdata, suffix);
} else {
snprintf(tarName, sizeof(tarName), "%s", buff->mdata);
}
RDK_LOG(RDK_LOG_INFO, LOG_REMDEBUG, "[%s:%d]: [INFO] Tar file name for upload: '%s'\n", __FUNCTION__, __LINE__, tarName);
status = uploadDebugoutput(outdir, tarName);
persist_suffix_to_file(""); // Clear the suffix file after upload
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 3, 2026

Code Coverage Summary

                               Total:|83.1%   5940|96.9%  1534|    -      0

Copilot AI review requested due to automatic review settings May 3, 2026 17:24
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 3, 2026

Code Coverage Summary

                               Total:|83.1%   5940|96.9%  1534|    -      0

@Abhinavpv28
Copy link
Copy Markdown
Contributor Author

@copilot

add gtest testcases for new functions added

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 4, 2026

Code Coverage Summary

                               Total:|83.6%   6103|97.2%  1616|    -      0

Copilot AI review requested due to automatic review settings May 4, 2026 10:21
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 5 out of 5 changed files in this pull request and generated 5 comments.

Comment thread src/rrdJsonParser.c Outdated
Comment on lines +50 to +66

void persist_suffix_to_file(const char *filename, const char *suffix)
{
int fd;
if (!filename)
{
RDK_LOG(RDK_LOG_ERROR, LOG_REMDEBUG, "[%s:%d]: persist_suffix_to_file called with NULL filename\n", __FUNCTION__, __LINE__);
return;
}
fd = open(filename, O_WRONLY | O_CREAT | O_TRUNC | O_NOFOLLOW, 0600);
if (fd >= 0)
{
FILE *fp = fdopen(fd, "w");
if (fp)
{
if (fprintf(fp, "%s\n", suffix) > 0)
{
Comment thread src/rrdJsonParser.c
Comment thread src/unittest/rrdUnitTestRunner.cpp
Comment thread src/unittest/rrdUnitTestRunner.cpp
Comment thread src/rrdCommon.h
Copilot AI review requested due to automatic review settings May 4, 2026 10:34
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 4, 2026

Code Coverage Summary

                               Total:|83.6%   6104|97.2%  1616|    -      0

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 5 out of 5 changed files in this pull request and generated 5 comments.

Comment thread src/rrdJsonParser.c Outdated
Comment thread src/rrdJsonParser.c
Comment thread src/rrdCommon.h
Comment thread src/rrdEventProcess.c
Comment thread src/unittest/rrdUnitTestRunner.cpp Outdated
Comment on lines +5824 to +5830
void SetUp() override {
struct stat dir_stat = {};

if (mkdir("/tmp/rrd", 0777) != 0) {
ASSERT_EQ(stat("/tmp/rrd", &dir_stat), 0) << "Failed to access /tmp/rrd";
ASSERT_TRUE(S_ISDIR(dir_stat.st_mode)) << "/tmp/rrd exists but is not a directory";
}
Copilot AI review requested due to automatic review settings May 4, 2026 11:39
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 4, 2026

Code Coverage Summary

                               Total:|83.5%   6116|97.2%  1616|    -      0

1 similar comment
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 4, 2026

Code Coverage Summary

                               Total:|83.5%   6116|97.2%  1616|    -      0

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 5 out of 5 changed files in this pull request and generated 3 comments.

Comment thread src/rrdJsonParser.c
Comment thread src/rrdJsonParser.c
Comment thread src/rrdEventProcess.c
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 4, 2026

Code Coverage Summary

                               Total:|83.3%   6134|97.2%  1616|    -      0

Copilot AI review requested due to automatic review settings May 4, 2026 11:55
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 5 out of 5 changed files in this pull request and generated 3 comments.

Comment thread src/unittest/rrdUnitTestRunner.cpp Outdated
persist_suffix_to_file("/tmp/rrd_suffix.txt","_OldSuffix");
persist_suffix_to_file("/tmp/rrd_suffix.txt","_NewSuffix");
char buf[64] = {0};
read_suffix_from_file_to_buf("/tmp/rrd/rrd_suffix.txt",buf, sizeof(buf));
Comment thread src/rrdEventProcess.c
Comment thread src/rrdJsonParser.c
Copilot AI review requested due to automatic review settings May 4, 2026 12:04
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 4, 2026

Code Coverage Summary

                               Total:|83.3%   6129|97.2%  1615|    -      0

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 5 out of 5 changed files in this pull request and generated 5 comments.

Comment thread src/rrdJsonParser.c
protected:
void TearDown() override {
// Remove suffix temp file to avoid state leakage between tests
remove("/tmp/rrd_suffix.txt");
Comment thread src/rrdJsonParser.c
Comment thread src/rrdEventProcess.c
Comment on lines +85 to +89
if (base[0] == '\0')
{
RDK_LOG(RDK_LOG_ERROR, LOG_REMDEBUG, "[%s:%d]: Invalid IssueType [%s] - empty base after split, skipping\n", __FUNCTION__, __LINE__, cmdMap[index]);
free(cmdBuff);
cmdBuff = NULL;
Comment thread src/rrdJsonParser.c
RDK_LOG(RDK_LOG_ERROR, LOG_REMDEBUG, "[%s:%d]: persist_suffix_to_file called with NULL filename\n", __FUNCTION__, __LINE__);
return;
}
fd = open(filename, O_WRONLY | O_CREAT | O_TRUNC | O_NOFOLLOW | O_CLOEXEC, 0600);
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.

4 participants