-
Notifications
You must be signed in to change notification settings - Fork 90
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_t
vsu64
in thesize
member)
- the have the same content contracts
- see
StaticString
that 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_size
variable 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.hpp
functions within a rust test suite - write integration tests in
iceoryx2-bb-container-conformance-tests
that uses thetesting.hpp
functions 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/cxx
component-tests/rust
component-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 characterx
to 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.