Conversation
PiotrKorkus
left a comment
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): |
There was a problem hiding this comment.
redundant? should be possible to use FitScenario directly
There was a problem hiding this comment.
Dropped the build_tools override — FitScenario.build_tools already resolves the parametrized version via request.getfixturevalue. ClockScenario is kept as a thin base only to provide test_config, which is abstract on Scenario and not implemented by FitScenario.
|
@clanghans any update on your PR, there are some findings.... |
|
Both addressed in Feature req mapping: added
Marked Loop / sleep / compare scenario: added |
|
@anmittag Updated. The three findings from PiotrKorkus are addressed in |
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.
- Drop redundant ClockScenario.build_tools override; FitScenario already resolves the parametrized version. Keep version on test_config so it stays in the fixture dependency chain. - Add @add_test_properties mapping to score_time feature requirements: FR-9 (SystemClock), FR-13 (HighResSteadyClock), FR-14 (SteadyClock). - Add steady_clock_progression scenario and TestSteadyClockProgression: take N readings asserting non-decreasing, sleep a known duration, take a final reading and assert progression. Covers TC-FR14-001.
0b66ca8 to
c04f5c0
Compare
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).