Repository navigation
test: bin pform expansion - #14431
Merged
Merged
Conversation
This was referenced May 5, 2026
Alizter
force-pushed
the
push-vxpoqsvypvsz
branch
3 times, most recently
from
May 6, 2026 17:37
2390daf to
7f4417a
Compare
Alizter
force-pushed
the
push-vxpoqsvypvsz
branch
6 times, most recently
from
May 10, 2026 18:41
9901158 to
c6c0a9d
Compare
Add test/blackbox-tests/test-cases/bin-pform/ with focused tests for
the %{bin:NAME} pform.
New tests:
- cram-path.t %{bin:...} in cram (deps ...)
- env-binaries.t %{bin:...} for (env (binaries ...)) entries
- include-deps.t %{bin:...} inside (include ...) deps
- inline-tests.t %{bin:...} in (inline_tests (deps ...))
- multiple-bins.t multiple %{bin:...} deps in a single rule
- public-name.t %{bin:...} expansion for (public_name)
- run-action.t %{bin:...} in (run ...) and PATH visibility
- run-literal-vs-pform.t (run NAME) vs (run %{bin:NAME}) record
different deps (build artifact vs install
staging)
- system.t %{bin:...} for a system binary on PATH
- test-stanza.t %{bin:...} in a test stanza
- missing-bin.t %{bin:...} and (run LITERAL) where the name
doesn't resolve
Plus a cross-compilation analog of lib-pform-context-expansion-gh9199.t
at custom-cross-compilation/bin-pform-context-expansion.t.
Renamed:
- bin-eager-deps.t -> bin-pform/lazy-failure.t
- adversarial-binary-name.t -> bin-pform/colon-in-name.t
- build-percent-form-bin.t -> bin-pform/cli-build.t
Split missing-lib-bin-pform-errors-gh1541.t: bin parts moved into
bin-pform/missing-bin.t, lib parts stay in
missing-lib-pform-errors-gh1541.t.
setup-script.sh: add env_added helper.
Signed-off-by: Ali Caglayan <[email protected]>
Alizter
force-pushed
the
push-vxpoqsvypvsz
branch
from
May 10, 2026 18:48
c6c0a9d to
e3e3a21
Compare
Alizter
marked this pull request as ready for review
May 10, 2026 18:49
rgrinberg
approved these changes
May 10, 2026
Alizter
added a commit
that referenced
this pull request
May 21, 2026
Resolve `%{bin:...}` to the build artifact path (`Original_path`)
instead of the install staging area. When `%{bin:...}` appears in `(deps
...)`, a bin-layout directory is created under
`_build/install/<context>/.binaries/<digest>/` with correctly-named
symlinks, and added to `PATH`.
The legacy staging paths (`_build/install/default/bin`, `lib`, etc.)
remain on the root env for now. They cannot be removed until `(deps
(package ...))` provides its own scoped layout (the install-layout PR
#14373), since actions using `(package ...)` deps still rely on the
staging area for `PATH` and `OCAMLPATH` visibility.
Env binaries (from `(env (binaries ...))`) are excluded from the
bin-layout since they already use `.bin/` on `PATH`.
`Dep_conf_eval.unnamed` and `Dep_conf_eval.named` now return a single
`Env.t Action_builder.t` whose evaluation both registers deps and
produces the env (previously a tuple with a separate `unit
Action_builder.t` for deps registration). Build-tracking-only callers
(`lib_flags`, `simple_rules`) discard the env via
`Action_builder.ignore`.
`(include FILE)` inside `(deps ...)` propagates the recursive call's
`bin_env` via a new `Include_result` variant on `dep_evaluation_result`;
`named_paths_builder` folds the include `bin_env`s into the final
`bin_env` via `Env_path.extend_env_concat_path`. Without this, the
action's `PATH` would not get a bin-layout dir for include-d bin pforms.
The change is not gated by lang version: #3324 affects every lang
version, so gating would leave the bug unfixed for pre-3.24 projects.
The user-visible realignments are confined to in-`_build` paths and the
migration cost is small enough to not warrant a per-project opt-in.
- Fixes #3324
- Depends on #14430 (merged)
- Depends on #14431 (merged)
- [x] changelog
- [x] documentation
## Known limitations (deferred to follow-up)
- dune's sandbox does not relocate the `PATH` environment variable. The
bin-layout dir on `PATH` points at the un-sandboxed `_build/`. This
works locally because absolute paths are still readable from inside the
sandbox, but would break under remote action execution. Tracked by
`test/blackbox-tests/test-cases/bin-pform/sandbox.t`.
- `Bin_layout.Key.reverse_table` grows unboundedly in long-running
`--watch` sessions (one entry per unique sorted bin set). Pattern
inherited from `Ppx_driver.Key`. Bounded by the number of distinct bin
sets the workspace evaluates; unlikely to be a real problem.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In this PR we organise all the tests about
%{bin:...}and increase our test coverage. This is in preparation of:Add
test/blackbox-tests/test-cases/bin-pform/with focused tests forthe
%{bin:NAME}pform.New tests:
cram-path.t%{bin:...}in cram(deps ...)env-binaries.t%{bin:...}for(env (binaries ...))entriesinclude-deps.t%{bin:...}inside(include ...)depsinline-tests.t%{bin:...}in(inline_tests (deps ...))multiple-bins.tmultiple%{bin:...}deps in a single rulepublic-name.t%{bin:...}expansion for(public_name)run-action.t%{bin:...}in(run ...)andPATHvisibilityrun-literal-vs-pform.t(run NAME)vs(run %{bin:NAME})record different deps (build artifact vs install staging)system.t%{bin:...}for a system binary onPATHtest-stanza.t%{bin:...}in a test stanzamissing-bin.t%{bin:...}and(run LITERAL)where the name doesn't resolvePlus a cross-compilation analog of
lib-pform-context-expansion-gh9199.tat
custom-cross-compilation/bin-pform-context-expansion.t.Renamed:
bin-eager-deps.t -> bin-pform/lazy-failure.tadversarial-binary-name.t -> bin-pform/colon-in-name.tbuild-percent-form-bin.t -> bin-pform/cli-build.tSplit
missing-lib-bin-pform-errors-gh1541.t: bin parts moved intobin-pform/missing-bin.t, lib parts stay inmissing-lib-pform-errors-gh1541.t.setup-script.sh: add env_added helper.