Skip to content

Commit

Permalink
Add tests for re-exporting transitive dependencies
Browse files Browse the repository at this point in the history
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
  • Loading branch information
rgrinberg committed Sep 5, 2019
1 parent 61d4184 commit 7bbdfe0
Show file tree
Hide file tree
Showing 9 changed files with 78 additions and 4 deletions.
10 changes: 10 additions & 0 deletions test/blackbox-tests/dune.inc
Original file line number Diff line number Diff line change
Expand Up @@ -1354,6 +1354,14 @@
test-cases/quoting
(progn (run %{exe:cram.exe} -test run.t) (diff? run.t run.t.corrected)))))

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

(alias
(name reason)
(deps (package dune) (source_tree test-cases/reason))
Expand Down Expand Up @@ -1908,6 +1916,7 @@
(alias project-root)
(alias promote)
(alias quoting)
(alias re-exported-deps)
(alias reason)
(alias redirections)
(alias reporting-of-cycles)
Expand Down Expand Up @@ -2098,6 +2107,7 @@
(alias project-root)
(alias promote)
(alias quoting)
(alias re-exported-deps)
(alias redirections)
(alias reporting-of-cycles)
(alias rule-target-external)
Expand Down
16 changes: 12 additions & 4 deletions test/blackbox-tests/test-cases/dune-cache/run.t
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,25 @@
> EOF
$ env DUNE_CACHE=1 DUNE_CACHE_EXIT_NO_CLIENT=1 XDG_RUNTIME_DIR=$PWD/.xdg-runtime XDG_CACHE_HOME=$PWD/.xdg-cache dune build target
$ stat --format=%h _build/default/source
2
stat: illegal option -- -
usage: stat [-FlLnqrsx] [-f format] [-t timefmt] [file ...]
[1]
$ stat --format=%h _build/default/target
2
stat: illegal option -- -
usage: stat [-FlLnqrsx] [-f format] [-t timefmt] [file ...]
[1]
$ ls _build/default/beacon
_build/default/beacon
$ rm -rf _build/default
$ env DUNE_CACHE=1 DUNE_CACHE_EXIT_NO_CLIENT=1 XDG_RUNTIME_DIR=$PWD/.xdg-runtime XDG_CACHE_HOME=$PWD/.xdg-cache dune build target
$ stat --format=%h _build/default/source
2
stat: illegal option -- -
usage: stat [-FlLnqrsx] [-f format] [-t timefmt] [file ...]
[1]
$ stat --format=%h _build/default/target
2
stat: illegal option -- -
usage: stat [-FlLnqrsx] [-f format] [-t timefmt] [file ...]
[1]
$ test -e _build/default/beacon
[1]
$ cat _build/default/source
Expand Down
26 changes: 26 additions & 0 deletions test/blackbox-tests/test-cases/re-exported-deps/run.t
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
dependencies can be exported transitively:
$ dune exec ./foo.exe --root transitive
Entering directory 'transitive'
Entering directory 'transitive'
ocamlc .foo.eobjs/byte/dune__exe__Foo.{cmi,cmo,cmt} (exit 2)
(cd _build/default && /Users/rgrinberg/.opam/4.08.0/bin/ocamlc.opt -w @1..3@5..28@30..39@43@46..47@49..57@61..62-40 -strict-sequence -strict-formats -short-paths -keep-locs -g -bin-annot -I .foo.eobjs/byte -I .aaa.objs/byte -I .aaa.objs/native -no-alias-deps -opaque -o .foo.eobjs/byte/dune__exe__Foo.cmo -c -impl foo.ml)
File "foo.ml", line 1, characters 11-14:
1 | module A = AAA
^^^
Error (warning 49): no cmi file was found in path for module AAA
File "foo.ml", line 2, characters 11-14:
2 | module B = BBB
^^^
Error (warning 49): no cmi file was found in path for module BBB
File "foo.ml", line 3, characters 11-14:
3 | module C = CCC
^^^
Error (warning 49): no cmi file was found in path for module CCC
[1]

transtive deps expressed in the dune-package

$ dune build @install --root transitive
Entering directory 'transitive'
$ cat transitive/_build/install/default/lib/pkg/dune-package | grep re_exports
[1]
Empty file.
Empty file.
Empty file.
23 changes: 23 additions & 0 deletions test/blackbox-tests/test-cases/re-exported-deps/transitive/dune
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
(library
(public_name pkg.aaa)
(name aaa)
(libraries bbb)
(modules aaa)
(re_exports bbb))

(library
(public_name pkg.bbb)
(name bbb)
(libraries ccc)
(modules bbb)
(re_exports ccc))

(library
(modules ccc)
(name ccc)
(public_name pkg.ccc))

(executable
(name foo)
(modules foo)
(libraries aaa))
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
(lang dune 2.0)

(package
(name pkg))
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module A = AAA
module B = BBB
module C = CCC

0 comments on commit 7bbdfe0

Please sign in to comment.