mctp/server: add mock-transport test suite

Add a comprehensive set of integration and unit tests for the MCTP server
that run without the I2C transport layer. A BufferSender mock replaces
the real I2C sender; no transport hardware or system linker is required.

New files:
- tests/common/mod.rs     -- shared fixtures: BufferSender, DroppingBufferSender,
                             DirectClient, DirectListener, DirectRespChannel,
                             DirectReqChannel, transfer()
- tests/server_unit.rs    -- unit tests for Server methods: EID management,
                             handle alloc/free, try_recv, inbound routing,
                             oversized payload, register_recv + timeout
- tests/integration.rs    -- multi-fragment reassembly, concurrent listeners,
                             echo via MctpListener+MctpRespChannel traits,
                             MctpReqChannel, drop_handle mid-flight,
                             response EID/tag threading

Updated files:
- tests/echo.rs           -- refactored to use common/ (no duplicated fixtures)
- tests/dispatch.rs       -- refactored to use common/; added edge-case tests:
                             malformed request, unknown opcode, Recv with no
                             message, Unbind
- BUILD.bazel             -- four new rust_test targets, one per test file
- README.md               -- document new test layout and Bazel invocations

All four Bazel test targets pass:
  bazel test //services/mctp/server:mctp_server_{echo,dispatch,unit,integration}_test
8 files changed
tree: 4283d9bc31c93607ea9329c0f812e47fad500e3f
  1. .cargo/
  2. .claude/
  3. .github/
  4. apps/
  5. docs/
  6. hal/
  7. openprot/
  8. patches/
  9. platform/
  10. services/
  11. target/
  12. third_party/
  13. xtask/
  14. .bazelignore
  15. .bazelrc
  16. .bazelversion
  17. .gitignore
  18. .semgrepignore
  19. BUILD.bazel
  20. BUILD.md
  21. Cargo.lock
  22. Cargo.toml
  23. deny.toml
  24. LICENSE
  25. MODULE.bazel
  26. MODULE.bazel.lock
  27. out-of-tree.md
  28. port-mctp-echo.md
  29. pw
  30. README.md
  31. rust-toolchain.toml
  32. workflows.json
README.md

OpenPRoT

Technical Charter

The OpenPRoT Technical Charter can be found at https://github.com/OpenPRoT/.github/blob/main/GOVERNANCE.md

Getting Started

This project uses cargo-xtask for build automation and project management.

Available Tasks

You can run tasks using cargo xtask <task-name>:

  • cargo xtask build - Build the project
  • cargo xtask test - Run all tests
  • cargo xtask check - Run cargo check
  • cargo xtask clippy - Run clippy lints
  • cargo xtask fmt - Format code with rustfmt
  • cargo xtask clean - Clean build artifacts
  • cargo xtask dist - Build a distribution (release build)
  • cargo xtask docs - Build documentation with mdbook
  • cargo xtask cargo-lock - Manage Cargo.lock file
  • cargo xtask precheckin - Run all pre-checkin validation checks
  • cargo xtask header-check - Check license headers in source files
  • cargo xtask header-fix - Fix missing license headers in source files

Examples

# Build the project
cargo xtask build

# Run tests
cargo xtask test

# Create a distribution
cargo xtask dist

# Format code
cargo xtask fmt

# Run clippy
cargo xtask clippy

# Build documentation
cargo xtask docs

# Run all pre-checkin validation checks
cargo xtask precheckin

# Check license headers
cargo xtask header-check

# Fix missing license headers
cargo xtask header-fix

Development

The project is structured as a Cargo workspace with two main components:

  • openprot/ - The main application
  • xtask/ - Build automation scripts

The xtask workflow allows you to add custom build steps, automation, and project management tasks written in Rust, making them cross-platform and easy to maintain.

Requirements

  • Rust 1.70+ (2021 edition)
  • Cargo

No additional tools are required - everything is handled through Cargo and the xtask scripts.