Add integration tests for LoLa/mw::com feature in ITF#21
Add integration tests for LoLa/mw::com feature in ITF#21Subramanian-K812 wants to merge 11 commits into
Conversation
…communication_feature_integration_tests
…ance-vs-process ASIL abort
PiotrKorkus
left a comment
There was a problem hiding this comment.
did you try to use scenario framework for apps implementation? Any blockers?
| then discovers the service and receives samples over the config-declared | ||
| SHM binding. | ||
| """ | ||
| staged = "/tmp/comm_fit_runtime_manifest.json" |
There was a problem hiding this comment.
there is still default mw_com_config.json and its identical to yours
prove modified config works
There was a problem hiding this comment.
Fixed: manifest instance name now mutated and verified against non‑existent entry.
| // Sequence number was encoded in the payload by fit_sender; | ||
| // the sample derefs to the generated Tire type. | ||
| let pressure = sample.pressure; | ||
| println!("FIT_RECV seq={}", pressure as i64); |
There was a problem hiding this comment.
When passed f32 and casted into i64 it will saturate, NaN -> 0.
Improve test to assert each received seq.
There was a problem hiding this comment.
Fixed: raw f32 printed via Display; NaN/inf now visible instead of casted integer.
| produced (0 .. send_cycles-1). A corrupted payload would decode to a value | ||
| outside that range. | ||
| """ | ||
| return all(0 <= s < send_cycles for s in seq) |
There was a problem hiding this comment.
check the expected next value, sequence as whole. Not just range
There was a problem hiding this comment.
Fixed: merged into strict samples_are_sequential_and_intact (range + step check).
| assert not result.found_service, "consumer proceeded past config load to service discovery" | ||
| assert not result.received_samples, "consumer proceeded to receive samples despite bad config" |
There was a problem hiding this comment.
can we get more strict assertions what was the reason of exit? There might be dozens of reasons behind crash, excluding just 2 of them in test is not sufficient
There was a problem hiding this comment.
Fixed: split into deterministic missing‑config exit (1) vs malformed‑config abort (134).
| let discovery = runtime.find_service::<VehicleInterface>(FindServiceSpecifier::Specific(service_id.clone())); | ||
| if let Ok(instances) = discovery.get_available_instances() { | ||
| if let Some(builder) = instances.into_iter().next() { | ||
| return builder.build().ok(); |
There was a problem hiding this comment.
.ok() hides denied proxy build error without diagnostic, we should be verbose
There was a problem hiding this comment.
Fixed: denied‑proxy error now matched and logged; ACL test asserts marker presence.
| ":fit_sender", | ||
| ":fit_receiver", | ||
| ], | ||
| package_dir = "standalone", |
There was a problem hiding this comment.
Fixed: removed unused package_dir
|
|
||
| def is_non_decreasing(seq: list[int]) -> bool: | ||
| """No reordering: each received sequence number is >= the previous one.""" | ||
| return all(b >= a for a, b in zip(seq, seq[1:])) |
There was a problem hiding this comment.
shall we tolerate equals? dupes are not expected or?
| "comm_helpers.py", | ||
| "test_communication.py", |
There was a problem hiding this comment.
extract to separate group, this will mix in the future.
Gather all groups under all_tests
There was a problem hiding this comment.
Fixed: new communication_tests filegroup created
| "@score_tooling//python_basics/score_pytest:attribute_plugin", | ||
| ], |
There was a problem hiding this comment.
attr plugin should be used from itf not tooling
There was a problem hiding this comment.
Fixed: switched to proper py_itf_plugin wrapper
Yes, have the checked the scenario framework. It only supports single-process runs via one Rust binary. Communication tests need cross-process proof — ACL enforcement by real UIDs, late-join semantics, service discovery — which the framework can’t handle. |
Add communication (LoLa / mw::com) integration tests to ITF
Summary
Adds an ITF test suite for the communication module (LoLa /
mw::com).The suite drives its own two-process scenario —
showcases/standalone/comm_fit:fit_sender+fit_receiver, built on thesame public
com_apiRust cratecom-api-exampleuses — as two real OSprocesses communicating over real shared memory.
The tests assert on data the consumer actually observes — delivery, ordering,
and value-integrity of a sequence number the sender encodes in the payload —
rather than on log strings the application prints about its own
configuration, so a regression in the middleware is what breaks them.
The suite runs under the existing
//feature_integration_tests/itf:itftarget on both the Linux (Docker) and QNX (QEMU) configs.
What's added
showcases/standalone/comm_fit/fit_sender.rsVehicleInterfaceservice instance, publishesleft_tiresamples carrying a monotonically increasing sequence number.showcases/standalone/comm_fit/fit_receiver.rsshowcases/standalone/comm_fit/BUILDfit_sender/fit_receiverand bundles them for deployment.showcases/BUILDcomm_fitbundle into the reference image alongsidecom-api-example.patches/communication/002-expose-com-api-gen.patchcom-api-gen(the generatedVehicleInterface) outside//score/mw/com, sofit_sender/fit_receivercan depend on it.bazel_common/score_modules_target_sw.MODULE.bazelscore_communicationgit_override.known_good.jsonMODULE.bazel(required by theknown_good_correctCI check).feature_integration_tests/itf/test_communication.pyfeature_integration_tests/itf/comm_helpers.pyCommResult, ordering/integrity checks, deployment-config and ASIL-B ACL scenario helpers).feature_integration_tests/itf/test_properties.pyattribute_plugin.add_test_properties, mirroringfeature_integration_tests/test_cases/test_properties.py(verified identical).feature_integration_tests/itf/BUILDitftarget and activates the requirement-traceability plugin (-p attribute_plugin+@score_tooling//python_basics/score_pytest:attribute_plugindep).Test coverage
test_fit_binaries_are_deployedfit_sender/fit_receiverbinaries present on the target image.test_event_exchange_delivers_dataevent_type,producer_consumer,interfaces,data_driven_arch,service_discoverytest_received_samples_are_ordered_and_intactdata_corruption,data_reorderingtest_deployment_config_is_read_from_runtime_pathdepl_config_runtime-s <path>manifest, not compiled in.test_late_joining_consumer_receives_datastateless_communication,producer_consumertest_missing_config_file_fails_deterministicallydepl_config_runtimetimeout, never reaches service discovery.test_truncated_config_fails_deterministicallydepl_config_runtimeRECV_EXIT=134).test_schema_invalid_config_fails_deterministicallydepl_config_runtimetest_mixed_criticality_acl_isolationasil,acl_for_consumer,acl_for_producer,acl_per_service_instanceRequirement IDs are the published
feat_req__com__*identifiers, attached via@add_test_properties(partially_verifies=[...])so they are emitted into theJUnit XML
<properties>— the same traceability convention used by thepersistency FIT cases under
feature_integration_tests/test_cases.The negative-config tests (
missing/truncated/schema_invalid) and the ACLisolation test each run against a dedicated instance specifier that no other
test offers, so they cannot observe another test's leftover shared-memory
state (the QEMU target is session-scoped and persists across the whole test
file, unlike the Docker plugin's fresh-container-per-test model).
Limitations
allowedConsumerenforcement is ashared-memory ACL keyed on the consumer's real UID, so exercising it needs a
consumer running under a UID excluded from the allow-list (
setprivonLinux,
on -u <uid>on QNX). On QNX, LoLa'sMessagePassingServiceendpoint registration itself requires privilege, so a consumer launched
under a lower-privilege UID aborts at message-passing setup before
reaching the shared-memory ACL check. The denial therefore cannot be
attributed to the ACL on QNX, so the test skips there; it runs on Linux,
where an unprivileged UID can still bring up its endpoint and so reaches the
ACL check the assertions rely on.
Verification
--config=qnx-x86_64): confirmed 8 passed, 1skipped across multiple runs (
test_mixed_criticality_acl_isolationskips for the reason under Limitations).
--config=linux-x86_64, what CI's "Linux — Build &Integration Test" job runs): confirmed 9 passed
JUnit XML (
bazel-testlogs/.../itf/test.xml)