Skip to content

Phase 2: finish existing cmocka suite (os_path, serializer, darray) + CI + Windows/macOS Tier 2 #5

Closed

Description

@zackees

Part of the roadmap meta issue. Follows docs/rust-port/testing-policy.md.

Context

Three cmocka tests remain after bitstream. Each breaks an assumption Phase 1 relied on:

  • test_os_path → os_get_path_extension is one function inside libobs/util/platform.c (846 LOC). ENABLE_RUST_LIBOBS only drops whole files.
  • test_serializer → util/serializer.h (inline functions) + util/array-serializer.c.
  • test_darray → util/darray.h is macros and static inline functions. It is compiled into every caller, so a Rust symbol can never replace it; the ABI is the struct darray layout.
  • No workflow runs the Rust or C unit tests, and ENABLE_RUST_LIBOBS=ON has only been validated on Linux (Windows obs.dll exports and macOS symbol hiding are TODOs).

Proposal

  1. Policy PR first (docs/rust-port/testing-policy.md):
    • Function extraction: to port part of a C file, first move the function(s) to their own .c file in a separate behavior-neutral PR, then port that file.
    • Header-inline exemption: for static inline/macro code, Tier 2 is a layout test of the public structs, and Tier 1 and Tier 3 still apply. The C stays in place until every caller is Rust.
  2. Extract os_get_path_extension to libobs/util/path-extension.c (behavior-neutral PR), then port it.
  3. Port array-serializer.c. The inline serializer.h functions fall under the exemption.
  4. darray: Rust tests + parity against the oracle + struct darray layout test, under the exemption.
  5. Wire tests into the existing build-project.yaml (pending approval): soldr cargo test --workspace + cmocka with ENABLE_RUST_LIBOBS OFF and ON.
  6. Windows: export the shim symbols from obs.dll. macOS: hide Rust internals (-unexported_symbols_list or equivalent). Exported-symbol diff OFF vs ON on both.

Acceptance criteria

  • Policy PR merged before any port in this phase.
  • Each port: RED (Tier 1 against todo!() stubs) → GREEN shown in its PR; Tier 2/3 pass; mutation check noted.
  • test_os_path.c, test_serializer.c, test_darray.c unmodified and passing with ENABLE_RUST_LIBOBS OFF and ON.
  • Layout tests for struct darray, struct serializer, struct array_output_data.
  • CI runs Rust tests + cmocka OFF/ON on Linux, Windows, macOS (after approval); exported-symbol sets identical OFF vs ON on all three.

Decisions

  • Extraction PRs are separate from port PRs, so each diff is reviewable on its own.
  • darray is not forced into a symbol swap; its layout is the contract.
  • os_get_path_extension(NULL) returns NULL in the Rust port. The C version calls strlen(NULL), which is undefined behavior, so no caller can depend on it. This is an intentional difference and is documented in rust/README.md and the shim.
  • CI runs the Rust tests through soldr: zackees/setup-soldr (pinned by SHA, cache: false), then soldr cargo test/clippy/fmt. This follows the approved soldr cargo test --workspace rule and AGENTS.md ("never bare cargo").

Activity

  1. added
    enhancement
    on Oct 8, 2026
  2. zackees commented on Oct 9, 2026

    @zackees
    MemberAuthor

    Landed on feature branch grind/meta-4-7c2e via #10; closes when feature PR #9 merges into master.

  3. added 2 commits that reference this issue on Oct 10, 2026
  4. moved this from Done to Triage in obs-rust Multiviewon Oct 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions