feat: add TimeDaemon CIT with pip hub infrastructure - #122
Conversation
License Check Results🚀 The license check job ran with the Bazel command: bazel run //:license-checkStatus: Click to expand output |
|
The created documentation from the pull request is available at: docu-html |
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
| tags = ["QM"], | ||
| visibility = ["//score/time_daemon:__subpackages__"], | ||
| visibility = [ | ||
| "//score/tests/test_scenarios/cpp:__pkg__", |
There was a problem hiding this comment.
Is this needed? //score/tests/test_scenarios/cpp doesn't exist
There was a problem hiding this comment.
Good catch — this visibility entry is needed for the MIT test in part 3 (which links against shm_ptp_engine directly). I'll remove it from this PR and add it in PR3 instead where the package actually exists.
| visibility = ["//visibility:public"], | ||
| - deps = ["@score_baselibs//score/json:json_parser"], | ||
| + deps = [ | ||
| + "@score_baselibs//score/json:json", |
There was a problem hiding this comment.
if you are missing this dependency, could you add it to your target to avoid the patch?
or, if you think, the proper place to the dependency is on baselibs side, please, create a ticket towards them and put it here to keep track, when we could drop the patch
There was a problem hiding this comment.
The missing json dependency was a bug in score_test_scenarios upstream. It's fixed in v0.4.1, so the patch is no longer needed. Upgraded to v0.4.1 and removed the patch file and the entire score/tests/patches/ directory.
| from testing_utils import LogContainer, ScenarioResult | ||
|
|
||
|
|
||
| class TestControlFlowPtpDivider(TimeDaemonCitScenario): |
There was a problem hiding this comment.
I would believe that one and many others (all?) is not the Integration tests but SW Componenet ones.
it doesn't mean, we don't need them, but they are just on differnt level and should be put to differnet folder not to confuse
There was a problem hiding this comment.
Agreed. These tests verify interactions between internal Machines within TimeDaemon (intra-process), not cross-component communication — they are SW Component Tests. Renamed the directory integration_tests/ → component_tests/ to reflect the correct level and avoid confusion. All Bazel targets and references updated accordingly.
There was a problem hiding this comment.
we don't need it anymore.
|
|
||
| ## Component Integration Test framework | ||
|
|
||
| bazel_dep(name = "score_test_scenarios", version = "0.3.0", dev_dependency = True) |
There was a problem hiding this comment.
Why did you fix the version to the 0.3.0?
I think in the 0.4.1 (?) the issue with json is solved, you will then need no patch any more
There was a problem hiding this comment.
You're right. Upgraded to v0.4.1 (fec712d4) — the json dependency issue is fixed upstream so the patch is no longer needed either.
|
|
||
| bazel_dep(name = "score_test_scenarios", version = "0.3.0", dev_dependency = True) | ||
| git_override( | ||
| module_name = "score_test_scenarios", |
There was a problem hiding this comment.
At the end I would have some doubts about the framework.
the tests which I see here, they do not verify the interaction between differnet sw components, but rather, how the subcompoenents in oecomponent interating between each other.
so, it is the SW Component test, which could be (and even is) implemented by the unit tests (gtests)
cross check for hte test duplication.
for the real integration tests (TimeSlave <-> TimeDameon <-> CustomerApp) I would propose to use score_itf framework which provides the possibility to execute tests on host and on the target platfrom
There was a problem hiding this comment.
Understood. The tests in this PR are intentionally SW Component Test level — they verify interactions between internal Machines (VerificationMachine, ControlFlowDivider, IPCMachine, etc.) using in-process stubs, not cross-process IPC. The full plan is three layers:
PR1 (this PR): TimeDaemon component tests — intra-process, score_test_scenarios
PR2: TimeSlave component tests — same level, same framework
PR3: TimeSlave ↔ TimeDaemon module integration test — cross-process, will use score_itf
Cross-check with existing gtests is a good point — will review for duplication before PR3.
| psutil | ||
| pytest-metadata | ||
| pytest-env | ||
| testing-utils @ git+https://github.com/eclipse-score/testing_tools.git@v0.3.0 |
There was a problem hiding this comment.
it would be better to use the githash, not the tag to make the build reproducable
There was a problem hiding this comment.
Done. Replaced @v0.3.0 with the pinned commit hash a2f9cded3deb636f5dc800bf7a47131487119721.
| catch (const std::exception& ex) | ||
| { | ||
| std::cerr << ex.what() << std::endl; | ||
| return 101; |
There was a problem hiding this comment.
what 101 means here?
is it handled anywhere?
There was a problem hiding this comment.
101 is reserved for framework-level crashes — an unhandled C++ exception during scenario runner setup, distinct from test logic results (0 = all pass, 1 = test failure). Added static constexpr int kFrameworkError = 101 to make the intent explicit. The Python side treats any non-zero exit as a setup/framework error.
| print("Building C++ test scenarios executable...") | ||
| bazel_tools = BazelTools(option_prefix="cpp", build_timeout=build_timeout) | ||
| cpp_target_name = session.config.getoption("--cpp-target-name") | ||
| bazel_tools.build(cpp_target_name, "--config=time-x86_64-linux") |
There was a problem hiding this comment.
shall we make the bazel config paramterized? now the linux config is hardcoded
There was a problem hiding this comment.
Done. Extracted to a --bazel-config pytest CLI option with default time-x86_64-linux. Can be overridden at invocation, e.g. pytest --build-scenarios --bazel-config=time-arm64-qnx.
| "src/**/*.cpp", | ||
| "src/**/*.hpp", | ||
| ]), | ||
| copts = ["-g"], |
There was a problem hiding this comment.
do we really need it always?
shall it be controlled from bazel cli?
There was a problem hiding this comment.
Removed. Debug symbols can be enabled at the Bazel CLI level with --copt=-g or --compilation_mode=dbg when needed.
| ) | ||
| use_repo(pip, "pip_time_daemon_venv") | ||
|
|
||
| bazel_dep(name = "rules_cc", version = "0.2.17", dev_dependency = True) |
There was a problem hiding this comment.
Do we need it?
it wasn't there and assumption, it will come form the project
There was a problem hiding this comment.
rules_cc is needed explicitly here because @score_test_scenarios//test_scenarios_cpp loads @rules_cc//cc:cc_library.bzl directly. Since score_test_scenarios is a new dev dependency not present on main, rules_cc must also be declared. Without it the build fails when resolving the module graph.
This PR adds TimeDaemon component integration tests with pip hub infrastructure (part 1 of 3):
Part of #56
test QNX