test(fit): add score_time clock integration test - #300
Open
clanghans wants to merge 1 commit into
Open
Conversation
Add a feature integration test for the score_time clock library, which was already pinned in known_good.json but had no test coverage. Three C++ scenarios exercise the public Clock API and self-validate: - system_clock_now: reading tracks the host system clock within tolerance - steady_clock_now: two readings are monotonic - high_res_steady_clock_now: reading is non-zero and monotonic A pytest FIT case drives each scenario and asserts the exit code plus the emitted reading. Wire the scenarios into the root group and add the score_time clock deps to the cpp_test_scenarios binary.
clanghans
requested review from
AlexanderLanin,
FScholPer,
MaximilianSoerenPollak,
PiotrKorkus,
antonkri,
dcalavrezo-qorix,
lurtz,
nradakovic,
opajonk and
pawelrutkaq
as code owners
July 27, 2026 10:35
clanghans
marked this pull request as draft
July 27, 2026 10:36
clanghans
marked this pull request as ready for review
July 27, 2026 12:51
PiotrKorkus
requested changes
Jul 28, 2026
PiotrKorkus
left a comment
Contributor
There was a problem hiding this comment.
good for basic smoke tests
did you consider any feature reqs? could you add the mapping?
I would suggest adding a scenario where we do a couple of ticks in a loop, assert all are not decreasing, then sleep for some known duration and compare again next tick.
| pytestmark = pytest.mark.parametrize("version", ["cpp"], scope="class") | ||
|
|
||
|
|
||
| class ClockScenario(FitScenario): |
Contributor
There was a problem hiding this comment.
redundant? should be possible to use FitScenario directly
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds a feature integration test (FIT) for the
score_timeclock library.score_timeis already pinned inknown_good.json(and the generatedbazel_common/score_modules_target_sw.MODULE.bazel), but so far it had nointegration test coverage. This adds one following the existing FIT pattern
(C++ scenario binary + pytest driver).
Scope
Three C++ scenarios exercise the public
Clock<Tag>API and self-validate,throwing (process exit 101) on failure:
time.system_clock_now—SystemClock::Now()tracks the host system clockwithin a generous tolerance (catches an epoch-zero stub / unlinked backend).
time.steady_clock_now— twoSteadyClock::Now()readings are monotonic.time.high_res_steady_clock_now—HighResSteadyClock::Now()is non-zero andmonotonic.
Each scenario emits its reading as a structured JSON log line. The pytest FIT
case (
tests/time/test_clock_now.py) drives each scenario and asserts the exitcode plus the emitted reading. score_time is C++ only, so the tests are
parametrized with
version=["cpp"].Deferred (not in this PR): VehicleTime (requires explicit
Init()), and thetime_daemon / time_slave / ts_client processes (better suited to ITF/QEMU tests).
Files
feature_integration_tests/test_scenarios/cpp/src/scenarios/time/— new scenarios + groupmod.cppfeature_integration_tests/test_scenarios/cpp/src/internals/time/clock_log.h— small JSON log helperfeature_integration_tests/test_scenarios/cpp/src/scenarios/mod.cpp— register thetimegroupfeature_integration_tests/test_scenarios/cpp/BUILD— add the three@score_timeclock depsfeature_integration_tests/test_cases/tests/time/test_clock_now.py— pytest FIT caseVerification
bazel build --config=linux-x86_64 //feature_integration_tests/test_scenarios/cpp:cpp_test_scenarios— builds with the score_time deps.bazel test --config=linux-x86_64 //feature_integration_tests/test_cases:fit_cpp— all tests pass (6 new time tests + existing suite).