My little experiment is an ocaml lib and an ocaml test ; the ocaml test is in fact supposed to be compiled, run to print (stdout) a coq file, which should then be fed to coq to check for correctness.
How does one do something like this?
You can make a rule that runs the test that will output the .v file into a directory. That directory should have a coq.theory stanza and it will p;ick up the .v file.
So if your ocaml executable is mytest.exe
you can do a rule like
(rule
(targets outfile.v)
(action
(run %{mytest.exe}}}}
{coq.theory
(name mytest))
@Ali Caglayan thanks for you answer ; that set me on a better path:
(executable
(name main_test)
(libraries elaboration str))
(rule
(target main_test.v)
(deps (:main_test "main_test.exe"))
(action (with-stdout-to %{target} (run %{main_test}))))
(coq.theory (name main_test.v))
but that makes the test run on "dune build" which wasn't my purpose, so I guess it isn't perfect yet...
When you are running dune build
you are really doing dune build @default
. The default
alias can be configured further but is by default @all
. If you want to build the theory when building @runtest
(that is what dune test(/runtest)
builds), then you can add the targets of the coq theory to the alias using the (alias)
stanza. Something like:
(alias
(name runtest)
(deps main_test.vo))
should work.
This (name main_test.v)
seems fishy
Indeed dune build
means by default dune build @all
, you may want to change that.
Last updated: Sep 15 2024 at 13:02 UTC