diff --git a/.gitignore b/.gitignore index 84a91c0..8a99cde 100644 --- a/.gitignore +++ b/.gitignore @@ -11,7 +11,7 @@ streamlib_modules/ *.slpkg # Cargo `[patch]` scratch a `streamlib link` may drop -.cargo/config.toml +**/.cargo/config.toml # Python __pycache__/ diff --git a/README.md b/README.md index da8f615..9ce5e6b 100644 --- a/README.md +++ b/README.md @@ -78,3 +78,35 @@ These packages were extracted from the 2026-07-14 as a source snapshot. **Git history prior to 2026-07-14 lives in tatolab/streamlib** — this repo starts fresh and does not carry the pre-split commit history. + +## Running the package tests + +Each package's self-contained tests (`packages/network/tests/network_packet_serde_bytes_wire_format.rs`, +`packages/vadr-vision/tests/reassembly_integration.rs`) build against a +linked streamlib checkout. Packages whose schemas reference other +packages (`mavlink`, `vadr-vision` → `@tatolab/network`; `vadr-vision` → +`@tatolab/jpeg`) additionally need a registry for schema resolution, +because sibling-directory resolution is not a thing — schemas resolve by +version from the link checkout's `packages/` tree or a registry, and +`@tatolab/network` no longer lives in the streamlib checkout. + +The local dev-registry flow (no hosting required): + +```bash +# 1. Emit a registry tree from a streamlib checkout (core, jpeg, …): +cd +cargo run -p xtask -- static-registry emit --out /tmp/dev-registry + +# 2. Publish this repo's packages into the same tree: +export STREAMLIB_REGISTRY_URL="file:///tmp/dev-registry" +cd /packages/network && streamlib pkg publish + +# 3. Link + test any package: +cd ../mavlink +streamlib link --engine +STREAMLIB_REGISTRY_URL="file:///tmp/dev-registry" cargo test +``` + +`legacy-tests/` holds inherited test files that predate the engine-free +conversion and need a rewrite against the module-loading flow before +they can run again — see `legacy-tests/README.md`. diff --git a/legacy-tests/README.md b/legacy-tests/README.md new file mode 100644 index 0000000..ce61661 --- /dev/null +++ b/legacy-tests/README.md @@ -0,0 +1,33 @@ +# Legacy tests — pre-engine-free relics (not compiled) + +These test files were inherited from the streamlib monorepo snapshot but +predate the packages' conversion to the engine-free plugin SDK. They are +**not wired into any crate** and do not compile as written, for a +structural reason, not a missing-dependency reason: + +Each of them registers the package processors **in-process** via +`PROCESSOR_REGISTRY.register::()` +and then drives a `Runner` in the same process. That model only worked +when these packages compiled against the `streamlib` engine facade. As +engine-free packages, their processor types implement the plugin SDK's +traits — not the engine's — so in-process typed registration is +impossible by design (that is the capability split working as intended). + +The correct rewrite is the **module-loading flow**: build/link the +package into a host's `streamlib_modules/` and let the runtime dlopen it +(`runtime.add_processor(processor_type_ref!(...))` with lazy module +discovery), the same shape as streamlib's `load_project_dylib_*` +integration tests. Until someone does that rewrite, the files are parked +here so the test logic (scenarios, assertions, fixtures) isn't lost: + +| File | Original home | Pipeline exercised | +|---|---|---| +| `udp_loopback.rs` | packages/network | UdpSource → UdpSink loopback | +| `udp_burst_stress.rs` | packages/network | burst/overflow behavior | +| `udp_throughput_bench.rs` | packages/network | throughput measurement | +| `mavlink_over_udp.rs` | packages/mavlink | UdpSource → MavlinkDecoder → MavlinkEncoder → UdpSink round-trip | +| `udp_vadr_jpeg_e2e.rs` (+ `fixtures/`) | packages/vadr-vision | UDP chunks → depayloader → reassembly → JpegDecoder → frame counter (needs a GPU) | + +The self-contained tests that survived the conversion still live in +their packages: `packages/network/tests/network_packet_serde_bytes_wire_format.rs` +and `packages/vadr-vision/tests/reassembly_integration.rs`. diff --git a/packages/vadr-vision/tests/fixtures/test_320x180.jpg b/legacy-tests/fixtures/test_320x180.jpg similarity index 100% rename from packages/vadr-vision/tests/fixtures/test_320x180.jpg rename to legacy-tests/fixtures/test_320x180.jpg diff --git a/packages/vadr-vision/tests/fixtures/test_640x360_spec.jpg b/legacy-tests/fixtures/test_640x360_spec.jpg similarity index 100% rename from packages/vadr-vision/tests/fixtures/test_640x360_spec.jpg rename to legacy-tests/fixtures/test_640x360_spec.jpg diff --git a/packages/vadr-vision/examples/jpeg_pipeline_demo.rs b/legacy-tests/jpeg_pipeline_demo.example.rs similarity index 100% rename from packages/vadr-vision/examples/jpeg_pipeline_demo.rs rename to legacy-tests/jpeg_pipeline_demo.example.rs diff --git a/packages/mavlink/tests/mavlink_over_udp.rs b/legacy-tests/mavlink_over_udp.rs similarity index 100% rename from packages/mavlink/tests/mavlink_over_udp.rs rename to legacy-tests/mavlink_over_udp.rs diff --git a/packages/network/tests/udp_burst_stress.rs b/legacy-tests/udp_burst_stress.rs similarity index 100% rename from packages/network/tests/udp_burst_stress.rs rename to legacy-tests/udp_burst_stress.rs diff --git a/packages/network/tests/udp_loopback.rs b/legacy-tests/udp_loopback.rs similarity index 100% rename from packages/network/tests/udp_loopback.rs rename to legacy-tests/udp_loopback.rs diff --git a/packages/network/tests/udp_throughput_bench.rs b/legacy-tests/udp_throughput_bench.rs similarity index 100% rename from packages/network/tests/udp_throughput_bench.rs rename to legacy-tests/udp_throughput_bench.rs diff --git a/packages/vadr-vision/tests/udp_vadr_jpeg_e2e.rs b/legacy-tests/udp_vadr_jpeg_e2e.rs similarity index 100% rename from packages/vadr-vision/tests/udp_vadr_jpeg_e2e.rs rename to legacy-tests/udp_vadr_jpeg_e2e.rs diff --git a/packages/network/Cargo.toml b/packages/network/Cargo.toml index 8b353f2..cb48d52 100644 --- a/packages/network/Cargo.toml +++ b/packages/network/Cargo.toml @@ -36,4 +36,8 @@ socket2 = "0.5" libc = "0.2.177" tracing = { version = "0.1.41", features = ["release_max_level_debug"] } +[dev-dependencies] +# The wire-format test decodes NetworkPacket from msgpack directly. +rmp-serde = "1.3" + [workspace]