Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Build system generated files
Makefile
Makefile.in
aclocal.m4
autom4te.cache/
compile
config.guess
config.log
config.status
config.sub
configure
configure~
depcomp
install-sh
libtool
ltmain.sh
missing
m4/

# Build artifacts
*.o
*.lo
*.la
*.a
*.so
*.bin
*.deps/
*.dirstamp
.deps/
.libs/

# Source subdirectory build files
source/**/Makefile
source/**/Makefile.in
source/**/*.deps/
source/**/.libs/
31 changes: 31 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,41 @@ All notable changes to this project will be documented in this file. Dates are d

Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).

#### [1.8.5](https://github.com/rdkcentral/telemetry/compare/1.8.4...1.8.5)

- RDKEMW-15233: Previous log look up initialiation corrections [`#299`](https://github.com/rdkcentral/telemetry/pull/299)
Copy link

Copilot AI Mar 30, 2026

Choose a reason for hiding this comment

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

Spelling: “initialiation” → “initialization”.

Suggested change
- RDKEMW-15233: Previous log look up initialiation corrections [`#299`](https://github.com/rdkcentral/telemetry/pull/299)
- RDKEMW-15233: Previous log look up initialization corrections [`#299`](https://github.com/rdkcentral/telemetry/pull/299)

Copilot uses AI. Check for mistakes.

#### [1.8.4](https://github.com/rdkcentral/telemetry/compare/1.8.3...1.8.4)

> 23 March 2026

- RDKEMW-15233 [SERXIONE-8445/XIONE-18418] Develop Support Branch Integration [`#295`](https://github.com/rdkcentral/telemetry/pull/295)
- RDKB-63834: Reject and Remove Corrupted Config Files In Persistance [`#284`](https://github.com/rdkcentral/telemetry/pull/284)
- Changelog updates for 1.8.4 release [`a336d80`](https://github.com/rdkcentral/telemetry/commit/a336d80cd23321dee1defba998cb6460b3474b31)

#### [1.8.3](https://github.com/rdkcentral/telemetry/compare/1.8.2...1.8.3)

> 19 March 2026

- RDKB-63722: Build fix for ssl crypto error in platforms with lower ssl version [`#291`](https://github.com/rdkcentral/telemetry/pull/291)
- Changelog updates for 1.8.3 release [`cac6d7f`](https://github.com/rdkcentral/telemetry/commit/cac6d7f0182481bb1d1664bd0bc1afce9e429e25)

#### [1.8.2](https://github.com/rdkcentral/telemetry/compare/1.8.1...1.8.2)

> 18 March 2026

- RDKB-63722:Analyze and fix/mitigate memory leaks from curl_easy_perform calls [`#287`](https://github.com/rdkcentral/telemetry/pull/287)
- Agentic development and maintenance support [`#278`](https://github.com/rdkcentral/telemetry/pull/278)
- RDKEMW-10467: Fix Invalid time values caused by drift [`#212`](https://github.com/rdkcentral/telemetry/pull/212)
- Changelog updates for release 1.8.2 [`28b5426`](https://github.com/rdkcentral/telemetry/commit/28b542668e814411234f0a0d594e5c5d35b98319)

#### [1.8.1](https://github.com/rdkcentral/telemetry/compare/1.8.0...1.8.1)

> 27 February 2026

- RDK-60476: Reduce default connection pool size to 1 [`#260`](https://github.com/rdkcentral/telemetry/pull/260)
- RDK-60805: Adding L1 unit test cases for reportprofiles [`#265`](https://github.com/rdkcentral/telemetry/pull/265)
- Changelog updates for 1.8.1 release [`074a1d3`](https://github.com/rdkcentral/telemetry/commit/074a1d32e33924ce0f39e7cd7aad5bd6750376d4)

#### [1.8.0](https://github.com/rdkcentral/telemetry/compare/1.7.4...1.8.0)

Expand Down
8 changes: 4 additions & 4 deletions source/bulkdata/reportprofiles.c
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,6 @@ static void* reportOnDemand(void *input)
if(!strncmp(action, ON_DEMAND_ACTION_UPLOAD, MAX_PROFILENAMES_LENGTH))
{
T2Info("Upload XCONF report on demand \n");
Copy link

Copilot AI Mar 30, 2026

Choose a reason for hiding this comment

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

reportOnDemand() previously set the scheduler flag (was set_logdemand(true)) before generating an on-demand report. With that removed, on-demand uploads may no longer retain seekmap as intended (and behavior will depend on whatever global flag value happens to be set). Set set_retainseekmap(true) (or otherwise pass the intent) before calling generateDcaReport(false, true).

Suggested change
T2Info("Upload XCONF report on demand \n");
T2Info("Upload XCONF report on demand \n");
set_retainseekmap(true);

Copilot uses AI. Check for mistakes.
set_logdemand(true);
generateDcaReport(false, true);
}
else if(!strncmp(action, ON_DEMAND_ACTION_ABORT, MAX_PROFILENAMES_LENGTH))
Expand Down Expand Up @@ -486,6 +485,10 @@ T2ERROR initReportProfiles()
drop_root();
#endif

//Initialise the properties file RDK-58222
T2InitProperties();
T2Info("Initializing properties\n");

#if defined (PRIVACYMODES_CONTROL)
// Define scope
{
Expand Down Expand Up @@ -640,9 +643,6 @@ T2ERROR initReportProfiles()

}

//Initialise the properties file RDK-58222
T2InitProperties();
T2Info("InitProperties is successful\n");

// This indicates telemetry has started
FILE* bootFlag = NULL ;
Expand Down
5 changes: 3 additions & 2 deletions source/dcautil/dca.c
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ static int getLogSeekValue(hash_map_t *logSeekMap, const char *name, long *seek_
T2Debug("logSeekMap is null .. Setting seek value to 0 \n");
*seek_value = 0 ;
}

T2Debug("seekvalue for file %s is %ld\n", name, *seek_value);
T2Debug("%s --out \n", __FUNCTION__);
return rc;
}
Expand Down Expand Up @@ -524,6 +524,7 @@ static int getCountPatternMatch(FileDescriptor* fileDescriptor, GrepMarker* mark

// Using the union for efficient memory handling
marker->u.count = count;
T2Debug("Count Marker: Marker = %s Value %d\n", marker->markerName, marker->u.count);
T2Debug("%s --out\n", __FUNCTION__);
return 0;
}
Expand Down Expand Up @@ -634,7 +635,7 @@ static int getAbsolutePatternMatch(FileDescriptor* fileDescriptor, GrepMarker* m
{
marker->u.markerValue = result;
}

T2Debug("Absolute Marker: Marker = %s Value %s\n", marker->markerName, marker->u.markerValue);
T2Debug("%s --out\n", __FUNCTION__);
return 0;
}
Expand Down
2 changes: 1 addition & 1 deletion source/protocol/http/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ AM_CFLAGS =
lib_LTLIBRARIES = libhttp.la

libhttp_la_SOURCES = curlinterface.c multicurlinterface.c
libhttp_la_LDFLAGS = -shared -fPIC -lcurl
libhttp_la_LDFLAGS = -shared -fPIC -lcurl -lcrypto
Copy link

Copilot AI Mar 30, 2026

Choose a reason for hiding this comment

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

-lcrypto is added unconditionally to libhttp_la_LDFLAGS, but configure.ac does not currently check for libcrypto/OpenSSL headers. This can break cross-compiles or platforms where libcurl is not built on OpenSSL (or OpenSSL dev headers/libs aren’t present). Consider making libcrypto linkage conditional on a configure-time check and only enabling the OpenSSL-specific code paths when that check succeeds.

Suggested change
libhttp_la_LDFLAGS = -shared -fPIC -lcurl -lcrypto
libhttp_la_LDFLAGS = -shared -fPIC -lcurl

Copilot uses AI. Check for mistakes.
if IS_LIBRDKCERTSEL_ENABLED
libhttp_la_CFLAGS = $(LIBRDKCERTSEL_FLAG)
libhttp_la_LDFLAGS += -lRdkCertSelector -lrdkconfig
Expand Down
49 changes: 49 additions & 0 deletions source/protocol/http/multicurlinterface.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@
#include <sys/stat.h>
#include <signal.h>
#include <time.h>
#include <openssl/err.h>
#include <openssl/crypto.h>
Comment on lines +36 to +37
Copy link

Copilot AI Mar 30, 2026

Choose a reason for hiding this comment

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

This file now includes and calls OpenSSL-specific APIs (<openssl/err.h>, OPENSSL_thread_stop, ERR_clear_error) unconditionally. The build system currently does not appear to detect/configure an OpenSSL dependency (no OpenSSL/libcrypto checks in configure.ac), and libcurl can be built against non-OpenSSL TLS backends. Please add compile-time guards and an Autotools feature check (e.g., AC_CHECK_HEADERS/AC_CHECK_LIB or pkg-config) so builds without OpenSSL headers/libcrypto still work (either by disabling this cleanup path or using a curl-backend-agnostic approach).

Suggested change
#include <openssl/err.h>
#include <openssl/crypto.h>
/*
* OpenSSL usage in this file is optional. We attempt to include the headers
* only if they are available; otherwise we provide no-op fallbacks so that
* builds without OpenSSL headers/libs still compile and link.
*/
#if defined(__has_include)
# if __has_include(<openssl/err.h>) && __has_include(<openssl/crypto.h>)
# include <openssl/err.h>
# include <openssl/crypto.h>
# define T2_HAVE_OPENSSL 1
# endif
#endif
#ifndef T2_HAVE_OPENSSL
#define T2_HAVE_OPENSSL 0
/* No-op fallbacks when OpenSSL is not available */
static inline void t2_openssl_thread_stop_fallback(void)
{
/* Intentionally empty: OpenSSL not available */
}
static inline void t2_openssl_err_clear_fallback(void)
{
/* Intentionally empty: OpenSSL not available */
}
/* Map OpenSSL APIs to local no-op fallbacks when headers are absent. */
#ifndef OPENSSL_thread_stop
#define OPENSSL_thread_stop() t2_openssl_thread_stop_fallback()
#endif
#ifndef ERR_clear_error
#define ERR_clear_error() t2_openssl_err_clear_fallback()
#endif
#endif /* !T2_HAVE_OPENSSL */

Copilot uses AI. Check for mistakes.
#include "multicurlinterface.h"
#include "busInterface.h"
#include "t2log_wrapper.h"
Expand Down Expand Up @@ -279,6 +281,27 @@ T2ERROR init_connection_pool()
CURL_SETOPT_CHECK(pool_entries[i].easy_handle, CURLOPT_SSLVERSION, CURL_SSLVERSION_DEFAULT);
CURL_SETOPT_CHECK(pool_entries[i].easy_handle, CURLOPT_SSL_VERIFYPEER, 1L);

// Memory-bounding options for long-running daemon.
// MAXCONNECTS=1: limits cached connections per handle to one entry
// without this the internal connection cache silently accumulates SSL
// session objects whenever the target IP or cert rotates.
CURL_SETOPT_CHECK(pool_entries[i].easy_handle, CURLOPT_MAXCONNECTS, 1L);
// SSL_SESSIONID_CACHE=0: disables the SSL session-ticket cache in the
// handle's SSL_CTX.
CURL_SETOPT_CHECK(pool_entries[i].easy_handle, CURLOPT_SSL_SESSIONID_CACHE, 0L);

// Bound DNS cache lifetime to match server reset interval.
// Load balancer IPs rotate; without this limit, stale IP->hostname
// mappings accumulate in the handle's DNS cache alongside stale
// connection objects — same class of problem as MAXCONNECTS.
CURL_SETOPT_CHECK(pool_entries[i].easy_handle, CURLOPT_DNS_CACHE_TIMEOUT, 30L);

// Limit the receive buffer to 8KB
CURL_SETOPT_CHECK(pool_entries[i].easy_handle, CURLOPT_BUFFERSIZE, 8192L);

// Limit the send buffer to 8KB (Requires libcurl 7.62.0+)
CURL_SETOPT_CHECK(pool_entries[i].easy_handle, CURLOPT_UPLOAD_BUFFERSIZE, 8192L);
Comment on lines +302 to +303
Copy link

Copilot AI Mar 30, 2026

Choose a reason for hiding this comment

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

CURLOPT_UPLOAD_BUFFERSIZE is not available in older libcurl versions (as noted in the comment) and this call is currently unguarded. This will cause compile failures on platforms with older libcurl headers. Please wrap this option in an #ifdef CURLOPT_UPLOAD_BUFFERSIZE guard (similar to how CURLOPT_TCP_KEEPCNT is handled).

Suggested change
// Limit the send buffer to 8KB (Requires libcurl 7.62.0+)
CURL_SETOPT_CHECK(pool_entries[i].easy_handle, CURLOPT_UPLOAD_BUFFERSIZE, 8192L);
// Limit the send buffer to 8KB (Requires libcurl 7.62.0+)
#ifdef CURLOPT_UPLOAD_BUFFERSIZE
CURL_SETOPT_CHECK(pool_entries[i].easy_handle, CURLOPT_UPLOAD_BUFFERSIZE, 8192L);
#endif

Copilot uses AI. Check for mistakes.

#ifdef LIBRDKCERTSEL_BUILD
// Initialize certificate selectors for each easy handle
bool state_red_enable = false;
Expand Down Expand Up @@ -661,6 +684,17 @@ T2ERROR http_pool_get(const char *url, char **response_data, bool enable_file_ou
{
free(pCertPC);
}
#endif
ERR_clear_error();

// Release all OpenSSL per-thread state (ERR stack, cached allocations).
// Called at the end of the worker thread's HTTP operation to prevent
// thread-local memory from accumulating across the daemon lifetime.

#if OPENSSL_VERSION_NUMBER >= 0x10100000L
OPENSSL_thread_stop();
#else
ERR_remove_thread_state(NULL);
#endif
release_pool_handle(idx);
return T2ERROR_FAILURE;
Expand Down Expand Up @@ -784,6 +818,13 @@ T2ERROR http_pool_get(const char *url, char **response_data, bool enable_file_ou
// Important Note: When using LIBRDKCERTSEL_BUILD, pCertURI and pCertPC are owned by the
// cert selector object and are freed when rdkcertselector_free() is called

// Clear OpenSSL per-thread error queue.
// Every curl_easy_perform() may push records onto the per-thread ERR_STATE
// list on any TLS error (cert verify failure, connection reset, timeout).
// Without this call the list grows unboundedly over the daemon lifetime.
// ERR_clear_error() is thread-safe since OpenSSL 1.1.0.
ERR_clear_error();

release_pool_handle(idx);

T2Debug("%s ++out\n", __FUNCTION__);
Expand Down Expand Up @@ -1059,6 +1100,14 @@ T2ERROR http_pool_post(const char *url, const char *payload)
pCertPC = NULL;
}
#endif

// Release all OpenSSL per-thread state at the end of the worker thread's
// HTTP operation
#if OPENSSL_VERSION_NUMBER >= 0x10100000L
OPENSSL_thread_stop();
#else
ERR_remove_thread_state(NULL);
#endif
// Note: When using LIBRDKCERTSEL_BUILD, pCertURI and pCertPC are owned by the
// cert selector object and are freed when rdkcertselector_free() is called
release_pool_handle(idx);
Expand Down
22 changes: 11 additions & 11 deletions source/scheduler/scheduler.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,21 +44,21 @@ static ActivationTimeoutCB activationTimeoutCb;
static Vector *profileList = NULL;
static pthread_mutex_t scMutex;
static bool sc_initialized = false;
static bool islogdemand = false;
static bool isretainSeekmap = true;
Copy link

Copilot AI Mar 30, 2026

Choose a reason for hiding this comment

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

isretainSeekmap default was changed from false (previous islogdemand) to true. With current TimeoutThread() logic, this makes the else branch (which passes isClearSeekMap=true) effectively unreachable and changes behavior for LOG_UPLOAD interrupts (seekmap would be retained by default). To preserve previous semantics, initialize this flag to false and only set it to true for on-demand uploads where seekmap must be retained.

Suggested change
static bool isretainSeekmap = true;
static bool isretainSeekmap = false;

Copilot uses AI. Check for mistakes.

static bool signalrecived_and_executing = true;
static bool is_activation_time_out = false;

bool get_logdemand ()
bool get_retainseekmap ()
{
T2Info(("get_logdemand ++in\n"));
return islogdemand;
T2Info(("get_retainseekmap ++in\n"));
return isretainSeekmap;
}

void set_logdemand (bool value)
void set_retainseekmap (bool value)
{
T2Info(("set_logdemand ++in\n"));
islogdemand = value;
T2Info(("set_retainseekmap ++in\n"));
isretainSeekmap = value;
}

void freeSchedulerProfile(void *data)
Expand Down Expand Up @@ -297,14 +297,14 @@ void* TimeoutThread(void *arg)

if(minThresholdTime == 0)
{
if (get_logdemand() == true)
if (get_retainseekmap() == true)
{
set_logdemand(false);
timeoutNotificationCb(tProfile->name, false);
timeoutNotificationCb(tProfile->name, false); // Passing clearseekvalue as false
}
else
{
timeoutNotificationCb(tProfile->name, true);
set_retainseekmap(true); //After triggering LOG upload resetting the retainseekmap value to true so the next report generation doesn't affect
timeoutNotificationCb(tProfile->name, true); //Passing clearseek value as true
Comment on lines +300 to +307
Copy link

Copilot AI Mar 30, 2026

Choose a reason for hiding this comment

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

In the interrupt path, when get_retainseekmap() is true you never reset it back to the default state (the previous code did set_logdemand(false) after consuming the on-demand flag). This causes subsequent non-on-demand LOG_UPLOAD interrupts to incorrectly retain seekmap. Consider resetting the flag after handling the retain case, and avoid setting it to true in the branch that calls timeoutNotificationCb(..., true) (that branch represents the clear-seekmap case).

Copilot uses AI. Check for mistakes.
}
if(tProfile->terminated)
{
Expand Down
4 changes: 2 additions & 2 deletions source/scheduler/scheduler.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ T2ERROR unregisterProfileFromScheduler(const char* profileName);

T2ERROR SendInterruptToTimeoutThread(char* profileName);

bool get_logdemand();
bool get_retainseekmap();

void set_logdemand(bool value);
void set_retainseekmap(bool value);

#endif /* _SCHEDULER_H_ */
3 changes: 1 addition & 2 deletions source/telemetry2_0.c
Original file line number Diff line number Diff line change
Expand Up @@ -181,13 +181,12 @@ void sig_handler(int sig, siginfo_t* info, void* uc)
else if ( sig == SIGUSR1 || sig == LOG_UPLOAD )
{
T2Info(("LOG_UPLOAD received!\n"));
set_logdemand(false);
set_retainseekmap(false);
ReportProfiles_Interrupt();
}
else if (sig == LOG_UPLOAD_ONDEMAND || sig == SIGIO)
{
T2Info(("LOG_UPLOAD_ONDEMAND received!\n"));
Copy link

Copilot AI Mar 30, 2026

Choose a reason for hiding this comment

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

The LOG_UPLOAD_ONDEMAND/SIGIO signal handler no longer sets the scheduler flag used to retain the seekmap (previously set_logdemand(true)). As a result, on-demand uploads may clear/retain seekmap based on stale state rather than the signal type. Set set_retainseekmap(true) (or equivalent) in this branch before interrupting report generation.

Suggested change
T2Info(("LOG_UPLOAD_ONDEMAND received!\n"));
T2Info(("LOG_UPLOAD_ONDEMAND received!\n"));
set_retainseekmap(true);

Copilot uses AI. Check for mistakes.
set_logdemand(true);
ReportProfiles_Interrupt();
}
else if(sig == SIGUSR2 || sig == EXEC_RELOAD)
Expand Down
4 changes: 2 additions & 2 deletions source/test/bulkdata/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ profile_gtest_bin_CPPFLAGS = -I$(PKG_CONFIG_SYSROOT_DIR)/usr/include/gtest -I$(P

profile_gtest_bin_SOURCES = gtest_main.cpp ../mocks/SystemMock.cpp ../mocks/FileioMock.cpp ../mocks/rdklogMock.cpp ../mocks/rbusMock.cpp ../mocks/rdkconfigMock.cpp ../mocks/VectorMock.cpp SchedulerMock.cpp profileMock.cpp ../../bulkdata/profile.c profileTest.cpp ../../utils/persistence.c ../../utils/t2common.c ../../utils/t2collection.c ../../utils/t2MtlsUtils.c ../../utils/t2log_wrapper.c ../../dcautil/dcautil.c ../../dcautil/dca.c ../../dcautil/legacyutils.c ../../dcautil/dcaproc.c ../../xconf-client/xconfclient.c ../../protocol/rbusMethod/rbusmethodinterface.c ../../privacycontrol/rdkservices_privacyutils.c ../../reportgen/reportgen.c ../../bulkdata/t2eventreceiver.c ../../bulkdata/t2markers.c ../../t2parser/t2parser.c ../../bulkdata/datamodel.c ../../t2parser/t2parserxconf.c ../../bulkdata/reportprofiles.c ../../bulkdata/profilexconf.c ../../ccspinterface/rbusInterface.c ../../ccspinterface/busInterface.c ../../protocol/http/curlinterface.c ../../protocol/http/multicurlinterface.c

profile_gtest_bin_LDFLAGS = -L/usr/src/googletest/googletest/lib/.libs -lgcov -L/src/googletest/googlemock/lib -L/usr/src/googletest/googlemock/lib/.libs -L/usr/include/glib-2.0 -lgmock -lcjson -lcurl -lmsgpackc -lgtest -lgtest_main -lglib-2.0
profile_gtest_bin_LDFLAGS = -L/usr/src/googletest/googletest/lib/.libs -lgcov -L/src/googletest/googlemock/lib -L/usr/src/googletest/googlemock/lib/.libs -L/usr/include/glib-2.0 -lgmock -lcjson -lcurl -lcrypto -lmsgpackc -lgtest -lgtest_main -lglib-2.0

profile_gtest_bin_LDFLAGS += -Wl,--wrap=sendReportOverHTTP -Wl,--wrap=sendCachedReportsOverHTTP

Expand All @@ -69,7 +69,7 @@ reportprofiles_gtest_bin_CPPFLAGS = -I$(PKG_CONFIG_SYSROOT_DIR)/usr/include/gtes

reportprofiles_gtest_bin_SOURCES = gtest_main.cpp ../mocks/SystemMock.cpp ../mocks/FileioMock.cpp ../mocks/rdklogMock.cpp ../mocks/rbusMock.cpp ../mocks/rdkconfigMock.cpp ../mocks/VectorMock.cpp SchedulerMock.cpp reportprofileMock.cpp ../../bulkdata/reportprofiles.c reportprofilesTest.cpp ../../utils/persistence.c ../../utils/t2common.c ../../utils/t2collection.c ../../utils/t2MtlsUtils.c ../../utils/t2log_wrapper.c ../../dcautil/dcautil.c ../../dcautil/dca.c ../../dcautil/legacyutils.c ../../dcautil/dcaproc.c ../../xconf-client/xconfclient.c ../../protocol/rbusMethod/rbusmethodinterface.c ../../privacycontrol/rdkservices_privacyutils.c ../../reportgen/reportgen.c ../../bulkdata/t2eventreceiver.c ../../bulkdata/t2markers.c ../../t2parser/t2parser.c ../../bulkdata/datamodel.c ../../t2parser/t2parserxconf.c ../../bulkdata/profile.c ../../bulkdata/profilexconf.c ../../ccspinterface/rbusInterface.c ../../ccspinterface/busInterface.c ../../protocol/http/curlinterface.c ../../protocol/http/multicurlinterface.c

reportprofiles_gtest_bin_LDFLAGS = -L/usr/src/googletest/googletest/lib/.libs -L/usr/src/googletest/googlemock/lib/.libs -lgmock -lgtest -lpthread -lcjson -lmsgpackc -lglib-2.0 -lrt -lcurl
reportprofiles_gtest_bin_LDFLAGS = -L/usr/src/googletest/googletest/lib/.libs -L/usr/src/googletest/googlemock/lib/.libs -lgmock -lgtest -lpthread -lcjson -lmsgpackc -lglib-2.0 -lrt -lcurl -lcrypto

reportprofiles_gtest_bin_LDFLAGS += -Wl,--wrap=isRbusEnabled -Wl,--wrap=sendReportOverHTTP -Wl,--wrap=sendCachedReportsOverHTTP

8 changes: 4 additions & 4 deletions source/test/bulkdata/SchedulerMock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,22 +85,22 @@ T2ERROR SendInterruptToTimeoutThread(char* profileName)
return T2ERROR_SUCCESS;
}

bool get_logdemand()
bool get_retainseekmap()
{
if (g_schedulerMock)
{
return g_schedulerMock->get_logdemand();
return g_schedulerMock->get_retainseekmap();
}

// Fallback implementation for when mock is not set
return false;
}

void set_logdemand(bool value)
void set_retainseekmap(bool value)
{
if (g_schedulerMock)
{
g_schedulerMock->set_logdemand(value);
g_schedulerMock->set_retainseekmap(value);
return;
}

Expand Down
4 changes: 2 additions & 2 deletions source/test/bulkdata/SchedulerMock.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ class SchedulerMock
MOCK_METHOD(T2ERROR, registerProfileWithScheduler, (const char* profileName, unsigned int timeInterval, unsigned int activationTimeout, bool deleteonTimout, bool repeat, bool reportOnUpdate, unsigned int firstReportingInterval, char *timeRef), ());
MOCK_METHOD(T2ERROR, unregisterProfileFromScheduler, (const char* profileName), ());
MOCK_METHOD(T2ERROR, SendInterruptToTimeoutThread, (char* profileName), ());
MOCK_METHOD(bool, get_logdemand, (), ());
MOCK_METHOD(void, set_logdemand, (bool value), ());
MOCK_METHOD(bool, get_retainseekmap, (), ());
MOCK_METHOD(void, set_retainseekmap, (bool value), ());
MOCK_METHOD(int, getLapsedTime, (struct timespec *result, struct timespec *x, struct timespec *y), ());
};

Expand Down
4 changes: 2 additions & 2 deletions source/test/bulkdata/profileTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -823,8 +823,8 @@ TEST_F(ProfileTest, privacymode_do_not_share) {
}

TEST_F(ProfileTest, generateDcaReport) {
// generateDcaReport may call set_logdemand
EXPECT_CALL(*g_schedulerMock, set_logdemand(_))
// generateDcaReport may call set_retainseekmap
EXPECT_CALL(*g_schedulerMock, set_retainseekmap(_))
.Times(::testing::AtMost(2)); // Allow up to 2 calls

generateDcaReport(false, true);
Expand Down
2 changes: 1 addition & 1 deletion source/test/dcautils/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@ dcautil_gtest_bin_SOURCES = gtest_main.cpp ../mocks/SystemMock.cpp ../mocks/File

#dcautil_gtest_bin_SOURCES = gtest_main.cpp ../mocks/SystemMock.cpp ../mocks/FileioMock.cpp ../mocks/rdklogMock.cpp ../mocks/rbusMock.cpp ../xconf-client/xconfclientTest.cpp ../xconf-client/xconfclientMock.cpp ../mocks/rdkconfigMock.cpp ../../utils/persistence.c ../../utils/t2common.c ../../utils/t2collection.c ../../utils/vector.c ../../utils/t2MtlsUtils.c ../../utils/t2log_wrapper.c ../../dcautil/dcautil.c ../../dcautil/dca.c ../../dcautil/legacyutils.c ../../dcautil/dcaproc.c ../../commonlib/telemetry_busmessage_sender.c ../../xconf-client/xconfclient.c ../../protocol/http/curlinterface.c ../../protocol/rbusMethod/rbusmethodinterface.c ../../privacycontrol/rdkservices_privacyutils.c ../../reportgen/reportgen.c ../../t2parser/t2parser.c

dcautil_gtest_bin_LDFLAGS = -L/usr/src/googletest/googletest/lib/.libs -lgcov -L/src/googletest/googlemock/lib -L/usr/src/googletest/googlemock/lib/.libs -L/usr/include/glib-2.0 -lgmock -lcjson -lcurl -lmsgpackc -lgtest -lgtest_main -lglib-2.0
dcautil_gtest_bin_LDFLAGS = -L/usr/src/googletest/googletest/lib/.libs -lgcov -L/src/googletest/googlemock/lib -L/usr/src/googletest/googlemock/lib/.libs -L/usr/include/glib-2.0 -lgmock -lcjson -lcurl -lcrypto -lmsgpackc -lgtest -lgtest_main -lglib-2.0
16 changes: 16 additions & 0 deletions source/test/mocks/FileioMock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -473,6 +473,22 @@ extern "C" int fprintf(FILE* stream, const char* format, ...) {
va_end(args);
return result;
}

/* Intercept the FORTIFY_SOURCE-hardened variant of fprintf */
extern "C" int __fprintf_chk(FILE* stream, int /*flag*/, const char* format, ...) {
va_list args;
va_start(args, format);
int result = -1;

if (g_fileIOMock) {
result = g_fileIOMock->fprintf(stream, format, args);
}
else {
result = vfprintf(stream, format, args);
}
va_end(args);
return result;
}
/*
extern "C" CURLcode curl_easy_setopt(CURL *curl, CURLoption option, ...)
{
Expand Down
Loading
Loading