Skip to content
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

Add test cases to show binary/lib name collisions #2358

Merged
merged 1 commit into from
Jul 4, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions test/blackbox-tests/dune.inc
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,14 @@
test-cases/exclude-missing-module
(progn (run %{exe:cram.exe} -test run.t) (diff? run.t run.t.corrected)))))

(alias
(name exe-name-mangle)
(deps (package dune) (source_tree test-cases/exe-name-mangle))
(action
(chdir
test-cases/exe-name-mangle
(progn (run %{exe:cram.exe} -test run.t) (diff? run.t run.t.corrected)))))

(alias
(name exec-cmd)
(deps (package dune) (source_tree test-cases/exec-cmd))
Expand Down Expand Up @@ -1628,6 +1636,7 @@
(alias env-var-expansion)
(alias env-variables)
(alias exclude-missing-module)
(alias exe-name-mangle)
(alias exec-cmd)
(alias exec-missing)
(alias external-lib-deps)
Expand Down Expand Up @@ -1818,6 +1827,7 @@
(alias env-var-expansion)
(alias env-variables)
(alias exclude-missing-module)
(alias exe-name-mangle)
(alias exec-cmd)
(alias exec-missing)
(alias external-lib-deps)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
let () =
Foo.run ()
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
(executable
(libraries foo)
(name baz))

(alias
(name default)
(action (run ./baz.exe)))
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
(lang dune 1.11)
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
(* finally calling into library *)
let run = Bar.run ()
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
(* directly usable but will cause linking error *)
let run = Foo.run
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
(library
(name foo)
(wrapped false))
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
let run () = print_endline "not directly usable"
15 changes: 15 additions & 0 deletions test/blackbox-tests/test-cases/exe-name-mangle/run.t
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
Binary composed of a single module with the same name as the dependency
$ dune build --root single-module 2>&1 | grep -v ocamlopt
Entering directory 'single-module'
File "exe.ml", line 1:
Error: The files foo/.foo.objs/byte/foo.cmi and .exe.eobjs/byte/exe.cmi
make inconsistent assumptions over interface Exe
Binary composed of multiple modules where one collides with a dependency
$ dune build --root multi-module 2>&1 | grep -v ocamlopt | grep -v ocamlc
Entering directory 'multi-module'
File "foo.ml", line 1:
Error: The files foo/.foo.objs/byte/bar.cmi and .baz.eobjs/byte/foo.cmi
make inconsistent assumptions over interface Foo
File "baz.ml", line 1:
Error: The files .baz.eobjs/byte/foo.cmi and .baz.eobjs/byte/foo.cmi
make inconsistent assumptions over interface Foo
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
(* make sure everything is linked *)
let run = Exe.run
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
(library
(name exe)
(wrapped false))
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
let run () = print_endline "this module is unlinkable"
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
(executable
(libraries foo)
(name exe))

(alias
(name default)
(action (run ./exe.exe)))
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
(lang dune 1.11)

(implicit_transitive_deps false)
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
let () =
Foo.run ()
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
(library
(libraries exe)
(name foo))
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
let run () =
Exe.run ();
Collisionlib.run ()