Skip to content

Commit

Permalink
Build tests on bytecode only
Browse files Browse the repository at this point in the history
Signed-off-by: Nicolás Ojeda Bär <n.oje.bar@gmail.com>
  • Loading branch information
nojb committed Jan 10, 2024
1 parent ffdcba4 commit f7ca1e8
Showing 1 changed file with 12 additions and 26 deletions.
38 changes: 12 additions & 26 deletions test/blackbox-tests/test-cases/modules-expansion.t
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,15 @@ We declare a `executable` where the list of modules is read from the (generated)
file `gen/lst`:
$ cat >dune <<EOF
> (executable (name mod) (modules (:include gen/lst)))
> (executable (name mod) (modes byte) (modules (:include gen/lst)))
> EOF
Let's check that it fails in the current version of Dune:
$ dune exec ./mod.exe
File "dune", line 1, characters 23-51:
1 | (executable (name mod) (modules (:include gen/lst)))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "dune", line 1, characters 36-64:
1 | (executable (name mod) (modes byte) (modules (:include gen/lst)))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error: the ability to specify non-constant module lists is only available
since version 3.13 of the dune language. Please update your dune-project file
to have (lang dune 3.13).
Expand Down Expand Up @@ -82,7 +82,7 @@ Let's check that error messages owning to non-existent modules continue to work:
$ mv mod.ml mod2.ml
$ cat >dune <<EOF
> (executable (name mod) (modules (:include gen/lst)))
> (executable (name mod) (modes byte) (modules (:include gen/lst)))
> EOF
Locations are accurate even for generated files:
Expand All @@ -101,24 +101,22 @@ Let's do some examples using libraries:
$ cat >dune <<EOF
> (library
> (name lib)
> (modes byte)
> (modules (:include gen/lst)))
> EOF
$ dune build --display short
ocamlc .lib.objs/byte/lib.{cmi,cmo,cmt}
ocamldep .lib.objs/lib__Mod.impl.d
ocamlopt .lib.objs/native/lib.{cmx,o}
ocamlc .lib.objs/byte/lib__Mod.{cmi,cmo,cmt}
ocamlopt .lib.objs/native/lib__Mod.{cmx,o}
ocamlc lib.cma
ocamlopt lib.{a,cmxa}
ocamlopt lib.cmxs
We can also use special forms such as `%{read-lines:}`:
$ cat >dune <<EOF
> (library
> (name lib)
> (modes byte)
> (modules %{read-lines:gen/lst}))
> EOF
Expand All @@ -131,28 +129,24 @@ We can also use special forms such as `%{read-lines:}`:
$ dune build --display short
ocamlc .lib.objs/byte/lib.{cmi,cmo,cmt}
ocamldep .lib.objs/lib__Mod2.impl.d
ocamlopt .lib.objs/native/lib.{cmx,o}
ocamlc .lib.objs/byte/lib__Mod.{cmi,cmo,cmt}
ocamlc .lib.objs/byte/lib__Mod2.{cmi,cmo,cmt}
ocamlopt .lib.objs/native/lib__Mod.{cmx,o}
ocamlopt .lib.objs/native/lib__Mod2.{cmx,o}
ocamlc lib.cma
ocamlopt lib.{a,cmxa}
ocamlopt lib.cmxs
Interaction with `(include_subdirs)` when the dependencies are in the subtree:
$ cat >dune <<EOF
> (include_subdirs unqualified)
> (library
> (name lib)
> (modes byte)
> (modules %{read-lines:gen/lst}))
> EOF
$ dune build --display short
Error: Dependency cycle between:
(modules) field at dune:2
-> %{read-lines:gen/lst} at dune:4
-> %{read-lines:gen/lst} at dune:5
-> (modules) field at dune:2
[1]
Expand All @@ -164,6 +158,7 @@ Let's move the gen subdirectory out of the hierarchy:
> (include_subdirs unqualified)
> (library
> (name lib2)
> (modes byte)
> (modules %{read-lines:../gen/lst}))
> EOF
Expand All @@ -174,14 +169,9 @@ Let's move the gen subdirectory out of the hierarchy:
ocamlc lib/.lib2.objs/byte/lib2.{cmi,cmo,cmt}
ocamldep lib/.lib2.objs/lib2__Mod.impl.d
ocamldep lib/.lib2.objs/lib2__Mod2.impl.d
ocamlopt lib/.lib2.objs/native/lib2.{cmx,o}
ocamlc lib/.lib2.objs/byte/lib2__Mod.{cmi,cmo,cmt}
ocamlc lib/.lib2.objs/byte/lib2__Mod2.{cmi,cmo,cmt}
ocamlopt lib/.lib2.objs/native/lib2__Mod.{cmx,o}
ocamlopt lib/.lib2.objs/native/lib2__Mod2.{cmx,o}
ocamlc lib/lib2.cma
ocamlopt lib/lib2.{a,cmxa}
ocamlopt lib/lib2.cmxs
$ rm -rf lib
Expand All @@ -191,7 +181,7 @@ appears. We need to handle this cycle gracefully and report it to the user.
$ cat >dune <<EOF
> (rule (with-stdout-to lst (echo "mod")))
> (executable (name mod) (modules (:include lst)))
> (executable (name mod) (modes byte) (modules (:include lst)))
> EOF
$ dune exec ./mod.exe
Expand All @@ -206,6 +196,7 @@ Let's do one example with a generated source file:
$ cat >dune <<EOF
> (library
> (name lib)
> (modes byte)
> (modules mod3 (:include gen/lst)))
> (rule (with-stdout-to mod3.ml (progn)))
> (rule (with-stdout-to mod4.ml (progn)))
Expand All @@ -217,11 +208,6 @@ Let's do one example with a generated source file:
ocamlc .lib.objs/byte/lib.{cmi,cmo,cmt}
ocamldep .lib.objs/lib__Mod3.impl.d
ocamldep .lib.objs/lib__Mod4.impl.d
ocamlopt .lib.objs/native/lib.{cmx,o}
ocamlc .lib.objs/byte/lib__Mod3.{cmi,cmo,cmt}
ocamlc .lib.objs/byte/lib__Mod4.{cmi,cmo,cmt}
ocamlopt .lib.objs/native/lib__Mod3.{cmx,o}
ocamlopt .lib.objs/native/lib__Mod4.{cmx,o}
ocamlc lib.cma
ocamlopt lib.{a,cmxa}
ocamlopt lib.cmxs

0 comments on commit f7ca1e8

Please sign in to comment.