Skip to content

test(pkg): show dune exec run binaries from project dependencies - #16310

Merged
Alizter merged 1 commit into
ocaml:mainfrom
Sudha247:test-exec-dependency-binaries
Sep 4, 2026
Merged

test(pkg): show dune exec run binaries from project dependencies#16310
Alizter merged 1 commit into
ocaml:mainfrom
Sudha247:test-exec-dependency-binaries

Conversation

@Sudha247

@Sudha247 Sudha247 commented Sep 3, 2026

Copy link
Copy Markdown
Member

Description

I discovered this feature while working on #12914, and found that we currently don't have a test for it. This test essentially shows that it is currently possible to run a binary that is shipped with a dependency. I have examined more behaviors of this, which I'll try to add in follow-up PRs.

This is possible owing to:

let which context =
let artifacts_and_deps =
Memo.lazy_
~name:"lock-directory-binaries"
~human_readable_description:(fun () ->
Pp.textf
"Loading all binaries in the lock directory for %S"
(Context_name.to_string context))
(fun () ->
let+ { binaries; dep_info = _ } =
all_project_deps context >>= Action_expander.Artifacts_and_deps.of_closure
in
binaries)
in
Staged.stage (fun program ->
let+ artifacts = Memo.Lazy.force artifacts_and_deps in
Filename.Map.find artifacts program)
;;

Related Issue and Motivation

Relates to work to be done in #16185

Checklist

  • Tests added, if applicable.
  • Change log entry added for any user-facing changes. (NA)
  • Documentation added for any user-facing changes. (NA)

Signed-off-by: Sudha Parimala <sudharg247@gmail.com>

@punchagan punchagan left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems reasonable. I've written a similar test as a part of my work for bin-narrowing in #15381. I wonder if it's better to eventually have my tests in the pkg/ directory instead of pkg/bin-narrowing. (I can fold my exec test into this one)

@Alizter
Alizter merged commit cbc5bff into ocaml:main Sep 4, 2026
66 of 68 checks passed
@Alizter Alizter added this to the 3.25.0 milestone Sep 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants