Commit Graph

202 Commits

Author SHA1 Message Date
Louis Gesbert
97940c2cb6 Clerk report: better diff coloring 2024-07-08 14:52:28 +02:00
Louis Gesbert
03e74b505d Cleanup 2024-07-04 15:08:13 +02:00
Louis Gesbert
583e80993a Remove the with-exceptions backend
*Disclaimer*: This is intended for discussion

My impression is that the with-exceptions backend is to be superseded by the
without-exception backend, which is more general and more efficient. Therefore,
seeing the added complexity of maintaining the two in parallel, I see no good
reason to keep the with-exceptions version now that the equivalence of their
semantics have been proved.

It will also be nice to reduce divergences between the different backends ; and
this should make further simplifications possible (e.g. some thunkings may no
longer be needed)

Of course I am ready to hear arguments in favor of keeping it, be it in the mid-
or long-term.

This patch removes the `--avoid-exceptions` flag, making it the only option, and
the corresponding `with_exceptions` variant of the dcalc->lcalc translation. It
doesn't do further simplifications.
2024-07-04 15:08:13 +02:00
Louis Gesbert
29cb1978e0 Clerk report: add JUnit-compatible XML output 2024-07-04 14:47:50 +02:00
Louis Gesbert
cdb31ffd57
Support for basic clerk.toml configuration files (#639) 2024-07-01 15:40:06 +02:00
Louis Gesbert
2d756698fb clerk report: allow to choose diff command
Also, detect non-GNU diff or absence of colors, and fallback to a basic view;
this is actually more readable in logs or diffs.
2024-06-27 12:06:24 +02:00
Louis Gesbert
05752988e6 Clerk: add support for basic configuration files
Not much there at the moment, but being able to specify the include directories
is already pretty useful to run clerk directly e.g. on `catala-examples`.

(you had to explicitely specify variable `CATALA_INCLUDE`, the `-I` flags or to
go through `make` without that)
2024-06-26 10:41:12 +02:00
Louis Gesbert
31adaa019f Clerk report: disambiguate empty and missing ref lines 2024-06-24 10:18:19 +02:00
Louis Gesbert
38a93424a8 Clerk reports: postprocess diff output
This relies less on specific color flags of GNU diff, and reformats and
colorises the output.
(it may still depend on the specific layout of GNU diff with the `-y` flag
though)
2024-06-21 18:19:09 +02:00
Louis Gesbert
dc1b725e9b Reformat 2024-06-21 12:23:01 +02:00
Louis Gesbert
8881fee37f Allow catala ocaml --closure-conversion
it's probably not useful per se, but will be handy for debugging
2024-06-21 12:23:01 +02:00
Louis Gesbert
71fdaab262 Clerk reports: add -I flags to repro commands 2024-06-21 12:23:01 +02:00
Louis Gesbert
69e862a9d1 Clerk report: avoid Seq.Forced_twice error on incomplete test input 2024-06-21 12:16:49 +02:00
Louis Gesbert
b83f613dce Fix spurious clerk rebuilds
Hm apparently not everyone has an OCaml compiler that unconditionally generates
`cmt` files ;)
2024-06-20 14:41:57 +02:00
Louis Gesbert
859a602c0b
Clerk reports: add verbosity flags
`--summary`
`--short`
`--failures` (default)
`--verbose`

(`--debug` also adds some detail, e.g. the commands to reproduce non-failing
tests, or the files without failures in the default mode)
2024-06-19 16:10:26 +02:00
Louis Gesbert
80400d838a
Messages: improve string padding processing 2024-06-19 16:10:26 +02:00
Louis Gesbert
45b0feaf20
Generate tests reports from 'clerk test'
This is a proper replacement for the previous shell-based placeholder hack.

Here is a summary:

- `clerk runtest` (normally run by ninja) is much extended:
  * besides generating the test@out file, it checks individual tests for success
    and can write a report file containing their status, and the positions for
    their (expected/current) outputs (this uses `Marshal`)
  * it now handles out-tests directly in addition to inline-tests, for which
    it generates the separate output file ; they are included in the report

- ninja is now tasked with building all the test reports (which shouldn't fail);
  for directories, individual reports are concatenated (as before).
  Removing intermediate report rules, and out-test rules means that the ninja
  file is much simplified.

- then, clerk takes back control, reads the final reports and formats them in a
  user-friendly way. Printing the reports may imply running `diff` internally.
  In particular, the commands to easily reproduce each test are provided.
  Resetting the test results if required is also done directly by clerk, at this
  stage.

A few switches are available to customise the output, but I am waiting for some
feedback before deciding what to make available from the CLI.

The `clerk report` command is available to manually explore test reports, but
normally the processing is done directly at the end of `clerk test` (i.e. ninja
will no longer call that command)
2024-06-19 16:10:26 +02:00
Louis Gesbert
d0998312eb Inline tests: add lightweight sanitisation of the command outputs 2024-05-28 11:43:50 +02:00
Louis Gesbert
a94c5fe644 Clerk runtest: bufferise command output
instead of directing the output directly to the file.
2024-05-28 11:43:50 +02:00
Louis Gesbert
1efdf4262d Clerk: fix finalisation on exit
We have temporary files to remove upon `ninja` completion so it's not a good
idea to `exec` without fork. This patch ensures `/tmp/clerk_*.ninja` files
aren't left in `/tmp`.
2024-05-08 12:27:10 +02:00
Louis Gesbert
1412e76938 Clerk: fix OCaml linking options to allow inlining
Fixes occurences of `Warning 58 [no-cmx-file]: no cmx file was found in path for
module` during builds.
2024-04-23 16:01:23 +02:00
Louis Gesbert
96ea034839 Clerk: clean up CATALA_* variables on tests 2024-04-19 16:50:36 +02:00
Louis Gesbert
1de18f0e04 Preserve the capitalisation of module filenames
Module names must be capitalised (start with a capital letter), and the name of
the file on disk must match ; however, matching up to capitalisation is allowed,
i.e. the file on disk can start with a lowercase letter.

A mismatch between Clerk assuming generated module artifacts would match the
capitalised module name, and `catala depends` matching the names of files on
disk (because it would otherwise mean treating dependencies differently
depending on if they originate from modules or not) was causing "file not found"
errors later on in the compilation chain.

This patch enforces that the capitalisation of the original file name on
disk (which is always known) takes precedence in Clerk, matching the behaviour
of `catala depends` and fixing the issue. It's also actually a small
simplification in Clerk code.
2024-04-15 23:00:56 +02:00
Louis Gesbert
98fc97a241 Rewriting message calls to use the new intf 2024-04-10 19:26:23 +02:00
Louis Gesbert
c9dca1fc6d Fix multi-repo compilation and the 'make alltest' target 2024-03-20 14:41:10 +01:00
Louis Gesbert
1a17098297 Move file functions that were in Cli to File
it's now possible because Globals where moved away
2024-03-19 15:26:32 +01:00
Louis Gesbert
0908ed85c3 Clerk: generate all .mli files as well 2024-03-19 15:26:32 +01:00
Louis Gesbert
4cec981f62 Move global options of Cli to their own module
This resolves a dependency cycle that would forbid `Cli` from using the modue
`File`, which was annoying.
2024-03-19 15:18:35 +01:00
Louis Gesbert
77ba1b8b38 Clerk: split OCaml compiler & link rules
and fix call to `catala depends` for OCaml linking
2024-03-14 14:04:52 +01:00
Louis Gesbert
ff06ddf40c Fixing linking across modules for backends
- This adds a `catala depends` command that recursively tracks module dependency.
It can then be used by Clerk for linking.

- Generation of cmo object files are added for OCaml (we only built native
objects, but jsoo requires bytecode).

- Some fixes to the generation of value embed/deembed shims (related to types
coming from different modules ; add support for options ; etc.)
2024-03-08 17:36:00 +01:00
Louis Gesbert
70cbfdb9ac Add a CATALA_INCLUDE env variable
It'll help while we wait for the implementation of project-wide specifications.
2024-03-08 17:36:00 +01:00
Louis Gesbert
bc3add57ec Fix plugins lookup dir when Catala is installed to PATH 2024-03-08 17:36:00 +01:00
Louis Gesbert
c1cd32a8f8 Clerk: skip unchanged tests when running with '--test-flags'
To avoid duplicating runs of identical tests: other tests are unaffected by the
flags.

Also tweak the Makefile to avoid multiple dune runs
2024-02-26 14:56:43 +01:00
Louis Gesbert
b43cc04e16 Clerk tests: use separate dirs for different flags, to preserve caching
The default output remains at the top of _build if no specific flags have been
given, the others are in `_build/test<flags>`
2024-02-26 14:56:43 +01:00
Louis Gesbert
20c1dee5cb Tests: add catala test-scope pseudo-command for inline tests 2024-02-26 14:56:43 +01:00
Louis Gesbert
e0928677b1 Small ocaml/js output rehaul
Print to json directly rather than depend on yojson and a ppx.

Note: this should be tested with the website in order to validate that the Json
output is 1-to-1.
(a second step could be to simplify this output, now that it's manual)
2024-02-21 11:28:56 +01:00
Louis Gesbert
98ad084062 Clerk: add python targets 2024-02-19 10:44:20 +01:00
Louis Gesbert
eb4ba114d2 Add test for literate LaTeX output 2024-02-15 14:53:26 +01:00
Louis Gesbert
9c84457c36 Clerk: improve progress messages 2024-02-12 18:00:27 +01:00
Louis Gesbert
f7672857a7 Formatting 2024-02-09 18:36:12 +01:00
Louis Gesbert
82fb66daef Clerk: fix options passed to catala in out-test mode 2024-02-09 10:54:58 +01:00
Louis Gesbert
34ae4f6156 Clerk: fix sometimes not rebuilding cmxs files 2024-02-05 16:28:56 +01:00
Denis Merigoux
d7e71885c1
Formatting 2024-02-01 17:22:42 +01:00
Louis Gesbert
54ca62a78e Fix definition and usage of the C backend test
(including fix of Clerk about "legacy tests")
2024-02-01 15:59:45 +01:00
Louis Gesbert
d9a17db4c0 Fix running inline tests
Warning: one of them is broken and was disabled
2024-01-18 16:14:27 +01:00
Louis Gesbert
fcb7ef61ff Clerk: fix @post file popping in src dirs 2024-01-16 18:07:31 +01:00
Louis Gesbert
538e97dfd3 Install Python and R runtimes
Runtimes for the various backends are expected to be made available from their
own ecosystem. However, for convenience and to help with development
settings (where the runtime might change), as part of installing catala they are
put, in source form, into `<prefix>/lib/catala/runtime_LANG`.

When using a dev version of Catala, and using Python, one would then just have
to do `pip install <prefix>/lib/catala/runtime_python` within their venv to be
able to run their python programs.
2024-01-16 11:54:28 +01:00
Louis Gesbert
ce812a6685 ninja_utils has been moved away 2024-01-16 11:54:28 +01:00
Louis Gesbert
acdaf7c57d Remove french_law, examples, merge clerk into catala package 2024-01-16 11:54:23 +01:00
Louis Gesbert
5b1462d529 Clerk: allow to include non-yet-existing directories
Useful when you have wide `-I` options that not all targets may depend on.
2023-12-08 13:56:31 +01:00