Skip to content

Commit

Permalink
Make ortac load a subset of plugins
Browse files Browse the repository at this point in the history
This feature will be usefull to test the dune plugin (#190) in CI.
  • Loading branch information
n-osborne committed Jan 16, 2024
1 parent 5f6756a commit 59b61d7
Show file tree
Hide file tree
Showing 11 changed files with 22 additions and 18 deletions.
2 changes: 2 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Unreleased

- Change `ORTAC_ONLY_PLUGIN` to `ORTAC_PLUGINS`
[\#195](https://github.com/ocaml-gospel/ortac/pull/195)
- Add an include option to qcheck-stm cli
[\#181](https://github.com/ocaml-gospel/ortac/pull/181)
- Add a quiet flag
Expand Down
6 changes: 4 additions & 2 deletions bin/cli.ml
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
let () =
match Sys.getenv_opt "ORTAC_ONLY_PLUGIN" with
match Sys.getenv_opt "ORTAC_PLUGINS" with
| None -> Sites.Plugins.Plugins.load_all ()
| Some plug -> Sites.Plugins.Plugins.load plug
| Some plug ->
let plugs = String.split_on_char ',' plug in
List.iter Sites.Plugins.Plugins.load plugs

open Cmdliner

Expand Down
6 changes: 3 additions & 3 deletions examples/dune
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
(targets lwt_dllist_tests.ml)
(action
(setenv
ORTAC_ONLY_PLUGIN
ORTAC_PLUGINS
qcheck-stm
(with-stdout-to
%{targets}
Expand Down Expand Up @@ -77,7 +77,7 @@
(targets varray_tests.ml)
(action
(setenv
ORTAC_ONLY_PLUGIN
ORTAC_PLUGINS
qcheck-stm
(with-stdout-to
%{targets}
Expand Down Expand Up @@ -123,7 +123,7 @@
(targets varray_circular_tests.ml)
(action
(setenv
ORTAC_ONLY_PLUGIN
ORTAC_PLUGINS
qcheck-stm
(with-stdout-to
%{targets}
Expand Down
2 changes: 1 addition & 1 deletion plugins/monolith/test/generated/dune
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
(package ortac-monolith))
(action
(setenv
ORTAC_ONLY_PLUGIN
ORTAC_PLUGINS
monolith
(with-stderr-to
errors
Expand Down
2 changes: 1 addition & 1 deletion plugins/qcheck-stm/doc/index.mld
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ you indicate the file you want to test, the function call to build a value of
the type indicated in the third argument. You can write the generated code into
a file, using the [-o] option.

{@sh set-ORTAC_ONLY_PLUGIN=qcheck-stm[
{@sh set-ORTAC_PLUGINS=qcheck-stm[
$ ortac qcheck-stm example.mli "make 42 'a'" "char t" -o stm_example.ml
]}

Expand Down
2 changes: 1 addition & 1 deletion plugins/qcheck-stm/test/dune
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
(package ortac-qcheck-stm))
(action
(setenv
ORTAC_ONLY_PLUGIN
ORTAC_PLUGINS
qcheck-stm
(ignore-stdout
(with-stderr-to
Expand Down
12 changes: 6 additions & 6 deletions plugins/qcheck-stm/test/dune.inc
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
(package ortac-qcheck-stm))
(action
(setenv
ORTAC_ONLY_PLUGIN
ORTAC_PLUGINS
qcheck-stm
(with-stderr-to
array_errors
Expand Down Expand Up @@ -63,7 +63,7 @@
(package ortac-qcheck-stm))
(action
(setenv
ORTAC_ONLY_PLUGIN
ORTAC_PLUGINS
qcheck-stm
(with-stderr-to
hashtbl_errors
Expand Down Expand Up @@ -116,7 +116,7 @@
(package ortac-qcheck-stm))
(action
(setenv
ORTAC_ONLY_PLUGIN
ORTAC_PLUGINS
qcheck-stm
(with-stderr-to
record_errors
Expand Down Expand Up @@ -169,7 +169,7 @@
(package ortac-qcheck-stm))
(action
(setenv
ORTAC_ONLY_PLUGIN
ORTAC_PLUGINS
qcheck-stm
(with-stderr-to
ref_errors
Expand Down Expand Up @@ -222,7 +222,7 @@
(package ortac-qcheck-stm))
(action
(setenv
ORTAC_ONLY_PLUGIN
ORTAC_PLUGINS
qcheck-stm
(with-stderr-to
conjunctive_clauses_errors
Expand Down Expand Up @@ -275,7 +275,7 @@
(package ortac-qcheck-stm))
(action
(setenv
ORTAC_ONLY_PLUGIN
ORTAC_PLUGINS
qcheck-stm
(with-stderr-to
sequence_model_errors
Expand Down
2 changes: 1 addition & 1 deletion plugins/qcheck-stm/test/dune_gen.ml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ let rec print_rules pos =
(package ortac-qcheck-stm))
(action
(setenv
ORTAC_ONLY_PLUGIN
ORTAC_PLUGINS
qcheck-stm
(with-stderr-to
%s_errors
Expand Down
2 changes: 1 addition & 1 deletion plugins/qcheck-stm/test/test_errors.t
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
In this file, we test the different ways to make the `ortac qcheck-stm`
command-line fail, so we load only the `qcheck-stm` plugin:

$ export ORTAC_ONLY_PLUGIN=qcheck-stm
$ export ORTAC_PLUGINS=qcheck-stm

We can make a syntax error in either the expression for the `init` function, or
in the type declaration for the sytem under test:
Expand Down
2 changes: 1 addition & 1 deletion plugins/wrapper/test/generated/dune
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
(package ortac-wrapper))
(action
(setenv
ORTAC_ONLY_PLUGIN
ORTAC_PLUGINS
wrapper
(with-stderr-to
errors
Expand Down
2 changes: 1 addition & 1 deletion plugins/wrapper/test/suite/dune.common
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
(package ortac-wrapper))
(action
(setenv
ORTAC_ONLY_PLUGIN
ORTAC_PLUGINS
wrapper
(with-stdout-to
%{target}
Expand Down

0 comments on commit 59b61d7

Please sign in to comment.