-
Notifications
You must be signed in to change notification settings - Fork 99
Description
Goal
Ensure that the container StaticVec & StaticString can be used in an inter-process communication context (C++ <-> Rust) without serialization.
Therefore, we require tests that ensure
- an identical memory layout of that classes
- the order/offsets of the members must be identical
- the size and alignment of the members
- the semantic type of the members (see
int64_tvsu64in thesizemember)
- the have the same content contracts
- see
StaticStringthat supports only characters < 128, if one programming language is able to add illegal characters it would break the contract on the other side
Implementation
1. Identifcal memory layout
This requires whitebox testing on C++ and Rust side. We could introduce a testing.hpp file in the C++ library and a new iceoryx2-bb-container-conformance-tests crate on the C++ side.
- Introduce C function that can and return the size, alignment, offset and type of the members and return it
- for the type we actually need only to know if the
m_sizevariable is an unsigned integer, the rest can be deduced from the size
- for the type we actually need only to know if the
- Use bindgen and build.rs to generate a rust file to access the
testing.hppfunctions within a rust test suite - write integration tests in
iceoryx2-bb-container-conformance-teststhat uses thetesting.hppfunctions and compares the layout with the rust counterpart
2. Same content contract
Introduce a new root folder called component-tests and structure it identical to the examples folder.
component-tests/cxxcomponent-tests/rustcomponent-tests/e2e-tests
Write a request response process, where the client requests a change in a given container and the server responds with the performed change. See:
- rust: https://github.com/eclipse-iceoryx/iceoryx2/tree/main/examples/rust/request_response
- c++: https://github.com/eclipse-iceoryx/iceoryx2/tree/main/examples/cxx/request_response
For instance: client add characterxto given string, server responds with string and clients prints the result to the console.
The output can be verified with expect like it is done in the cross-language-end-to-end-tests in the examples folder. The character to add request can be parameterized via cli arguments.