Skip to content

decouple test outptus from dune paths - #69

Closed
shonfeder wants to merge 1 commit into
mirage:mainfrom
shonfeder:decouple-from-dune-paths
Closed

decouple test outptus from dune paths#69
shonfeder wants to merge 1 commit into
mirage:mainfrom
shonfeder:decouple-from-dune-paths

Conversation

@shonfeder

Copy link
Copy Markdown

Dune expands the %{bin:...} variable form to a path to the executable, but the exact name of the executable file at that path is subject to change as an implementation detail of dune's internals so relying on this path for textual output in test fixtures is not stable. The location of this path is changing in dune 3.34 (as a result of ocaml/dune#14432), and this will cause these tests to fail, as written. By decoupling reference to the executable name from specification of the dependency in the dune rule, we can ensure a stable result in the tests and set a better example for usage.

This breaking change was discovered thru the opam-repo CI in the pre-release of dune 3.34 ocaml/opam-repository#29996 (comment)

The `%{bin:...}` variable form is expanded to a path to the executable,
but the exact name of the executable file at that path is subject to
change as an implementation detail of dune's internals so relying on
this path for textual output in test fixtures is not stable. The
location of this path is changing in dune 3.34, which would cause these
tests to fail. Decoupling reference to the executable name from
specification of the dependency will ensure a stable result in the
tests.
@dinosaure

Copy link
Copy Markdown
Member

Thanks for your proposal and sorry for the late response. I'm not sure if the ocaml-crunch refer to the one that dune builds or the one available into an opam switch. I prefer to fix the binary name as I did in #71 but I would like to know in details how dune picks the binary when we use ocaml-crunch instead of %{bin:ocaml-crunch}.

avsm pushed a commit to ocaml/opam-repository that referenced this pull request Jul 29, 2026
CHANGES:

- Be able to split a document according to a block-size parameter and generate a full string
  (instead of a list of pieces) if `block_size=0` (@toots, @dinosaure, mirage/ocaml-crunch#70)
- Fix our tests with `dune.3.34` (@shonfeder, @dinosaure, mirage/ocaml-crunch#69, mirage/ocaml-crunch#71)
@shonfeder

Copy link
Copy Markdown
Author

Sorry I missed your reply!

I would like to know in details how dune picks the binary when we use ocaml-crunch instead of %{bin:ocaml-crunch}

It will pick the binary from the path it constructs before running the action, and %{bin:ocaml-crunch} ensures that binary is on the path

@shonfeder

Copy link
Copy Markdown
Author

IIUC, this was addressed by #71, so I can close here. LMK if you have any other questions!

@shonfeder shonfeder closed this Sep 2, 2026
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