Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
a377c5c
Updating the unit test script
Vismalskumar0 Jun 17, 2025
2293956
Update run_ut.sh
Vismalskumar0 Jun 22, 2025
24edac1
Deploy cla action
rdkcmf-jenkins Jun 24, 2025
666ca21
Merge pull request #33 from rdkcentral/develop
Vismalskumar0 Jun 26, 2025
95eba03
Merge pull request #25 from rdkcentral/topic/RDKEMW-5290
nhanasi Jun 27, 2025
ebfdceb
Revert "RDKEMW-5290-L1 Script change to check the failure in the work…
nhanasi Jun 27, 2025
3241b48
Merge pull request #35 from rdkcentral/revert-25-topic/RDKEMW-5290
Vismalskumar0 Jun 27, 2025
89808c2
RDK-48831 : L2 Test With CI Integration For SystimeManager (#31)
Saranya2421 Jun 27, 2025
8c237bf
RDKEMW-5290-L1 Script change to check the failure in the workflow (#38)
nhanasi Jun 27, 2025
855fdaf
RDKEMW-5290: Release 1.2.1
bpunnuru Jun 27, 2025
513469b
Merge branch 'release/1.2.1' into main
bpunnuru Jun 27, 2025
e2d50a1
Merge tag '1.2.1' into develop
bpunnuru Jun 27, 2025
3b6e15d
RDK-57964: T2 integration for systimemgr (#43)
sindhu-krishnan Jul 11, 2025
18e109f
1.3.0 release changelog updates
tdeva14 Jul 17, 2025
f327d55
Merge branch 'release/1.3.0' into main
tdeva14 Jul 17, 2025
9e6063f
Merge tag '1.3.0' into develop
tdeva14 Jul 17, 2025
b6c421a
RDKEMW-5185-Improve L1 Coverage for Systemtimemgr (#51)
Vismalskumar0 Jul 28, 2025
12508f3
RDK-57622 : [RDK-E] L2 test framework for SystemTime Manger Module Ph…
Saranya2421 Aug 12, 2025
df604e0
Update CODEOWNERS
sbarre01 Sep 22, 2025
27a25d1
Merge branch 'develop' into feature/action-deploy-for/develop
rdkcmf-jenkins Sep 25, 2025
78c65ab
Deploy cla action
rdkcmf-jenkins Sep 25, 2025
12552ab
Merge pull request #28 from rdkcentral/feature/action-deploy-for/develop
Alan-Ryan Sep 25, 2025
98dfd90
Deploy fossid_integration_stateless_diffscan_target_repo action
rdkcmf-jenkins Sep 29, 2025
c068021
Merge pull request #54 from rdkcentral/feature/actions/develop-fossid
Alan-Ryan Sep 29, 2025
15b65e0
RDK-58859 : 64-bit compilation support for systimemanager (#53)
Saranya2421 Oct 6, 2025
9da727f
RDKEMW-9619 : NTP Marker name update (#57)
sindhu-krishnan Dec 3, 2025
0c372c0
1.4.0 release changelog updates
tdeva14 Dec 3, 2025
f7c52d3
Merge branch 'release/1.4.0'
tdeva14 Dec 3, 2025
6583514
Merge tag '1.4.0' into develop
tdeva14 Dec 3, 2025
a11bb97
RDKEMW-14726: Implement Chrony runtime selection for Time Sync (#62)
sindhu-krishnan Mar 10, 2026
be9a8de
1.5.0 release changelog updates
tdeva14 Mar 10, 2026
8ee691e
Merge branch 'release/1.5.0'
tdeva14 Mar 10, 2026
3facedc
Merge tag '1.5.0' into develop
tdeva14 Mar 10, 2026
fbc6102
RDKEMW-15665 : Handle deepsleep case with chronyd (#66)
sindhu-krishnan Mar 20, 2026
42762a8
1.5.1 release changelog updates
tdeva14 Mar 20, 2026
519f014
Merge branch 'release/1.5.1'
tdeva14 Mar 20, 2026
1e3c2e2
Merge tag '1.5.1' into develop
tdeva14 Mar 20, 2026
82e5dea
RDKEMW-17125 - Subscribe to NWMgr plugin events from systimemgr (#72)
sindhu-krishnan May 14, 2026
554883e
1.6.0 release changelog updates
tdeva14 May 14, 2026
8d4ba83
Merge branch 'release/1.6.0'
tdeva14 May 14, 2026
0c32e07
Merge tag '1.6.0' into develop
tdeva14 May 14, 2026
588dfe2
RDKEMW-15246 : Chrony Enhancements (#79)
sindhu-krishnan May 22, 2026
aa122f1
RDKEMW-15246 : Chrony Enhancements (#78)
sindhu-krishnan May 25, 2026
0c00ff4
1.7.0 release changelog updates
tdeva14 May 25, 2026
1bf386d
Merge branch 'release/1.7.0'
tdeva14 May 25, 2026
5336f7b
Merge tag '1.7.0' into develop
tdeva14 May 25, 2026
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
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
# the repo. Unless a later match takes precedence,
# @global-owner1 and @global-owner2 will be requested for
# review when someone opens a pull request.
* @rdkcentral/rdke_ghec_sysint_maintainer @rdkcentral/rdke_ghec_sysint_admin
* @rdkcentral/rdke_ghec_sysint_maintainer
3 changes: 2 additions & 1 deletion .github/workflows/L1-Test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,5 @@ jobs:
- name: Upload test results to automatic test result management system
if: github.repository_owner == 'rdkcentral'
run: |
gtest-json-result-push.py /tmp/Gtest_Report https://rdkeorchestrationservice.apps.cloud.comcast.net/rdke_orchestration_api/push_unit_test_results `pwd`
# Point the script to the directory containing all XML reports
gtest-json-result-push.py /tmp/gtest_reports/ https://rdkeorchestrationservice.apps.cloud.comcast.net/rdke_orchestration_api/push_unit_test_results `pwd`
60 changes: 60 additions & 0 deletions .github/workflows/L2-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: L2 Integration Tests for systemtimemgr

on:
pull_request:
branches: [ develop , main ]

env:
AUTOMATICS_UNAME: ${{ secrets.AUTOMATICS_UNAME }}
AUTOMATICS_PASSCODE: ${{ secrets.AUTOMATICS_PASSCODE }}

jobs:
execute-l2-tests-on-pr:
name: Execute L2 Test in L2 Container Environment
runs-on: ubuntu-latest

steps:
- name: Checkout systemtimemgr Code
uses: actions/checkout@v4

- name: Log in to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Pull Mock XConf, Native Platform, and Docker RDK CI Images
run: |
docker pull ghcr.io/rdkcentral/docker-device-mgt-service-test/mockxconf:latest
docker pull ghcr.io/rdkcentral/docker-device-mgt-service-test/native-platform:latest
docker pull ghcr.io/rdkcentral/docker-rdk-ci:latest
- name: Start mock-xconf service
run: |
docker run -d --name mockxconf -p 50050:50050 -p 50051:50051 -p 50052:50052 -p 50053:50053 -v ${{ github.workspace }}:/mnt/L2_CONTAINER_SHARED_VOLUME ghcr.io/rdkcentral/docker-device-mgt-service-test/mockxconf:latest
- name: Start l2-container service
run: |
docker run -d --name native-platform --link mockxconf -v ${{ github.workspace }}:/mnt/L2_CONTAINER_SHARED_VOLUME ghcr.io/rdkcentral/docker-device-mgt-service-test/native-platform:latest
- name: Build systemtimemgr and Run L2 inside Native Platform Container
run: |
docker exec -i native-platform /bin/bash -c "cd /mnt/L2_CONTAINER_SHARED_VOLUME/ && sh ./cov_build.sh && export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib/x86_64-linux-gnu:/lib/aarch64-linux-gnu:/usr/local/lib && sh ./run_l2.sh"
- name: Copy L2 Test report to Host Runner
run: |
docker cp native-platform:/tmp/l2_test_report /tmp/L2_TEST_RESULTS
ls -lh /tmp/L2_TEST_RESULTS
- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v1
with:
install: true

- name: Run RDK CI Container
run: |
docker run -d --name ci-container -e AUTOMATICS_UNAME=${{ secrets.AUTOMATICS_UNAME }} -e AUTOMATICS_PASSCODE=${{ secrets.AUTOMATICS_PASSCODE }} -v /tmp/L2_TEST_RESULTS:/tmp/L2_TEST_RESULTS ghcr.io/rdkcentral/docker-rdk-ci:latest tail -f /dev/null
- name: Upload Results to Automatics
if: github.repository_owner == 'rdkcentral'
run: |
docker cp /tmp/L2_TEST_RESULTS ci-container:/tmp/L2_TEST_RESULTS
docker exec -i ci-container bash -c "echo 'Contents in workspace directory' && ls -l && echo '===============================' && echo 'Contents in /tmp/L2_TEST_RESULTS' && ls -l /tmp/L2_TEST_RESULTS && echo '===============================' && git config --global --add safe.directory /mnt/L2_CONTAINER_SHARED_VOLUME && gtest-json-result-push.py /tmp/L2_TEST_RESULTS https://rdkeorchestrationservice.apps.cloud.comcast.net/rdke_orchestration_api/push_unit_test_results /mnt/L2_CONTAINER_SHARED_VOLUME"
Comment on lines +13 to +60

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {contents: read}

Copilot Autofix

AI 10 months ago

To fix the issue, we need to add a permissions block to the workflow. This block should specify the minimal permissions required for the workflow to function correctly. Based on the tasks performed in the workflow, the contents: read permission is sufficient, as the workflow does not modify repository contents. If additional permissions are required for specific jobs, they can be defined within the respective job blocks.

The permissions block will be added at the root level of the workflow to apply to all jobs. This ensures that the GITHUB_TOKEN has limited access throughout the workflow.

Suggested changeset 1
.github/workflows/L2-tests.yml

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/.github/workflows/L2-tests.yml b/.github/workflows/L2-tests.yml
--- a/.github/workflows/L2-tests.yml
+++ b/.github/workflows/L2-tests.yml
@@ -6,2 +6,5 @@
 
+permissions:
+  contents: read
+
 env:
EOF
@@ -6,2 +6,5 @@

permissions:
contents: read

env:
Copilot is powered by AI and may make mistakes. Always verify output.
20 changes: 20 additions & 0 deletions .github/workflows/cla.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: "CLA"

permissions:
contents: read
pull-requests: write
actions: write
statuses: write

on:
issue_comment:
types: [created]
pull_request_target:
types: [opened, closed, synchronize]

jobs:
CLA-Lite:
name: "Signature"
uses: rdkcentral/cmf-actions/.github/workflows/cla.yml@v1
secrets:
PERSONAL_ACCESS_TOKEN: ${{ secrets.CLA_ASSISTANT }}
2 changes: 1 addition & 1 deletion .github/workflows/code-coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Code Coverage

on:
pull_request:
branches: [ main ]
branches: [ develop ]

jobs:
execute-unit-code-coverage-report-on-release:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
name: Fossid Stateless Diff Scan

on: pull_request
on:
pull_request:
types: [opened, synchronize, reopened]

permissions:
contents: read
pull-requests: read

jobs:
call-fossid-workflow:
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
secrets:
FOSSID_CONTAINER_USERNAME: ${{ secrets.FOSSID_CONTAINER_USERNAME }}
FOSSID_CONTAINER_PASSWORD: ${{ secrets.FOSSID_CONTAINER_PASSWORD }}
FOSSID_HOST_USERNAME: ${{ secrets.FOSSID_HOST_USERNAME }}
Expand Down
68 changes: 68 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,78 @@ 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.7.0](https://github.com/rdkcentral/systemtimemgr/compare/1.6.0...1.7.0)

- RDKEMW-15246 : Chrony Enhancements [`#78`](https://github.com/rdkcentral/systemtimemgr/pull/78)
- RDKEMW-15246 : Chrony Enhancements [`#79`](https://github.com/rdkcentral/systemtimemgr/pull/79)
- Merge tag '1.6.0' into develop [`0c32e07`](https://github.com/rdkcentral/systemtimemgr/commit/0c32e071dc2b36bc63dfded08d5f220dcc1e80cc)

#### [1.6.0](https://github.com/rdkcentral/systemtimemgr/compare/1.5.1...1.6.0)

> 14 May 2026

- RDKEMW-17125 - Subscribe to NWMgr plugin events from systimemgr [`#72`](https://github.com/rdkcentral/systemtimemgr/pull/72)
- 1.6.0 release changelog updates [`554883e`](https://github.com/rdkcentral/systemtimemgr/commit/554883e7bfb2d703c521d102d49a6c39b5afb227)
- Merge tag '1.5.1' into develop [`1e3c2e2`](https://github.com/rdkcentral/systemtimemgr/commit/1e3c2e2f86b20a608c469081c469ed72f65388a0)

#### [1.5.1](https://github.com/rdkcentral/systemtimemgr/compare/1.5.0...1.5.1)

> 20 March 2026

- RDKEMW-15665 : Handle deepsleep case with chronyd [`#66`](https://github.com/rdkcentral/systemtimemgr/pull/66)
- 1.5.1 release changelog updates [`42762a8`](https://github.com/rdkcentral/systemtimemgr/commit/42762a8f8e162705fb88bdb7485048796ca38622)
- Merge tag '1.5.0' into develop [`3facedc`](https://github.com/rdkcentral/systemtimemgr/commit/3facedcb74d9b0d0e4d63d0d146dac32d5fc153d)

#### [1.5.0](https://github.com/rdkcentral/systemtimemgr/compare/1.4.0...1.5.0)

> 10 March 2026

- RDKEMW-14726: Implement Chrony runtime selection for Time Sync [`#62`](https://github.com/rdkcentral/systemtimemgr/pull/62)
- 1.5.0 release changelog updates [`be9a8de`](https://github.com/rdkcentral/systemtimemgr/commit/be9a8de06bba9daf7071347031c95421c60b4783)
- Merge tag '1.4.0' into develop [`6583514`](https://github.com/rdkcentral/systemtimemgr/commit/6583514f6a6a7cbb496f06cb86318faf307ddff2)

#### [1.4.0](https://github.com/rdkcentral/systemtimemgr/compare/1.3.0...1.4.0)

> 3 December 2025

- RDKEMW-9619 : NTP Marker name update [`#57`](https://github.com/rdkcentral/systemtimemgr/pull/57)
- RDK-58859 : 64-bit compilation support for systimemanager [`#53`](https://github.com/rdkcentral/systemtimemgr/pull/53)
- Deploy fossid_integration_stateless_diffscan_target_repo action [`#54`](https://github.com/rdkcentral/systemtimemgr/pull/54)
- Deploy cla action [`#28`](https://github.com/rdkcentral/systemtimemgr/pull/28)
- RDK-57622 : [RDK-E] L2 test framework for SystemTime Manger Module Phase 1. [`#52`](https://github.com/rdkcentral/systemtimemgr/pull/52)
- RDKEMW-5185-Improve L1 Coverage for Systemtimemgr [`#51`](https://github.com/rdkcentral/systemtimemgr/pull/51)
- 1.4.0 release changelog updates [`0c372c0`](https://github.com/rdkcentral/systemtimemgr/commit/0c372c0c9eac5bd1720604d7d24eee7a7141815c)
- Update CODEOWNERS [`df604e0`](https://github.com/rdkcentral/systemtimemgr/commit/df604e0743ba77efcb69eddca2292b7bc3410e2f)
- Merge tag '1.3.0' into develop [`9e6063f`](https://github.com/rdkcentral/systemtimemgr/commit/9e6063f336380c4d04bc032cf0e1bd41e6f49910)

#### [1.3.0](https://github.com/rdkcentral/systemtimemgr/compare/1.2.1...1.3.0)

> 17 July 2025

- RDK-57964: T2 integration for systimemgr [`#43`](https://github.com/rdkcentral/systemtimemgr/pull/43)
- 1.3.0 release changelog updates [`18e109f`](https://github.com/rdkcentral/systemtimemgr/commit/18e109fbca50bc2c1d5ef18a9277bd97f65ad406)
- Merge tag '1.2.1' into develop [`e2d50a1`](https://github.com/rdkcentral/systemtimemgr/commit/e2d50a1db708d5bc78eaea5943114e62b8464497)

#### [1.2.1](https://github.com/rdkcentral/systemtimemgr/compare/1.2.0...1.2.1)

> 27 June 2025

- RDKEMW-5290-L1 Script change to check the failure in the workflow [`#38`](https://github.com/rdkcentral/systemtimemgr/pull/38)
- RDK-48831 : L2 Test With CI Integration For SystimeManager [`#31`](https://github.com/rdkcentral/systemtimemgr/pull/31)
- Revert "RDKEMW-5290-L1 Script change to check the failure in the workflow" [`#35`](https://github.com/rdkcentral/systemtimemgr/pull/35)
- RDKEMW-5290-L1 Script change to check the failure in the workflow [`#25`](https://github.com/rdkcentral/systemtimemgr/pull/25)
- rebase [`#33`](https://github.com/rdkcentral/systemtimemgr/pull/33)
- RDKEMW-5290: Release 1.2.1 [`855fdaf`](https://github.com/rdkcentral/systemtimemgr/commit/855fdafa82de774cd025fccc2922bd70972e90ff)
- Merge tag '1.2.0' into develop [`a271f67`](https://github.com/rdkcentral/systemtimemgr/commit/a271f6769560a12abb6d2f26a228e9b906b9399f)
- Update run_ut.sh [`2293956`](https://github.com/rdkcentral/systemtimemgr/commit/22939567fcb84aa6533f43f472f5037b12b7401f)

#### [1.2.0](https://github.com/rdkcentral/systemtimemgr/compare/1.1.0...1.2.0)

> 25 June 2025

- RDK-57157: Prototype to improve NTP (timesyncd) reliability [`#23`](https://github.com/rdkcentral/systemtimemgr/pull/23)
- RDK-57964 : Improve NTP Analytics [`#27`](https://github.com/rdkcentral/systemtimemgr/pull/27)
- Release 1.2.0 [`4b29cb4`](https://github.com/rdkcentral/systemtimemgr/commit/4b29cb478b2dbb14cb6ad885ee28dcfe2c0cbb73)
- Merge tag '1.1.0' into develop [`016e812`](https://github.com/rdkcentral/systemtimemgr/commit/016e8127110e91f26a5be0c6eb022d0b846b4317)

#### [1.1.0](https://github.com/rdkcentral/systemtimemgr/compare/1.0.0...1.1.0)
Expand Down
8 changes: 7 additions & 1 deletion Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,17 @@ bin_PROGRAMS = sysTimeMgr
lib_LTLIBRARIES = libsysTimeMgr.la

libsysTimeMgr_la_SOURCES = systimemgr.cpp
libsysTimeMgr_la_LDFLAGS = -lpthread -lsystimerfactory -lrdkloggers -lsecure_wrapper
libsysTimeMgr_la_LDFLAGS = -lpthread -lsystimerfactory -lrdkloggers -lsecure_wrapper -lchronyctl


sysTimeMgr_SOURCES = main.cpp
sysTimeMgr_LDADD = libsysTimeMgr.la


if IS_TELEMETRY2_ENABLED
libsysTimeMgr_la_CPPFLAGS = $(T2_EVENT_FLAG)
libsysTimeMgr_la_LDFLAGS += -ltelemetry_msgsender -lt2utils
endif

#libsysTimeMgr_la_includedir = ${includedir}
#libsysTimeMgr_la_include_HEADERS = systimemgr.h
14 changes: 14 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,20 @@ AC_ARG_ENABLE([dtt],
],
[echo "Tee build is enable"])

AC_ARG_ENABLE([t2api],
AS_HELP_STRING([--enable-t2api],[enables telemetry]),
[
case "${enableval}" in
yes) IS_TELEMETRY2_ENABLED=true
T2_EVENT_FLAG=" -DT2_EVENT_ENABLED ";;
no) IS_TELEMETRY2_ENABLED=false ;;
*) AC_MSG_ERROR([bad value ${enableval} for --enable-t2enable]) ;;
Copy link

Copilot AI Mar 20, 2026

Choose a reason for hiding this comment

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

--enable-t2api’s error message references --enable-t2enable, which looks like a typo and will confuse users when configure fails. Update the AC_MSG_ERROR text to reference the actual option name (--enable-t2api).

Suggested change
*) AC_MSG_ERROR([bad value ${enableval} for --enable-t2enable]) ;;
*) AC_MSG_ERROR([bad value ${enableval} for --enable-t2api]) ;;

Copilot uses AI. Check for mistakes.
esac
Comment on lines +90 to +94
Copy link

Copilot AI Mar 10, 2026

Choose a reason for hiding this comment

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

The AC_MSG_ERROR text references --enable-t2enable, but the option is --enable-t2api. Please fix the message so users get the correct guidance when passing an invalid value.

Copilot uses AI. Check for mistakes.
],
[echo "telemetry is disabled"])
AM_CONDITIONAL([IS_TELEMETRY2_ENABLED], [test x$IS_TELEMETRY2_ENABLED = xtrue])
AC_SUBST(T2_EVENT_FLAG)

AC_CONFIG_FILES(Makefile)
AC_SUBST(DEBUG_CXXFLAGS)
AC_SUBST(TEE_CXXFLAGS)
Expand Down
17 changes: 15 additions & 2 deletions cov_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,21 @@ WORKDIR=`pwd`
apt-get update
apt-get install -y libjsonrpccpp-dev

git clone https://github.com/rdkcentral/time-utils.git
cd time-utils/
cd libchronyctl/
autoreconf -i
./configure --prefix=/usr/local
make
make install
cd ../..

cd $WORKDIR/systimerfactory
autoreconf -i
export CXXFLAGS="-I../interface/ "
# -D__LOCAL_TEST_ makes networkstatussrc.cpp use WPEFrameworkMock.h instead of
# the real Thunder/WPEFramework headers, so this local-test build does not
# require those headers during this configure/build step.
export CXXFLAGS="-I../interface/ -D__LOCAL_TEST_"
./configure --prefix=${RDKLOGGER_INSTALL_DIR}
make clean && make && make install

Expand All @@ -33,8 +45,9 @@ export INSTALL_DIR='/usr/local'
export top_srcdir=`pwd`
export top_builddir=`pwd`


autoreconf --install
export CXXFLAGS="-I./interface/ -I./systimerfactory/"
export CXXFLAGS="-I./interface/ -I./systimerfactory/ -DIARM_SUPPORT_DISABLED"
export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
export LDFLAGS="-L/usr/local/lib -lpthread -lsystimerfactory -lrdkloggers -lsecure_wrapper"

Expand Down
4 changes: 4 additions & 0 deletions main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,5 +46,9 @@ int main()
return EXIT_FAILURE;
}

#ifdef T2_EVENT_ENABLED
t2_uninit();
#endif

return EXIT_SUCCESS;
Comment on lines +49 to 53
Copy link

Copilot AI Mar 20, 2026

Choose a reason for hiding this comment

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

t2_uninit() is placed after sysTimeMgr->run(), but run() (default forever=true) joins threads that run infinite loops, so main() never reaches this cleanup in normal operation. If telemetry needs shutdown, consider registering an atexit handler, handling signals, or adding a controlled shutdown path so t2_uninit() actually executes.

Copilot uses AI. Check for mistakes.
}
107 changes: 107 additions & 0 deletions run_l2.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
##########################################################################
# If not stated otherwise in this file or this component's LICENSE
# file the following copyright and licenses apply:
#
# Copyright 2018 RDK Management
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
##########################################################################

RESULT_DIR="/tmp/l2_test_report"
mkdir -p "$RESULT_DIR"

apt-get update && apt-get install -y libjsonrpccpp-dev

touch /usr/local/bin/journalctl
chmod -R 777 /usr/local/bin/journalctl
ln -s /usr/local/bin/journalctl /usr/bin/journalctl
Comment on lines +25 to +27
Copy link

Copilot AI Mar 10, 2026

Choose a reason for hiding this comment

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

The sequence creating a stub journalctl (touch /usr/local/bin/journalctl) and then applying chmod -R 777 /usr/local/bin/journalctl makes this binary world-writable while also symlinking it into /usr/bin. Any unprivileged local user can modify or replace this file and then wait for a privileged user or service to invoke journalctl, leading to arbitrary code execution with elevated privileges. Restrict permissions on journalctl (e.g., root-owned and not world-writable) and avoid placing a mutable test stub in a globally trusted system path; instead, confine any test stub to a controlled test directory or container image built explicitly for this purpose.

Copilot uses AI. Check for mistakes.

rm -rf /etc/systimemgr.conf
rm -rf /opt/secure/clock.txt
rm -rf /tmp/systimemgr

echo "timesrc ntp /ntp" > /etc/systimemgr.conf
echo "timesrc dtt /dtt" >> /etc/systimemgr.conf
echo "timesync rdkdefault /clock_time" >> /etc/systimemgr.conf

echo "$(date +%s)" > /opt/secure/clock.txt

Comment on lines +37 to +38
Copy link

Copilot AI Mar 10, 2026

Choose a reason for hiding this comment

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

This script writes /opt/secure/clock.txt without ensuring /opt/secure exists. In a fresh container that can fail; add mkdir -p /opt/secure before this write.

Copilot uses AI. Check for mistakes.
mkdir /tmp/systimemgr/
touch /tmp/systimemgr/ntp

rm -rf /opt/logs/systimemgr.log*

# Run L2 Test cases
pytest --json-report --json-report-summary --json-report-file $RESULT_DIR/systimemgr_single_instance.json test/functional-tests/tests/test_systimemgr_single_instance.py
pytest --json-report --json-report-summary --json-report-file $RESULT_DIR/systimemgr_initialisation.json test/functional-tests/tests/test_systimemgr_initialisation.py
pytest --json-report --json-report-summary --json-report-file $RESULT_DIR/systimemgr_get_time.json test/functional-tests/tests/test_systimemgr_get_time.py
pytest --json-report --json-report-summary --json-report-file $RESULT_DIR/systimemgr_check_file.json test/functional-tests/tests/test_systimemgr_check_file.py
pytest --json-report --json-report-summary --json-report-file $RESULT_DIR/systimemgr_time_quality.json test/functional-tests/tests/test_systimemgr_time_quality.py
pytest --json-report --json-report-summary --json-report-file $RESULT_DIR/systimemgr_bootup_flow.json test/functional-tests/tests/test_systimemgr_bootup_flow.py

#Secure Time Validation TestCases
rm -rf /etc/systimemgr.conf
rm -rf /opt/secure/clock.txt

echo "timesrc drm /drm" >> /etc/systimemgr.conf
echo "timesync rdkdefault /clock_time" >> /etc/systimemgr.conf

echo "$(date +%s)" > /opt/secure/clock.txt
touch /tmp/systimemgr/drm

pytest --json-report --json-report-summary --json-report-file $RESULT_DIR/systimemgr_single_instance.json test/functional-tests/tests/test_systimemgr_single_instance.py
pytest --json-report --json-report-summary --json-report-file $RESULT_DIR/systimemgr_securetime_Initialisation.json test/functional-tests/tests/test_secureTime_initialisation.py
pytest --json-report --json-report-summary --json-report-file $RESULT_DIR/systimemgr_secureTime_checkEvent.json test/functional-tests/tests/test_secureTime_checkEvent.py
pytest --json-report --json-report-summary --json-report-file $RESULT_DIR/systimemgr_secureTime_Quality.json test/functional-tests/tests/test_secureTime_quality.py


# ── NWStatusMonitor L2 tests ────────────────────────────────────────────────
# When sysTimeMgr is compiled with -D__LOCAL_TEST_ (set by cov_build.sh via
# --enable-unittest) it uses WPEFrameworkMock.h instead of the real Thunder
# library. Events are injected by writing JSON to a file that the mock
# SmartLinkType polls — no Thunder daemon or WebSocket server is needed.
#
# Restart sysTimeMgr so it subscribes afresh for the NWStatus test suite.
pkill -f sysTimeMgr 2>/dev/null || true
sleep 1

# Create the RFC marker file that SysTimeMgr::run() checks before starting
# the NW-event threads (chronyRfcEnabled guard in systimemgr.cpp).
mkdir -p /opt/secure/RFC/chrony
touch /opt/secure/RFC/chrony/chronyd_enabled

# Clean up any leftover inject / subscribed files from a previous run
rm -f /tmp/thunder_mock_org_rdk_NetworkManager_onInternetStatusChange.inject
rm -f /tmp/thunder_mock_org_rdk_NetworkManager_onInternetStatusChange.subscribed

# Truncate the log so NWStatus tests only scan fresh output from this
# sysTimeMgr instance — prevents stale lines from earlier test suites
# causing false-passes in the offset-based log checks.
rm -f /opt/logs/systimemgr.log.0

sysTimeMgr &
sleep 2

NWSTATUS_TEST="test/functional-tests/tests/test_systimemgr_nwstatus.py"
if [ ! -f "$NWSTATUS_TEST" ]; then
NWSTATUS_TEST="$(find . -type f -name 'test_systimemgr_nwstatus.py' | head -n 1)"
fi

if [ -z "$NWSTATUS_TEST" ] || [ ! -f "$NWSTATUS_TEST" ]; then
echo "ERROR: Unable to find test_systimemgr_nwstatus.py in the repository." >&2
exit 1
fi

pytest --json-report --json-report-summary \
--json-report-file $RESULT_DIR/systimemgr_nwstatus.json \
"$NWSTATUS_TEST"
Loading
Loading