Skip to content

Rebase - #45

Open
adrojaankur wants to merge 49 commits into
support/1.1.0from
develop
Open

adrojaankur wants to merge 49 commits into
support/1.1.0from
develop

Conversation

@adrojaankur

Copy link
Copy Markdown
Contributor

No description provided.

rdkcmf-jenkins and others added 30 commits June 24, 2025 15:07
Co-authored-by: Saranya <saranya_elango@comcast.com>
Co-authored-by: nhanasi <navihansi@gmail.com>
Reason for change: Refactor the RDKLogger component in such a way that,
1. The config file debug.ini is only for the override;
2. Must log even if new module not present in debug.ini
3. The config file must say only the specific level; not individual log levels
4. Default loglevel must be based on LOG.RDK.DEFAULT
5. Remove log4crc overrides

Test Procedure: Tested and verified
Risks: Medium
Signed-off-by: dshett549 <DEEPTHICHANDRASHEKAR_SHETTY@comcast.com>
Signed-off-by: Karunakaran A <karunakaran_amirthalingam@cable.comcast.com>
Co-authored-by: Karunakaran A <48997923+karuna2git@users.noreply.github.com>
Release of RDKLogger v2.0.0
Reason for change: Refactor the RDKLogger component in such a way that,
1. The config file debug.ini is only for the override;
2. Must log even if new module not present in debug.ini
3. The config file must say only the specific level; not individual log levels
4. Default loglevel must be based on LOG.RDK.DEFAULT
5. Remove log4crc overrides

Test Procedure: Tested and verified
Risks: Medium
Signed-off-by: dshett549 <DEEPTHICHANDRASHEKAR_SHETTY@comcast.com>
Signed-off-by: Karunakaran A <karunakaran_amirthalingam@cable.comcast.com>
Co-authored-by: Karunakaran A <48997923+karuna2git@users.noreply.github.com>
Release of RDKLogger v2.0.0
* RDKB-60970: RDKLogger OpenSource Migration

Reason for change: To fix compilation errors
Test Procedure: Tested and verified
Risks:Medium
Priority:P1
Signed-off-by: dshett549 <DEEPTHICHANDRASHEKAR_SHETTY@comcast.com>
Signed-off-by: karunakaran_amirthalingam <karunakaran_amirthalingam@cable.comcast.com>
Release of RDKLogger v2.1.0
* RDKB-60970: RDKLogger OpenSource Migration

Reason for change: To fix compilation errors
Test Procedure: Tested and verified
Risks:Medium
Priority:P1
Signed-off-by: dshett549 <DEEPTHICHANDRASHEKAR_SHETTY@comcast.com>
Signed-off-by: karunakaran_amirthalingam <karunakaran_amirthalingam@cable.comcast.com>
Release of RDKLogger v2.1.0
* Add new API to convert string log_level to type rdk_logLevel
* Resolve warnings from code
* Update rdk_dynamic_logger.c
---------

Signed-off-by: dshett549 <DEEPTHICHANDRASHEKAR_SHETTY@comcast.com>
Signed-off-by: Karunakaran A <Karunakaran_Amirthalingam@cable.comcast.com>
* Add new API to convert string log_level to type rdk_logLevel
* Resolve warnings from code
* Update rdk_dynamic_logger.c
---------

Signed-off-by: dshett549 <DEEPTHICHANDRASHEKAR_SHETTY@comcast.com>
Signed-off-by: Karunakaran A <Karunakaran_Amirthalingam@cable.comcast.com>
Release of v2.2.0

Signed-off-by: kamirt573_comcast <karunakaran_amirthalingam@cable.comcast.com>
Release of v2.2.0

Signed-off-by: kamirt573_comcast <karunakaran_amirthalingam@cable.comcast.com>
Reason for change: Add rdk_dbg_* APIs for Backward Compatibility
Test Procedure: Verify WiFi Motion
Risks: Low
Signed-off-by: dshett549 DEEPTHICHANDRASHEKAR_SHETTY@comcast.com
Co-authored-by: Deepthi C Shetty <115452109+dshett549@users.noreply.github.com>
* Updated the documentation

Signed-off-by: Karunakaran A <karunakaran_amirthalingam@cable.comcast.com>
Reason for change: Add rdk_dbg_* APIs for Backward Compatibility
Test Procedure: Verify WiFi Motion
Risks: Low
Signed-off-by: dshett549 DEEPTHICHANDRASHEKAR_SHETTY@comcast.com
Co-authored-by: Deepthi C Shetty <115452109+dshett549@users.noreply.github.com>
* Updated the documentation

Signed-off-by: Karunakaran A <karunakaran_amirthalingam@cable.comcast.com>
Release of v2.3.0
Signed-off-by: kamirt573_comcast <karunakaran_amirthalingam@cable.comcast.com>
Deploy fossid_integration_stateless_diffscan_target_repo action
Reason for change: Post Code Coverage in the PR workflow
Test Procedure: Tested and verified
Risks: Low
Signed-off-by: Rose Mary Benny RoseMary_Benny@comcast.com
Reason for change: for optimization
Test Procedure: Tested and verified
Risks:Medium
Priority:P1

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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


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

karuna2git and others added 2 commits February 24, 2026 17:30
Reason for change: Move the log4c init to logger init
Test Procedure: Verify logging
Risks: Medium

Signed-off-by: Karunakaran A <karunakaran_amirthalingam@cable.comcast.com>
Signed-off-by: Karunakaran A <karunakaran_amirthalingam@cable.comcast.com>
Copilot AI review requested due to automatic review settings February 25, 2026 00:30

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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


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

Comment thread src/rdk_logger_init.c
Comment on lines 115 to 121
rdk_Error rdk_logger_deinit()
{
if(isLogInited)
pthread_mutex_lock(&gInitMutex);
if (isLogInited)
{
//rdk_dbgDeinit();
rdk_dyn_log_deInit();
//rdk_dbg_priv_DeInit();
rdk_logger_env_rem_conf_details();
log4c_fini();
//isLogInited = 0;
rdk_dyn_log_deinit();
}

Copilot AI Feb 25, 2026

Copy link

Choose a reason for hiding this comment

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

rdk_logger_deinit() closes the dynamic logger socket but never resets isLogInited (and doesn't call any logger/log4c deinit). After a deinit(), subsequent rdk_logger_init() calls will be a no-op, leaving dynamic logging disabled and preventing reconfiguration. Either (a) make deinit symmetrical (call rdk_dbg_priv_deinit(), set isLogInited=false, and clean up resources), or (b) if deinit is intentionally a no-op, avoid closing the dynamic logger socket and/or document that deinit does not permit re-init.

Copilot uses AI. Check for mistakes.
Comment thread docs/QUICK_REFERENCE.md
Comment on lines +15 to +22
// Extended initialization with file logging
rdk_logger_ext_config_t config = {
.fileName = "app.log",
.logdir = "/var/log/",
.maxSize = 1024*1024, // 1MB
.maxCount = 5 // Keep 5 files
};
rdk_logger_ext_init(&config);

Copilot AI Feb 25, 2026

Copy link

Choose a reason for hiding this comment

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

The rdk_logger_ext_config_t example here uses fields like .fileName, .logdir, .maxSize, .maxCount that don't exist in the current public struct (it now uses output, format, and pFilePolicy). This example won't compile and will mislead users—please update it to match the actual API.

Copilot uses AI. Check for mistakes.
Comment thread docs/QUICK_REFERENCE.md Outdated
Comment on lines +114 to +117
break;
case LVL_TEST:
strcpy(level_str, "~NONE");
break;

Copilot AI Feb 25, 2026

Copy link

Choose a reason for hiding this comment

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

This test case uses ~NONE as a log level for rdklogctrl, but rdklogctrl no longer supports ~-prefixed levels. As written, the command will fail (and the test currently ignores the system() return code), so it isn't exercising the intended behavior. Update the test to use supported levels and assert on the command exit status/output (or reintroduce ~ support if it's required).

Copilot uses AI. Check for mistakes.
Comment thread include/rdk_debug.h


#ifndef _RDK_DEBUG_H_
#ifndef _RDK_DEBUG_H

Copilot AI Feb 25, 2026

Copy link

Choose a reason for hiding this comment

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

Header guard macro is inconsistent: #ifndef _RDK_DEBUG_H but #define _RDK_DEBUG_H_. This defeats the include guard and can cause multiple-definition / redefinition issues on repeated includes. Use the same macro name in both directives (and in the closing #endif comment).

Suggested change
#ifndef _RDK_DEBUG_H
#ifndef _RDK_DEBUG_H_

Copilot uses AI. Check for mistakes.
Comment thread include/rdk_logger.h
Comment on lines +159 to +163
#define RDK_LOGGER_INIT() (0 == access(DEBUG_INI_OVERRIDE_PATH_1, F_OK)) \
? rdk_logger_init(DEBUG_INI_OVERRIDE_PATH_1) \
: (0 == access(DEBUG_INI_OVERRIDE_PATH_2, F_OK)) \
? rdk_logger_init(DEBUG_INI_OVERRIDE_PATH_2) \
: rdk_logger_init(DEBUG_INI_NAME);

Copilot AI Feb 25, 2026

Copy link

Choose a reason for hiding this comment

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

RDK_LOGGER_INIT() macro includes a trailing semicolon, which breaks common usage patterns like if (RDK_LOGGER_INIT() != RDK_SUCCESS) { ... } (as shown in the docs). Define it as a pure expression (no trailing ;) and consider wrapping the whole ternary in parentheses for safe use in larger expressions.

Suggested change
#define RDK_LOGGER_INIT() (0 == access(DEBUG_INI_OVERRIDE_PATH_1, F_OK)) \
? rdk_logger_init(DEBUG_INI_OVERRIDE_PATH_1) \
: (0 == access(DEBUG_INI_OVERRIDE_PATH_2, F_OK)) \
? rdk_logger_init(DEBUG_INI_OVERRIDE_PATH_2) \
: rdk_logger_init(DEBUG_INI_NAME);
#define RDK_LOGGER_INIT() ((0 == access(DEBUG_INI_OVERRIDE_PATH_1, F_OK)) \
? rdk_logger_init(DEBUG_INI_OVERRIDE_PATH_1) \
: ((0 == access(DEBUG_INI_OVERRIDE_PATH_2, F_OK)) \
? rdk_logger_init(DEBUG_INI_OVERRIDE_PATH_2) \
: rdk_logger_init(DEBUG_INI_NAME)))

Copilot uses AI. Check for mistakes.
Comment thread src/rdk_logger_init.c
Comment on lines +42 to +45
static pthread_mutex_t gInitMutex = PTHREAD_MUTEX_INITIALIZER;

bool isLogInited = false;

Copilot AI Feb 25, 2026

Copy link

Choose a reason for hiding this comment

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

isLogInited is a non-static global symbol. Since it is only used to protect internal initialization state, keeping it static avoids exporting an unnecessary symbol from the shared library and prevents accidental external linkage/ABI coupling.

Copilot uses AI. Check for mistakes.
@github-advanced-security

Copy link
Copy Markdown

You are seeing this message because GitHub Code Scanning has recently been set up for this repository, or this pull request contains the workflow file for the Code Scanning tool.

What Enabling Code Scanning Means:

  • The 'Security' tab will display more code scanning analysis results (e.g., for the default branch).
  • Depending on your configuration and choice of analysis tool, future pull requests will be annotated with code scanning analysis results.
  • You will be able to see the analysis results for the pull request's branch on this overview once the scans have completed and the checks have passed.

For more information about GitHub Code Scanning, check out the documentation.

cpu_usage = (float)(100.0 * (double)(diff_total - diff_idle) / (double)diff_total);
}

FILE* file = fopen("cpu.txt", "a+");
// Test very large configuration file
TEST_F(RDKLoggerConfigTest, LargeConfigFile) {
// Create a large configuration file
FILE* file = fopen("/tmp/rdk_logger_test/large.ini", "w");
snprintf(long_module, sizeof(long_module), "LOG.RDK.%s",
"VERY_LONG_MODULE_NAME_THAT_EXCEEDS_NORMAL_LENGTH_AND_SHOULD_BE_HANDLED_GRACEFULLY_BY_THE_CONFIGURATION_PARSER");

FILE* file = fopen("/tmp/rdk_logger_test/long_names.ini", "w");
* Added README.md for rdklogger

* Apply suggestions from code review

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

* Addressed review comment

---------

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings August 6, 2026 12:28
@rdkcmf-jenkins

Copy link
Copy Markdown
Contributor

b'## Blackduck scan failure details

Summary: 0 violations, 0 files pending approval, 1 file pending identification.

  • Protex Server Path: /home/blackduck/github/rdk_logger/45/rdk/components/generic/rdk_logger

  • Commit: 5ccaad2

Report detail: gist'

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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

Suppressed comments (12)

include/rdk_debug.h:26

  • Header guard macro is inconsistent: the file checks _RDK_DEBUG_H but defines _RDK_DEBUG_H_, so the guard will not work as intended.
#ifndef _RDK_DEBUG_H
#define _RDK_DEBUG_H_

src/rdk_logger_init.c:121

  • rdk_logger_deinit() closes the dynamic logger socket but never resets isLogInited or deinitializes the underlying debug subsystem. After a deinit, subsequent rdk_logger_init() calls will not reconfigure or restart dynamic logging, and the logger state is left partially initialized.
    utils/rdklogctrl.c:113
  • app_len and comp_len are written into a fixed 128-byte packet buffer without validating bounds. Long argv values can overflow buf and also truncate lengths into a single byte, producing malformed packets.
    docs/QUICK_REFERENCE.md:19
  • The rdk_logger_ext_config_t example uses fields (fileName, logdir, maxSize, maxCount) that do not exist in the new public struct. This example won’t compile for users following the quick reference.
// Extended initialization with file logging
rdk_logger_ext_config_t config = {
    .fileName = "app.log",
    .logdir = "/var/log/",
    .maxSize = 1024*1024,    // 1MB

docs/QUICK_REFERENCE.md:88

  • The quick reference documents rdklogctrl ... ~DEBUG to disable a specific log level, but utils/rdklogctrl.c no longer accepts the ~ prefix. This will mislead users.
# Disable specific level (~ prefix)
rdklogctrl myapp LOG.RDK.NETWORK ~DEBUG

unittests/rdkLoggerDynamic.cpp:117

  • This test generates the log level string ~NONE, but rdklogctrl no longer supports the ~ prefix. The system() call will fail and the test won't actually exercise the intended dynamic logger behavior.
    src/rdk_dynamic_logger.c:42
  • rdk_dyn_log_logLevelToString returns string literals; the return type should be const char * to avoid discarding const qualifiers.
    src/rdk_logger_init.c:66
  • When debugConfigFile is NULL, the implementation falls back to DEBUG_CONF_FILE (currently built as a relative debug.ini). This is inconsistent with RDK_LOGGER_INIT() in include/rdk_logger.h (which selects /opt, /nvram, then /etc) and makes rdk_logger_init(NULL) unreliable in production and tests.
    src/rdk_debug.c:118
  • rdk_logger_enable_logLevel() ignores the enableLogLvl parameter, so callers cannot actually disable a log level as the API contract implies. This is a behavioral change for legacy consumers and should be either implemented consistently or the API/docs updated to reflect the new semantics.
    utils/rdklogctrl.c:43
  • validate_loglevel() uses strncmp() with fixed lengths, so values like ERROR123 are accepted as valid. It also doesn't accept the common spelling WARNING even though other parts of the code/docs use it.
    unittests/test_utils.h:20
  • After fork(), the child should use _exit() rather than exit() to avoid running parent atexit handlers / flushing shared stdio buffers twice. This can cause flaky test behavior.
    unittests/rdkLoggerConfigTest.cpp:132
  • This test expects rdk_logger_init(NULL) to succeed, but unittests/rdkloggerInit.cpp now asserts the opposite and the current implementation falls back to a relative debug.ini which typically won’t exist in the test working directory. The tests are inconsistent and this one will likely fail.

Comment thread src/Makefile.am
##########################################################################

AM_CPPFLAGS = -pthread -Wall
AM_CFLAGS = -pthread -Wall -Werror
Comment thread src/rdk_dynamic_logger.c Outdated
@rdkcmf-jenkins

Copy link
Copy Markdown
Contributor

b'## WARNING: A Blackduck scan failure has been waived

A prior failure has been upvoted

  • Upvote reason: OK

  • Commit: 5ccaad2
    '

Comment thread .github/workflows/cla.yml
jobs:
CLA-Lite:
name: "Signature"
uses: rdkcentral/cmf-actions/.github/workflows/cla.yml@v1
uses: rdkcentral/build_tools_workflows/.github/workflows/fossid_integration_stateless_diffscan.yml@develop
secrets:
if: ${{ ! github.event.pull_request.head.repo.fork }}
uses: rdkcentral/build_tools_workflows/.github/workflows/fossid_integration_stateless_diffscan.yml@1.0.0
* Stack buffer overflow in rdk_dyn_log_validate_component_name() via attacker-controlled comp_len. select()+blocking recvfrom() race on shared global socket can hang arbitrary daemon threads inside RDK_LOG()
* Log forging / CRLF and control-character injection in rendered log output
* Stack buffer overflow in rdklogctrl via unbounded argv copies
* L1/L2 test cases added for Mythos defects
* Define new structure for dynamic log messages

Signed-off-by: Deepthi <DEEPTHICHANDRASHEKAR_SHETTY@comcast.com>
Copilot AI balanced review requested due to automatic review settings October 14, 2026 15:08
Comment thread src/rdk_dynamic_logger.c Fixed

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔵 Needs a closer look

Public initialization and level-control APIs are broken, lifecycle reinitialization fails, and the test harness currently masks failures.

2 open findings
Previously missed (5)

In code that hasn't changed since last review

Medium severity enableLogLvl parameter is ignored

src/​rdk_debug.c:116

enableLogLvl is ignored, so passing FALSE still sets the requested level instead of disabling it. This breaks the retained public API and the examples that rely on enable/disable behavior; either implement both states in the backend or remove/migrate this API and its callers.

Medium severity RDK_LOG_NONE maps to the wrong Log4C priority

src/​rdk_dynamic_logger.c:75

RDK_LOG_NONE is accepted here and forwarded to rdk_dbg_priv_log_reconfig, where it maps to LOG4C_PRIORITY_UNKNOWN; configuration parsing uses LOG4C_PRIORITY_NONE instead. Consequently the advertised rdklogctrl ... NONE path does not disable the category and can enable valid severities under Log4C's priority ordering.

Medium severity Test runner always reports success

unittests/​main.cpp:35

The test runner always returns success even when RUN_ALL_TESTS() reports failures, so the workflow cannot fail on a broken test suite. Return the GoogleTest result after printing the diagnostic.

Medium severity Child test failures are not propagated

unittests/​test_utils.h:19

The child always exits with status 0, so nonfatal GoogleTest failures in test_body are discarded and the parent assertion passes. Fatal ASSERT_* calls are also unsafe here because they can return before this exit; use GoogleTest death/subprocess support or explicitly propagate child failures.

Low severity Priority list contradicts logger initialization fallback order

docs/​QUICK_REFERENCE.md:72

This priority list contradicts RDK_LOGGER_INIT(), which checks /opt/debug.ini first, then /nvram/debug.ini, then /etc/debug.ini. A custom path passed directly to rdk_logger_init() is not the third fallback in that chain.

🧠 Review effort: Balanced

Comment thread utils/rdklogctrl.c Fixed
* Implement per-process Unix datagram socket replacing UDP broadcast

Signed-off-by: Deepthi <DEEPTHICHANDRASHEKAR_SHETTY@comcast.com>

* Implement rdk_logger_get_logLevel functionality

Signed-off-by: Deepthi <DEEPTHICHANDRASHEKAR_SHETTY@comcast.com>

* Address Copilot review comments

Signed-off-by: Deepthi <DEEPTHICHANDRASHEKAR_SHETTY@comcast.com>


* Updated the rdklogger dynamic logging API and added new GetLevel() API

Signed-off-by: Karunakaran A <karunakaran_amirthalingam@cable.comcast.com>
---------

Signed-off-by: Deepthi <DEEPTHICHANDRASHEKAR_SHETTY@comcast.com>
Signed-off-by: Karunakaran A <karunakaran_amirthalingam@cable.comcast.com>
Co-authored-by: udaykrishnag <33549128+udaykrishnag@users.noreply.github.com>
Co-authored-by: Karunakaran A <karunakaran_amirthalingam@cable.comcast.com>
Copilot AI balanced review requested due to automatic review settings October 22, 2026 22:05

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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


- name: Build and execute L1 unittesting for rdk_logger
run: |
mkdir -p /opt/logs
Comment thread src/rdk_debug.c
Comment on lines +99 to +100
if (module)
return rdk_dbg_priv_set_level(module, logLevel);
Comment thread src/rdk_dynamic_logger.c
Comment on lines +97 to 98
if (pthread_mutex_trylock(&g_dl_request_mutex) != 0)
return;
Comment thread src/rdk_debug.c
Comment on lines +126 to +128
(void) enableLogLvl;
if (module)
return rdk_dbg_priv_set_level(module, logLevel);
Comment thread src/rdk_dynamic_logger.c
if (-1 == bind(g_dl_socket, (struct sockaddr *)&my_addr, sizeof(struct sockaddr))) {
snprintf(myAddr.sun_path, sizeof(myAddr.sun_path), "%s_%s.%ld", RDK_DYNAMIC_SOCKET_PATH_PREFIX, __progname, (long)getpid());

bind_result = bind(g_dl_socket, (struct sockaddr *)&myAddr, sizeof(myAddr));
Comment thread unittests/test_utils.h
Comment on lines +17 to +19
test_body; \
log4c_fini(); \
exit(0); \
Comment thread README.md
Comment on lines +40 to +44
rdklogctrl <process_name> <module_name> <log_level>

# Examples
rdklogctrl myapp LOG.RDK.NETWORK DEBUG
rdklogctrl receiver LOG.RDK.AUDIO INFO
Comment thread docs/QUICK_REFERENCE.md
Comment on lines +70 to +72
1. `/nvram/debug.ini` (override - highest priority)
2. `/etc/debug.ini` (default)
3. Custom path via `rdk_logger_init(path)`
Comment thread docs/QUICK_REFERENCE.md
Comment on lines +89 to +90
# Disable specific level (~ prefix)
rdklogctrl "$(pidof -s myapp)" LOG.RDK.NETWORK ~DEBUG
Comment thread docs/QUICK_REFERENCE.md
Comment on lines +144 to +147
void cleanup_handler(int sig) {
RDK_LOG(RDK_LOG_NOTICE, MODULE_NAME, "Shutting down (signal %d)\n", sig);
rdk_logger_deinit();
exit(0);
Signed-off-by: Karunakaran A <karunakaran_amirthalingam@cable.comcast.com>
Copilot AI balanced review requested due to automatic review settings October 23, 2026 03:09

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

Unresolved build, test-registration/install, CI, runtime-control, API, test-reliability, and documentation defects block approval.

16 open issues
2 previously missed issues

In code that hasn't changed since last review

Medium severity Isolate tests from shared logger singleton state

unittests/​rdkLoggerErrorTest.cpp:45

This cleanup does not reset the logger singleton: rdk_logger_deinit() leaves isLogInited and the existing categories intact. The fixture's subsequent rdk_logger_init(test.ini) calls therefore return success without loading the INFO/DEBUG configuration created in SetUp, and the full runner inherits configuration and level changes from earlier suites. Isolate these cases before logger initialization so the error paths run under their intended configuration rather than shared, order-dependent state.

Medium severity Verify the attached console appender

unittests/​test_rdkloggerExtInit.cpp:70

Extended initialization attaches LOG.RDK.print, not LOG.RDK.stdout. Since log4c_appender_get() creates missing appenders, this assertion succeeds on a new, unattached object and cannot detect a missing console appender. Read the appender attached to category_name rather than creating one with the expected name.

Review effort: Balanced

Comment thread src/Makefile.am
librdkloggers_la_LDFLAGS = $(GLIB_LIBS) $(LOG4C_LIBS) $(SYSLOG_HELPER_LDFLAGS) $(SYSTEMD_LDFLAGS)
librdkloggers_la_CPPFLAGS = $(GLIB_CFLAGS) -I$(top_srcdir)/src/include -I$(top_srcdir)/include
librdkloggers_la_SOURCES = rdk_debug.c rdk_debug_priv.c rdk_dynamic_logger.c rdk_logger_init.c rdk_logger_milestone.c rdk_logger_onboard.c
librdkloggers_la_CFLAGS = $(LOG4C_CFLAGS) $(GLIB_CFLAGS) $(SYSTEMD_CFLAGS) -I$(top_srcdir)/include -I$(top_srcdir)/src/include -DDEBUG_CONF_FILE="\"debug.ini\""
Comment thread unittests/CMakeLists.txt
target_compile_definitions(rdk_logger_gtest PRIVATE GTEST_DEBUG_INI_FILE="sample_gtest_debug.ini")


install (CODE "execute_process (COMMAND ${CMAKE_COMMAND} -E copy Gtest_log4crc ${CMAKE_INSTALL_PREFIX}/log4crc)")
Comment thread unittests/CMakeLists.txt
include(GoogleTest)
gtest_discover_tests(rdk_logger_gtest)
find_package(Threads)
install (TARGETS rdk_logger_gtest RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
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.