-
Notifications
You must be signed in to change notification settings - Fork 476
test: observational baseline for transitive-unreferenced-module (#4572) #14374
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
robinbb
merged 2 commits into
ocaml:main
from
robinbb:robinbb-test-transitive-unreferenced-module
Apr 30, 2026
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
74 changes: 74 additions & 0 deletions
74
test/blackbox-tests/test-cases/per-module-lib-deps/transitive-unreferenced-module.t
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,74 @@ | ||
| A consumer transitively depends upon a library through one module of an | ||
| intermediate library, never naming a sibling module of the transitive lib in | ||
| source. The current but undesirable behaviour is that the consumer rebuilds | ||
| when any module of the transitively depended upon library changes, even | ||
| unreferenced ones. | ||
|
|
||
| [intermediate_lib] and [main] each include an unused dummy module so neither | ||
| stanza is single-module — single-module stanzas take a fast path that would | ||
| mask the behaviour being baselined here. | ||
|
|
||
| $ cat > dune-project <<EOF | ||
| > (lang dune 3.23) | ||
| > EOF | ||
|
|
||
| $ cat > dune <<EOF | ||
| > (library (name dep_lib) (wrapped false) (modules reached_module unreached_module)) | ||
| > (library (name intermediate_lib) (wrapped false) (modules intermediate_module intermediate_dummy) (libraries dep_lib)) | ||
| > (executable (name main) (modules main main_dummy) (libraries intermediate_lib)) | ||
| > EOF | ||
|
robinbb marked this conversation as resolved.
|
||
|
|
||
| $ cat > reached_module.ml <<EOF | ||
| > let v = 42 | ||
| > EOF | ||
| $ cat > reached_module.mli <<EOF | ||
| > val v : int | ||
| > EOF | ||
| $ cat > unreached_module.ml <<EOF | ||
| > let v = 43 | ||
| > EOF | ||
| $ cat > unreached_module.mli <<EOF | ||
| > val v : int | ||
| > EOF | ||
| $ cat > intermediate_module.ml <<EOF | ||
| > let v = Reached_module.v | ||
| > EOF | ||
| $ cat > intermediate_dummy.ml <<EOF | ||
| > let _ = () | ||
| > EOF | ||
| $ cat > main.ml <<EOF | ||
| > let _ = Intermediate_module.v | ||
| > EOF | ||
| $ cat > main_dummy.ml <<EOF | ||
| > let _ = () | ||
| > EOF | ||
|
|
||
| $ dune build ./main.exe | ||
|
|
||
| Edit [unreached_module] (both [.mli] and [.ml]) — a module no source in this | ||
| test references — and record the rebuild list for [main]: | ||
|
|
||
| $ cat > unreached_module.mli <<EOF | ||
| > val v : int | ||
| > val extra : int | ||
| > EOF | ||
| $ cat > unreached_module.ml <<EOF | ||
| > let v = 43 | ||
| > let extra = 99 | ||
| > EOF | ||
| $ dune build ./main.exe | ||
| $ dune trace cat | jq -s 'include "dune"; [.[] | targetsMatchingFilter(test("dune__exe__Main\\."))]' | ||
| [ | ||
| { | ||
| "target_files": [ | ||
| "_build/default/.main.eobjs/byte/dune__exe__Main.cmi", | ||
| "_build/default/.main.eobjs/byte/dune__exe__Main.cmti" | ||
| ] | ||
| }, | ||
| { | ||
| "target_files": [ | ||
| "_build/default/.main.eobjs/native/dune__exe__Main.cmx", | ||
| "_build/default/.main.eobjs/native/dune__exe__Main.o" | ||
| ] | ||
| } | ||
| ] | ||
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.