From 1ed3ac921af9284fd9a31a02487a4e8277f246d8 Mon Sep 17 00:00:00 2001 From: Robin Bate Boerop Date: Thu, 30 Apr 2026 16:35:37 -0700 Subject: [PATCH] test: regression guard for cross-lib reads of single-module leaf libs Adds [test-cases/per-module-lib-deps/no-ocamldep-leaf-lib.t]. Documents that a multi-module consumer of a single-module leaf library builds without error today. Companion to the other observational baselines under [test-cases/per-module-lib-deps/]: each pins a structural shape that an inter-library filter must respect. Signed-off-by: Robin Bate Boerop --- .../no-ocamldep-leaf-lib.t | 41 +++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 test/blackbox-tests/test-cases/per-module-lib-deps/no-ocamldep-leaf-lib.t diff --git a/test/blackbox-tests/test-cases/per-module-lib-deps/no-ocamldep-leaf-lib.t b/test/blackbox-tests/test-cases/per-module-lib-deps/no-ocamldep-leaf-lib.t new file mode 100644 index 00000000000..28412a899cf --- /dev/null +++ b/test/blackbox-tests/test-cases/per-module-lib-deps/no-ocamldep-leaf-lib.t @@ -0,0 +1,41 @@ +A multi-module consumer of a single-module leaf library builds +without error. + + $ cat > dune-project < (lang dune 3.23) + > EOF + +[leaf]: unwrapped, single-module, no library dependencies. This is +exactly the shape that triggers the no-ocamldep fast path: + + $ mkdir leaf + $ cat > leaf/dune < (library (name leaf) (wrapped false)) + > EOF + $ cat > leaf/mod_leaf.ml < let v = 1 + > EOF + $ cat > leaf/mod_leaf.mli < val v : int + > EOF + +[consumer]: multi-module library that depends on [leaf] and +references [Mod_leaf] from one of its modules. The consumer is +multi-module (so it doesn't itself hit the no-ocamldep fast path); +what we're probing is whether anything tries to read [leaf]'s +ocamldep: + + $ mkdir consumer + $ cat > consumer/dune < (library (name consumer) (wrapped false) (libraries leaf)) + > EOF + $ cat > consumer/c.ml < let _ = Mod_leaf.v + > EOF + $ cat > consumer/d.ml < let _ = () + > EOF + +Build must succeed: + + $ dune build @check