Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
04c6eb9
Adding support for L2 TestCase
Saranya2421 Jun 26, 2025
ab4a529
Update cov_build.sh
Saranya2421 Jun 26, 2025
24b790e
Create L2-tests.yml
Saranya2421 Jun 26, 2025
1303a73
Create run_l2.sh
Saranya2421 Jun 26, 2025
dc97610
Create helper_functions.py
Saranya2421 Jun 26, 2025
1d47caa
Create test_systimemgr_bootup_flow.py
Saranya2421 Jun 26, 2025
4b5dea3
Create test_systimemgr_check_file.py
Saranya2421 Jun 26, 2025
52df339
Create test_systimemgr_get_time.py
Saranya2421 Jun 26, 2025
07fa502
Create test_systimemgr_initialisation.py
Saranya2421 Jun 26, 2025
4179152
Create test_systimemgr_single_instance.py
Saranya2421 Jun 26, 2025
cceba41
Create test_systimemgr_time_quality.py
Saranya2421 Jun 26, 2025
e7e69f2
Create systimemgr_bootupflow.feature
Saranya2421 Jun 26, 2025
8413da0
Create systimemgr_check_file.feature
Saranya2421 Jun 26, 2025
a78bd86
Create systimemgr_get_time.feature
Saranya2421 Jun 26, 2025
1827494
Update systimemgr_check_file.feature
Saranya2421 Jun 26, 2025
98305fa
Update systimemgr_bootupflow.feature
Saranya2421 Jun 26, 2025
2e67bb2
Create systimemgr_initialisation.feature
Saranya2421 Jun 26, 2025
0be4f5f
Create systimemgr_single_instance.feature
Saranya2421 Jun 26, 2025
a5cc56a
Create systimemgr_time_quality.feature
Saranya2421 Jun 26, 2025
b5c5aae
Update run_l2.sh
Saranya2421 Jun 26, 2025
f6dfad5
Update L2-tests.yml
Saranya2421 Jun 26, 2025
9ebed00
Update test_systimemgr_single_instance.py
Saranya2421 Jun 26, 2025
b4379da
Removing systimemgr binary start from run_l2.sh
Saranya2421 Jun 26, 2025
7f36720
Update run_l2.sh
Saranya2421 Jun 27, 2025
15157df
Update cov_build.sh
Saranya2421 Jun 27, 2025
82870cc
Update systimemgr.cpp
Saranya2421 Jun 27, 2025
9358f3a
Update test_systimemgr_bootup_flow.py
Saranya2421 Jun 27, 2025
865c887
Update test_systimemgr_check_file.py
Saranya2421 Jun 27, 2025
ae1c179
Update test_systimemgr_get_time.py
Saranya2421 Jun 27, 2025
42cf834
Update test_systimemgr_initialisation.py
Saranya2421 Jun 27, 2025
597930f
Update test_systimemgr_single_instance.py
Saranya2421 Jun 27, 2025
6bb0af6
Update test_systimemgr_time_quality.py
Saranya2421 Jun 27, 2025
2a0ff14
Update test_systimemgr_single_instance.py
Saranya2421 Jun 27, 2025
c3c9316
Update run_l2.sh
Saranya2421 Jun 27, 2025
5a30766
Update run_l2.sh
Saranya2421 Jun 27, 2025
5855bb3
Update L2-tests.yml
Saranya2421 Jun 27, 2025
2127790
Update run_l2.sh
Saranya2421 Jun 27, 2025
3975ea9
Update run_l2.sh
Saranya2421 Jun 27, 2025
6741592
Update run_l2.sh
Saranya2421 Jun 27, 2025
398778c
Update run_l2.sh
Saranya2421 Jun 27, 2025
240b332
Update run_l2.sh
Saranya2421 Jun 27, 2025
11a117c
Update test_systimemgr_initialisation.py
Saranya2421 Jun 27, 2025
b11209e
Update test_systimemgr_initialisation.py
Saranya2421 Jun 27, 2025
08b4c71
Update test_systimemgr_bootup_flow.py
Saranya2421 Jun 27, 2025
3ee1329
Update test_systimemgr_check_file.py
Saranya2421 Jun 27, 2025
7166cef
Update test_systimemgr_get_time.py
Saranya2421 Jun 27, 2025
e6310c8
Update run_l2.sh
Saranya2421 Jun 27, 2025
9af7c7e
Update run_l2.sh
Saranya2421 Jun 27, 2025
a38402c
Update run_l2.sh
Saranya2421 Jun 27, 2025
358d943
Update test_systimemgr_single_instance.py
Saranya2421 Jun 27, 2025
01f588f
Update run_l2.sh
Saranya2421 Jun 27, 2025
2771530
Update run_l2.sh
Saranya2421 Jun 27, 2025
2f528e5
Update test_systimemgr_time_quality.py
Saranya2421 Jun 27, 2025
b9737a4
Update run_l2.sh
Saranya2421 Jun 27, 2025
5fe570b
Update run_l2.sh
Saranya2421 Jun 27, 2025
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
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"
2 changes: 1 addition & 1 deletion cov_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ 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
57 changes: 57 additions & 0 deletions run_l2.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
##########################################################################
# 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

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

mkdir /tmp/systimemgr
touch ntp

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

#/usr/local/bin/sysTimeMgr &

#ps -eaf
#ls -l /opt/logs/

#cat /opt/logs/systimemgr.log.0
#cat /etc/debug.ini
#sleep 1m

# 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

ps -eaf
ls -l /opt/logs
cat /opt/logs/systimemgr.log.0
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
15 changes: 13 additions & 2 deletions systimemgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ void SysTimeMgr::initialize()

//m_timerSrc.push_back(createTimeSrc("regular","/tmp/clock.txt"));
//m_timerSync.push_back(createTimeSync("test","/tmp/clock1.txt"));

#if !defined(IARM_SUPPORT_DISABLED)
m_publish = createPublish("iarm",IARM_BUS_SYSTIME_MGR_NAME);
RDK_LOG(RDK_LOG_INFO,LOG_SYSTIME,"[%s:%d]:createSubscriber IARM_BUS_SYSTIME_MGR_NAME TIMER_STATUS_MSG Invoke\n",__FUNCTION__,__LINE__);
m_tmrsubscriber = createSubscriber("iarm",IARM_BUS_SYSTIME_MGR_NAME,TIMER_STATUS_MSG);
Expand All @@ -113,7 +113,18 @@ void SysTimeMgr::initialize()
m_tmrsubscriber->subscribe(TIMER_STATUS_MSG,SysTimeMgr::getTimeStatus);
RDK_LOG(RDK_LOG_INFO,LOG_SYSTIME,"[%s:%d]:IpowerControllerSubscriber or IarmPowerSubscriber Invoke \n",__FUNCTION__,__LINE__);
m_subscriber->subscribe(POWER_CHANGE_MSG,SysTimeMgr::powerhandler);

#else
m_publish = createPublish("test",IARM_BUS_SYSTIME_MGR_NAME);
RDK_LOG(RDK_LOG_INFO,LOG_SYSTIME,"[%s:%d]:createSubscriber IARM_BUS_SYSTIME_MGR_NAME TIMER_STATUS_MSG Invoke\n",__FUNCTION__,__LINE__);
m_tmrsubscriber = createSubscriber("test",IARM_BUS_SYSTIME_MGR_NAME,TIMER_STATUS_MSG);
RDK_LOG(RDK_LOG_INFO,LOG_SYSTIME,"[%s:%d]:createSubscriber IARM_BUS_SYSTIME_MGR_NAME POWER_CHANGE_MSG Invoke\n",__FUNCTION__,__LINE__);
m_subscriber = createSubscriber("test",IARM_BUS_SYSTIME_MGR_NAME,POWER_CHANGE_MSG);
RDK_LOG(RDK_LOG_INFO,LOG_SYSTIME,"[%s:%d]:IarmTimerStatusSubscriber Invoke \n",__FUNCTION__,__LINE__);
m_tmrsubscriber->subscribe(TIMER_STATUS_MSG,SysTimeMgr::getTimeStatus);
RDK_LOG(RDK_LOG_INFO,LOG_SYSTIME,"[%s:%d]:IpowerControllerSubscriber or IarmPowerSubscriber Invoke \n",__FUNCTION__,__LINE__);
m_subscriber->subscribe(POWER_CHANGE_MSG,SysTimeMgr::powerhandler);
#endif

//Initialize Path Event Map
m_pathEventMap.insert(pair<string,sysTimeMgrEvent>("ntp",eSYSMGR_EVENT_NTP_AVAILABLE));
//Keeping the NTP available event for stt as well. Source is different but no need to have separate event.
Expand Down
57 changes: 57 additions & 0 deletions test/functional-tests/features/systimemgr_bootupflow.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
##########################################################################
# 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.
##########################################################################

Feature: Ensures SystemTimeManager Bootup Flow

Scenario: Ensures SystemTimeManager Initialization
Given the SystemTimeManager is not already running
When the SystemTimeManager binary is invoked
Then the SystemTimeManager should be started

Scenario: Check if systemTimeManager is Running
Given the SystemTimeManager is running
When the SystemTimeManager binary is invoked
Then the SystemTimeManager should be running

Scenario: Verify SystemTimeManager Log file exists
Given the SystemTimeManager is running
When the SystemTimeManager binary is invoked
Then the SystemTimeManager LogFile should get generated

Scenario: Verify SystemTimeManager Instance is created
Given the SystemTimeManager is running
When the SystemTimeManager binary is invoked
Then the SystemTimeManager Instance should get created

Scenario: Verify SystemTimeManager Initializes timeSrc and timeSync
Given the SystemTimeManager is running
When the SystemTimeManager binary is invoked
Then the SystemTimeManager should initializes TimeSrc[NTP,DTT] and TimeSync[clocktime]

Scenario: Verify SystemTimeManager returns the last known good time
Given the SystemTimeManager is running
When the SystemTimeManager registers for IARM events
Then the SystemTimeManager should return the last known good time
And the log file should contain "Returning Last Known Good Time"

Scenario: Verify SystemTimeManager Sends info about time Quality
Given the SystemTimeManager is running
When the SystemTimeManager returns the last known good time
Then the SystemTimeManager should Send broadcast msg about the time quality
And the log file should contain "Info:"
40 changes: 40 additions & 0 deletions test/functional-tests/features/systimemgr_check_file.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
##########################################################################
# 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.
##########################################################################

Feature: Ensures SystemTimeManager generates /opt/secure/clock.txt File

Scenario: Ensures SystemTimeManager Initialization
Given the SystemTimeManager is not already running
When the SystemTimeManager binary is invoked
Then the SystemTimeManager should be started

Scenario: Check if systemTimeManager is Running
Given the SystemTimeManager is running
When the SystemTimeManager binary is invoked
Then the SystemTimeManager should be running

Scenario: Verify SystemTimeManager Log file exists
Given the SystemTimeManager is running
When the SystemTimeManager binary is invoked
Then the SystemTimeManager LogFile should get generated

Scenario: Verify SystemTimeManager generates clock.txt File
Given the SystemTimeManager is running
When the SystemTimeManager returns the last known time
Then the SystemTimeManager should update the clock.txt File
40 changes: 40 additions & 0 deletions test/functional-tests/features/systimemgr_get_time.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
##########################################################################
# 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.
##########################################################################

Feature: Ensures SystemTimeManager Returns the Last known Good time

Scenario: Ensures SystemTimeManager Initialization
Given the SystemTimeManager is not already running
When the SystemTimeManager binary is invoked
Then the SystemTimeManager should be started

Scenario: Check if systemTimeManager is Running
Given the SystemTimeManager is running
When the SystemTimeManager binary is invoked
Then the SystemTimeManager should be running

Scenario: Verify SystemTimeManager Log file exists
Given the SystemTimeManager is running
When the SystemTimeManager binary is invoked
Then the SystemTimeManager LogFile should get generated

Scenario: Verify SystemTimeManager Captured Last known Good time
Given the SystemTimeManager is running
When the SystemTimeManager binary is invoked
Then the SystemTimeManager should update the lastknown Good time
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
##########################################################################
# 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.
##########################################################################

Feature: Ensures SystemTimeManager Initialization

Scenario: Ensures SystemTimeManager Initialization
Given the SystemTimeManager is not already running
When the SystemTimeManager binary is invoked
Then the SystemTimeManager should be started

Scenario: Check if systemTimeManager is Running
Given the SystemTimeManager is running
When the SystemTimeManager binary is invoked
Then the SystemTimeManager should be running

Scenario: Verify SystemTimeManager Log file exists
Given the SystemTimeManager is running
When the SystemTimeManager binary is invoked
Then the SystemTimeManager LogFile should get generated

Scenario: Verify SystemTimeManager TimeSRC and TimeSYNC are Initialized
Given the SystemTimeManager is running
When the SystemTimeManager binary is invoked
Then the TimeSources and TimeSyncs should be Initialized
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
##########################################################################
# 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.
##########################################################################

Feature: SystemTimeManager runs only one instance

Scenario: SystemTimeManager exits if another instance is invoked
Given the SystemTimeManager is not already running
When the SystemTimeManager binary is invoked
Then the SystemTimeManager should be started
And when the SystemTimeManager is attempted to be started again
Then the SystemTimeManager should not start another instance
Loading
Loading