Conversation
RDKEMW-5290-L1 Script change to check the failure in the workflow
Revert "RDKEMW-5290-L1 Script change to check the failure in the workflow"
Adding L2 functionality tests integrated with CI workflow for PR.
* Revert "Revert "RDKEMW-5290-L1 Script change to check the failure in the workflow"" * Update run_ut.sh * Update systimemgr.cpp * Update run_ut.sh * Update run_ut.sh * Update Makefile.am
Signed-off-by: Balaji Punnuru <balaji_punnuru@cable.comcast.com>
Release 1.2.1 tag.
|
This pull request sets up GitHub code scanning for this repository. Once the scans have completed and the checks have passed, the analysis results for this pull request branch will appear on this overview. Once you merge this pull request, the 'Security' tab will show more code scanning analysis results (for example, for the default branch). Depending on your configuration and choice of analysis tool, future pull requests will be annotated with code scanning analysis results. For more information about GitHub code scanning, check out the documentation. |
| 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" |
Check warning
Code scanning / CodeQL
Workflow does not contain permissions Medium
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 9 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.
| @@ -6,2 +6,5 @@ | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| env: |
Planted telemetry event markers
* Improve the L1 Coverage * Update ipowercontrollersubscriber.h * Update ipowercontrollersubscriber.h * Update iarmsubscribe.h * Update iarmsubscribe.h * Update rdkdefaulttimesync.h * Update rdkdefaulttimesync.h * Update systimemgr.h * Update SysTimeMgrUnitTest.cpp * Update systimemgr.h * Update systimemgr.h * Update systimemgr.h * Update systimemgr.h * Update systimemgr.h * Update systimemgr.h * Update systimemgr.h * Update systimemgr.h * Update systimemgr.h * Update systimemgr.h * Update SysTimeMgrUnitTest.cpp * Update SysTimeMgrUnitTest.cpp * Update SysTimeMgrUnitTest.cpp
…ase 1. (#52) * RDK-57622 : [RDK-E] L2 test framework for SystemTime Manger Module Phase 1 * Update run_l2.sh * Update run_l2.sh * Update run_l2.sh * Update test_secureTime_checkEvent.py * Update run_l2.sh --------- Co-authored-by: Saranya <saranya_elango@comcast.com>
Deploy cla action
Deploy fossid_integration_stateless_diffscan_target_repo action
* RDK-58859 : 64-bit compilation support for systemtimemgr * RDK-58859 : 64-bit compilation support for systimemgr * RDK-58859 : Adding Flag to support 64-bit compilation * RDK:58859 : Adding support for 64-bit compilation * Using __WORDSIZE for differentiating 64 bit compilation * Adding support for 64-bit compilation * Using COmmon format specifier for both 32-bit and 64-bit compilation * Addressed Review Comments --------- Co-authored-by: Saranya <saranya_elango@comcast.com> Co-authored-by: Balaji Punnuru <Balaji_Punnuru@comcast.com>
There was a problem hiding this comment.
Pull request overview
This PR updates the SystemTimeMgr project’s test/CI tooling and adds Telemetry2 (T2) build integration, along with expanded unit and functional (L2) test coverage.
Changes:
- Enable/standardize GTest XML reporting and adjust coverage collection/filters in unit test scripts and workflows.
- Add functional test suite (pytest) plus an L2 runner script and CI workflow to execute it in containerized environments.
- Add optional Telemetry2 (T2) build flagging and telemetry markers in SysTimeMgr/RdkDefaultTimeSync.
Reviewed changes
Copilot reviewed 48 out of 48 changed files in this pull request and generated 21 comments.
Show a summary per file
| File | Description |
|---|---|
| test/run_ut.sh | Runs unit tests with per-binary XML output and generates lcov coverage artifacts. |
| test/functional-tests/tests/helper_functions.py | Adds shared helpers for functional tests (process/log/file utilities). |
| test/functional-tests/tests/test_systimemgr_time_quality.py | Adds functional checks for time-quality log messages. |
| test/functional-tests/tests/test_systimemgr_single_instance.py | Adds functional test for single-instance behavior. |
| test/functional-tests/tests/test_systimemgr_initialisation.py | Adds functional test for initialization log message. |
| test/functional-tests/tests/test_systimemgr_get_time.py | Adds functional test for “last known good time” log parsing. |
| test/functional-tests/tests/test_systimemgr_check_file.py | Adds functional tests for clock file existence/update. |
| test/functional-tests/tests/test_systimemgr_bootup_flow.py | Adds functional test validating bootup sequence logs. |
| test/functional-tests/tests/test_secureTime_quality.py | Adds functional tests for secure-time quality messages. |
| test/functional-tests/tests/test_secureTime_initialisation.py | Adds functional test for DRM initialization log message. |
| test/functional-tests/tests/test_secureTime_checkEvent.py | Adds functional tests for DRM notify path/event logging. |
| test/functional-tests/features/systimemgr_time_quality.feature | Adds BDD feature spec for time quality scenarios. |
| test/functional-tests/features/systimemgr_single_instance.feature | Adds BDD feature spec for single instance scenarios. |
| test/functional-tests/features/systimemgr_secureTime_quality.feature | Adds BDD feature spec for secure-time quality scenarios. |
| test/functional-tests/features/systimemgr_secureTime_check_event.feature | Adds BDD feature spec for secure-time event checks. |
| test/functional-tests/features/systimemgr_secureTimeInitialisation.feature | Adds BDD feature spec for secure-time initialization. |
| test/functional-tests/features/systimemgr_initialisation.feature | Adds BDD feature spec for initialization scenarios. |
| test/functional-tests/features/systimemgr_get_time.feature | Adds BDD feature spec for last-known-good-time behavior. |
| test/functional-tests/features/systimemgr_check_file.feature | Adds BDD feature spec for clock file generation/update. |
| test/functional-tests/features/systimemgr_bootupflow.feature | Adds BDD feature spec for bootup flow. |
| systimerfactory/unittest/rdkDefaulttimesyncUnitTest.cpp | Extends unit test coverage for RdkDefaultTimeSync paths. |
| systimerfactory/unittest/ipowercontrollersubscriber_gtest.cpp | Adds/extends unit tests for power controller subscriber. |
| systimerfactory/unittest/iarmtimerstatus_gtest.cpp | Adds tests around IARM timer status subscription behavior. |
| systimerfactory/unittest/iarmpowersubscribe_gtest.cpp | Adds additional coverage tests for power event handling. |
| systimerfactory/unittest/SysTimeMgrUnitTest.cpp | Large expansion of SysTimeMgr unit tests and mocks. |
| systimerfactory/unittest/Makefile.am | Adds coverage flags and adjusts unit test build flags/defines. |
| systimerfactory/stttimesrc.h | Adjusts STT time logging format specifier. |
| systimerfactory/ntptimesrc.h | Adjusts NTP time logging format specifier. |
| systimerfactory/rdkdefaulttimesync.h | Adds GTest friend access for private tokenize helper. |
| systimerfactory/rdkdefaulttimesync.cpp | Adds optional T2 telemetry marker emission. |
| systimerfactory/ipowercontrollersubscriber.h | Adds GTest friend access for private members. |
| systimerfactory/iarmsubscribe.h | Adds GTest friend access for singleton-path coverage. |
| systimerfactory/configure.ac | Adds --enable-t2api build flag and conditional plumbing. |
| systimerfactory/Makefile.am | Links T2 libs/flags when telemetry is enabled. |
| systimemgr.h | Adds T2 prototypes and GTest friend declarations. |
| systimemgr.cpp | Adds T2 init and improves deep-sleep-off time sync actions. |
| main.cpp | Calls t2_uninit() when T2 is enabled. |
| cov_build.sh | Adjusts build flags for local/CI coverage builds. |
| configure.ac | Adds --enable-t2api option and conditional plumbing. |
| Makefile.am | Links T2 libs/flags when telemetry is enabled. |
| run_l2.sh | Adds an L2 test runner script for container CI execution. |
| CHANGELOG.md | Updates changelog entries for recent releases/PRs. |
| .github/workflows/fossid_integration_stateless_diffscan_target_repo.yml | Adjusts workflow triggers/permissions and pins reusable workflow ref. |
| .github/workflows/code-coverage.yml | Updates PR branch filter to develop. |
| .github/workflows/cla.yml | Adds CLA workflow for PR validation. |
| .github/workflows/L2-tests.yml | Adds CI workflow to build and execute L2 tests in containers. |
| .github/workflows/L1-Test.yaml | Updates results upload path to new XML report directory. |
| .github/CODEOWNERS | Updates default code owner list. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| TEST_F(SysTimeMgrTest, RunDetachesThreadsWhenNotForever) { | ||
|
|
||
| mgr->run(false); | ||
| } |
There was a problem hiding this comment.
mgr->run(false) detaches internal threads which run infinite loops (processMsg, runTimer, runPathMonitor). Starting detached infinite-loop threads inside a unit test can leak resources and make the test suite nondeterministic. Prefer not invoking run(false) in tests, or add a stop mechanism that allows joining/clean shutdown.
| struct ntptimeval tVal; | ||
| ntp_gettime(&tVal); | ||
| RDK_LOG(RDK_LOG_DEBUG,LOG_SYSTIME,"[%s:%d]:NTP Time Values, MaxValue = %d, Time in Sec = %d, Time in Microsec = %d, Estimated Error = %d, TAI = %d \n",__FUNCTION__,__LINE__,tVal.maxerror,tVal.time.tv_sec,tVal.time.tv_usec,tVal.esterror,tVal.tai); | ||
| RDK_LOG(RDK_LOG_DEBUG,LOG_SYSTIME,"[%s:%d]:NTP Time Values, MaxValue = %ld, Time in Sec = %lu, Time in Microsec = %d, Estimated Error = %ld, TAI = %ld \n",__FUNCTION__,__LINE__,tVal.maxerror,tVal.time.tv_sec,tVal.time.tv_usec,tVal.esterror,tVal.tai); |
There was a problem hiding this comment.
This RDK_LOG call has format specifier/type mismatches (tv_sec is time_t and tv_usec is typically long, but the format uses %lu and %d). Mismatched variadic printf specifiers are undefined behavior; please adjust specifiers and/or cast to matching types (e.g., cast to long and use %ld for both seconds and microseconds).
| mgr->sendMessage(eSYSMGR_EVENT_TIMER_EXPIRY, nullptr); | ||
| std::thread t([&]() { mgr->processMsg(); }); | ||
| std::this_thread::sleep_for(std::chrono::milliseconds(100)); | ||
| t.detach(); | ||
| } |
There was a problem hiding this comment.
This test starts processMsg() in a background thread and detaches it, but processMsg() is an infinite loop. This can leave runaway threads and cause nondeterministic behavior. Add a stop condition (or test runStateMachine directly) so the thread can be joined and cleaned up.
| std::thread t([&]() { mgr->runPathMonitor(); }); | ||
| chmod(testfile.c_str(), 0666); | ||
| std::this_thread::sleep_for(std::chrono::milliseconds(300)); | ||
| t.detach(); | ||
| remove(testfile.c_str()); |
There was a problem hiding this comment.
runPathMonitor() contains an infinite loop reading inotify events, but this test detaches the thread and immediately removes the watched directory. This is prone to races/flakiness and leaves a runaway thread. Consider refactoring runPathMonitor() to support a stop flag or a single-iteration mode for unit tests so the thread can be joined safely.
| lcov --capture --directory . --base-directory . --output-file raw_coverage.info | ||
| lcov --extract raw_coverage.info '/__w/systemtimemgr/systemtimemgr/systimerfactory/*' '/__w/systemtimemgr/systemtimemgr/systimemgr.cpp' --output-file systimer_coverage.info | ||
| lcov --remove systimer_coverage.info '/__w/systemtimemgr/systemtimemgr/systimerfactory/unittest/*' --output-file processed_coverage.info | ||
| lcov --extract processed_coverage.info '*.cpp' --output-file coverage.info |
There was a problem hiding this comment.
The lcov extract/remove filters use hard-coded GitHub Actions workspace paths (/__w/systemtimemgr/systemtimemgr/...). This is brittle outside that environment and can result in empty/incorrect coverage. Prefer path-agnostic patterns (e.g., */systimerfactory/*, */systimemgr.cpp) or derive the repo root dynamically (e.g., from $TOP_DIR).
| long long getTimeSec(){ | ||
| time_t timeinSec = time(NULL); | ||
| RDK_LOG(RDK_LOG_DEBUG,LOG_SYSTIME,"[%s:%d]:STT Time in seconds = %d \n",__FUNCTION__,__LINE__,timeinSec); | ||
| RDK_LOG(RDK_LOG_DEBUG,LOG_SYSTIME,"[%s:%d]:STT Time in seconds = %lu \n",__FUNCTION__,__LINE__,timeinSec); |
There was a problem hiding this comment.
The RDK_LOG format string uses %lu for time_t (timeinSec). time_t is not guaranteed to be unsigned long (often it’s long), so this can cause undefined behavior on some platforms. Use the correct specifier (commonly %ld) with an explicit cast, or print via std::to_string/streams.
| }); | ||
|
|
||
| std::this_thread::sleep_for(std::chrono::milliseconds(200)); | ||
| timer_thread.detach(); | ||
|
|
There was a problem hiding this comment.
This thread calls SysTimeMgr::timerThr(mgr), which runs runTimer() (infinite loop), and then detaches. This can leak threads and interfere with other tests. Refactor to allow a bounded/controlled timer loop in tests and join the thread.
| #################################################################################### | ||
|
|
||
| ENABLE_COV=false | ||
| ENABLE_COV=true |
There was a problem hiding this comment.
ENABLE_COV is now set to true by default, which makes the script always attempt lcov generation even when --enable-cov is not passed (and may fail/slow down local runs where lcov isn’t installed). Consider defaulting to false again and only enabling coverage inside the flag block (or rename the flag if always-on coverage is intended).
| autoreconf --install | ||
|
|
||
| find / -iname "jsonrpccpp" | ||
| find / -iname "jsonrpccpp" # This command might not be necessary for the build |
There was a problem hiding this comment.
Running find / -iname "jsonrpccpp" scans the entire filesystem and can be extremely slow and noisy (permission errors) in CI containers. If this is only for debugging, please remove it or scope it to expected include/lib locations (e.g., /usr/include, /usr/lib) or guard it behind a verbose/debug flag.
| touch /usr/local/bin/journalctl | ||
| chmod -R 777 /usr/local/bin/journalctl | ||
| ln -s /usr/local/bin/journalctl /usr/bin/journalctl |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 48 out of 48 changed files in this pull request and generated 16 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| 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]) ;; |
There was a problem hiding this comment.
--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).
| *) AC_MSG_ERROR([bad value ${enableval} for --enable-t2enable]) ;; | |
| *) AC_MSG_ERROR([bad value ${enableval} for --enable-t2api]) ;; |
| 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]) ;; |
There was a problem hiding this comment.
--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).
| *) AC_MSG_ERROR([bad value ${enableval} for --enable-t2enable]) ;; | |
| *) AC_MSG_ERROR([bad value ${enableval} for --enable-t2api]) ;; |
| if IS_TELEMETRY2_ENABLED | ||
| libsystimerfactory_la_CPPFLAGS = $(T2_EVENT_FLAG) | ||
| libsystimerfactory_la_LDFLAGS = -ltelemetry_msgsender -lt2utils | ||
| endif |
There was a problem hiding this comment.
This adds libraries (-ltelemetry_msgsender -lt2utils) via libsystimerfactory_la_LDFLAGS. In Automake/Libtool, libraries should go in *_LIBADD/*_LDADD (link order matters), while LDFLAGS is for linker flags (e.g., -Wl,*, -version-info). Move these to libsystimerfactory_la_LIBADD += ... (or LDADD) to avoid link failures on some toolchains.
|
|
||
| if IS_TELEMETRY2_ENABLED | ||
| libsysTimeMgr_la_CPPFLAGS = $(T2_EVENT_FLAG) | ||
| libsysTimeMgr_la_LDFLAGS += -ltelemetry_msgsender -lt2utils |
There was a problem hiding this comment.
Telemetry libraries are appended to libsysTimeMgr_la_LDFLAGS. For Automake/Libtool targets, dependent libraries should be added via libsysTimeMgr_la_LIBADD/LDADD (to ensure correct ordering), not LDFLAGS. Consider moving -ltelemetry_msgsender -lt2utils to libsysTimeMgr_la_LIBADD += ....
| libsysTimeMgr_la_LDFLAGS += -ltelemetry_msgsender -lt2utils | |
| libsysTimeMgr_la_LIBADD += -ltelemetry_msgsender -lt2utils |
| #ifdef T2_EVENT_ENABLED | ||
| t2_uninit(); | ||
| #endif | ||
| return EXIT_SUCCESS; |
There was a problem hiding this comment.
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.
| pattern = r"Returning Last Known Good Time, *time\s* = \s*(.+)" | ||
| time_str = parse_log_time(pattern, clock_file) | ||
|
|
||
| assert time_str != "" | ||
|
|
There was a problem hiding this comment.
parse_log_time() returns None when the pattern isn’t found, but the test asserts time_str != "", which will still pass for None (since None != ""). This can mask real failures; assert that time_str is not None (and optionally non-empty) before proceeding.
| TEST_F(IarmTimerStatusSubscriberTest, Subscribe_ValidEventName_CallsRegisterCallAndReturnsFalseOnSuccess) { | ||
| IarmTimerStatusSubscriber subscriber("test_subscriber"); | ||
|
|
||
| EXPECT_CALL(*gMockIARM, RegisterCall(::testing::StrEq(TIMER_STATUS_MSG), _)) | ||
| .WillOnce(Return(IARM_RESULT_SUCCESS)); // 0 | ||
|
|
||
| bool result = subscriber.subscribe(TIMER_STATUS_MSG, reinterpret_cast<funcPtr>(0x1234)); | ||
| EXPECT_FALSE(result); // success returns false because of production code bug | ||
| } | ||
|
|
||
| TEST_F(IarmTimerStatusSubscriberTest, Subscribe_ValidEventName_ReturnsTrueOnFailure) { | ||
| IarmTimerStatusSubscriber subscriber("test_subscriber"); | ||
|
|
||
| EXPECT_CALL(*gMockIARM, RegisterCall(::testing::StrEq(TIMER_STATUS_MSG), _)) | ||
| .WillOnce(Return(IARM_RESULT_INVALID_STATE)); | ||
| bool result = subscriber.subscribe(TIMER_STATUS_MSG, reinterpret_cast<funcPtr>(0x1234)); | ||
| EXPECT_TRUE(result); |
There was a problem hiding this comment.
These tests explicitly assert the current (buggy) behavior that a successful IARM_Bus_RegisterCall (0) yields false. This bakes a production bug into the test suite and makes it harder to fix later. Prefer fixing IarmTimerStatusSubscriber::subscribe() to return true on IARM_RESULT_SUCCESS and updating tests to reflect the intended API contract.
| TEST_F(IarmTimerStatusSubscriberTest, Subscribe_ValidEventName_CallsRegisterCallAndReturnsFalseOnSuccess) { | |
| IarmTimerStatusSubscriber subscriber("test_subscriber"); | |
| EXPECT_CALL(*gMockIARM, RegisterCall(::testing::StrEq(TIMER_STATUS_MSG), _)) | |
| .WillOnce(Return(IARM_RESULT_SUCCESS)); // 0 | |
| bool result = subscriber.subscribe(TIMER_STATUS_MSG, reinterpret_cast<funcPtr>(0x1234)); | |
| EXPECT_FALSE(result); // success returns false because of production code bug | |
| } | |
| TEST_F(IarmTimerStatusSubscriberTest, Subscribe_ValidEventName_ReturnsTrueOnFailure) { | |
| IarmTimerStatusSubscriber subscriber("test_subscriber"); | |
| EXPECT_CALL(*gMockIARM, RegisterCall(::testing::StrEq(TIMER_STATUS_MSG), _)) | |
| .WillOnce(Return(IARM_RESULT_INVALID_STATE)); | |
| bool result = subscriber.subscribe(TIMER_STATUS_MSG, reinterpret_cast<funcPtr>(0x1234)); | |
| EXPECT_TRUE(result); | |
| TEST_F(IarmTimerStatusSubscriberTest, Subscribe_ValidEventName_CallsRegisterCallAndReturnsTrueOnSuccess) { | |
| IarmTimerStatusSubscriber subscriber("test_subscriber"); | |
| EXPECT_CALL(*gMockIARM, RegisterCall(::testing::StrEq(TIMER_STATUS_MSG), _)) | |
| .WillOnce(Return(IARM_RESULT_SUCCESS)); // 0 | |
| bool result = subscriber.subscribe(TIMER_STATUS_MSG, reinterpret_cast<funcPtr>(0x1234)); | |
| EXPECT_TRUE(result); | |
| } | |
| TEST_F(IarmTimerStatusSubscriberTest, Subscribe_ValidEventName_ReturnsFalseOnFailure) { | |
| IarmTimerStatusSubscriber subscriber("test_subscriber"); | |
| EXPECT_CALL(*gMockIARM, RegisterCall(::testing::StrEq(TIMER_STATUS_MSG), _)) | |
| .WillOnce(Return(IARM_RESULT_INVALID_STATE)); | |
| bool result = subscriber.subscribe(TIMER_STATUS_MSG, reinterpret_cast<funcPtr>(0x1234)); | |
| EXPECT_FALSE(result); |
| Scenario: Verify SystemTimeManager should sent time quality Poor when NTP failed | ||
| Given the SystemTimeManager is running | ||
| When the SystemTimeManager binary is invoked | ||
| Then the SystemTimeManager should sent time quality Poor Msg Initially since NTP Failed | ||
|
|
||
| Scenario: Verify SystemTimeManager should sent time quality Good when NTP is synced | ||
| Given the SystemTimeManager is running | ||
| When the SystemTimeManager binary is invoked | ||
| Then the SystemTimeManager should sent time quality Good When NTP is synced |
There was a problem hiding this comment.
Grammar: "should sent" is incorrect here (should be "should send"). Fixing these improves readability of the feature specs and avoids confusion in test reports.
| Scenario: Verify the Event should be eSYSMGR_EVENT_SECURE_TIME_AVAILABLE. | ||
| Given the SystimeTimeManager is running | ||
| When the Secure Time is available | ||
| Then the Event eSYSMGR_EVENT_SECURE_TIME_AVAILABLE should be found and Secure Message should be published. |
There was a problem hiding this comment.
Spelling/typo in scenario steps: "SystimeTimeManager" appears inconsistent with the rest of the suite ("SystemTimeManager"). This can make feature reports confusing and can break step matching if you use strict step definitions.
| ENABLE_COV=true | ||
|
|
||
| if [ "x$1" = "x--enable-cov" ]; then | ||
| echo "Enabling coverage options" | ||
| export CXXFLAGS="-g -O0 -fprofile-arcs -ftest-coverage" | ||
| export CFLAGS="-g -O0 -fprofile-arcs -ftest-coverage" | ||
| export LDFLAGS="-lgcov --coverage" | ||
| ENABLE_COV=true | ||
| echo "Enabling coverage options" | ||
| export CXXFLAGS="-g -O0 -fprofile-arcs -ftest-coverage" | ||
| export CFLAGS="-g -O0 -fprofile-arcs -ftest-coverage" | ||
| export LDFLAGS="-lgcov --coverage" | ||
| ENABLE_COV=true |
There was a problem hiding this comment.
ENABLE_COV is set to true unconditionally, so the script will always try to generate an lcov report even when --enable-cov isn’t passed (and binaries may not be built with coverage). Default this to false and only enable coverage/report generation when the flag is provided (or gate report generation on presence of gcda/gcno files).
No description provided.