Skip to content

Use out-channel-redirect and add wasm_of_ocaml support - #436

Open
hhugo wants to merge 11 commits into
mirage:mainfrom
hhugo:use-out-channel-redirect
Open

Use out-channel-redirect and add wasm_of_ocaml support#436
hhugo wants to merge 11 commits into
mirage:mainfrom
hhugo:use-out-channel-redirect

Conversation

@hhugo

@hhugo hhugo commented Mar 31, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Replace custom C stubs and JS runtime for stdout/stderr redirection with the out-channel-redirect library
  • Add wasm_of_ocaml support (runtime stubs, test mode, CI)
  • Add alcotest-wasm virtual package (mirroring alcotest-js)
  • Bump dune lang to 3.17

Test plan

  • Native tests pass
  • JS tests pass
  • Wasm tests pass

🤖 Generated with Claude Code

hhugo added 5 commits March 31, 2026 15:46
Replace custom C stubs and JS runtime for dup/dup2-based redirection
with the out-channel-redirect library, which handles native, JS, and
wasm targets.
Install binaryen and wasm_of_ocaml-compiler in CI, then run @runtest-wasm
with WASM_OF_OCAML=true on OCaml >= 4.14.
@hhugo
hhugo marked this pull request as draft March 31, 2026 14:17
@hhugo

hhugo commented Mar 31, 2026

Copy link
Copy Markdown
Contributor Author

Draft because https://github.com/hhugo/out-channel-redirect is not yet released

hhugo and others added 6 commits April 3, 2026 12:26
Virtual package pulling in wasm_of_ocaml-compiler alongside alcotest,
mirroring alcotest-js for JavaScript.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
When matrix.opam-local-packages is unset, it evaluates to "" which
overrides setup-ocaml's default of *.opam, causing local packages
not to be pinned. This makes the solver unable to resolve
alcotest {= version} from alcotest-wasm.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@hhugo
hhugo force-pushed the use-out-channel-redirect branch from 4fdf616 to 957ae5c Compare April 3, 2026 10:26
@hhugo
hhugo marked this pull request as ready for review April 3, 2026 12:30
@samoht

samoht commented Aug 13, 2026

Copy link
Copy Markdown
Member

Downstream confirmation: ocaml-wire's full test suite runs under
wasm_of_ocaml with this branch. Without it, Alcotest's per-test capture calls
the jsoo-only alcotest_before_test primitive, so the current workaround is
to set ALCOTEST_VERBOSE=1 and skip capture for the wasm test stanza.

The downstream CI and workaround are here:
https://github.com/parsimoni-labs/ocaml-wire/blob/version/test/wasm/dune

Once this merges and is released, we can remove that environment override.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants