11 Commits

Author SHA1 Message Date
Pierre-Marie de Rodat
d5fafd3f76 Testsuite: fix directory separator baseline discrepancies on Windows 2026-01-22 13:10:09 +01:00
Pierre-Marie de Rodat
6cd2a8c3e7 Testsuite: extend lkt_compile.py for multi-dir Lkt sources
The upcoming revamp of Lkt modules will make it impossible to have
multiple Lkt source files share common declarations (`common_*.lkt`)
with bi-directional references: the individual sources can import
entities from the definite `common_*` modules, but the common modules
do not have a specific module for their own imports.

To overcome this, extend the `lkt_compile.py` script so that it
considers `test.lkt` sources in test subdirectories, and arrange for the
Lkt source path to make the top-level directory available: this will
allow test files to all have the same name (they will be in separate
directories), and so the common files will have a specific module name
to use for imports.
2026-01-20 16:03:43 +00:00
Pierre-Marie de Rodat
389d78a6e7 langkit.config: introduce JSON deserialization
Also rework lkt_compile and lkt_build_and_run test drivers so that the
language spec configuration bits are stored in the testcase's test.yaml
file directly: no need to add glue code in various places (test driver,
lkt_compile.py/lkt_build_and_run.py scripts) to support a new kind of
language spec configuration.
2025-01-07 15:09:51 +00:00
Pierre-Marie de Rodat
109fd493c7 Introduce separate data structure to hold the language spec config
Replace the messy collection of arguments for CompileCtx.__init__ and
CompileCtx.create_all_passes with better organized dataclasses in the
new langkit.config module. Update the codebase to use these data
structures.
2025-01-07 09:54:56 +00:00
Pierre-Marie de Rodat
8cfcffd96a Rehaul the handling of optional passes
Rework the formatting for the listing of optional passes, refactor the
handling of --pass-on/--pass-off (to enable/disable optional passes), fix
a couple of crashes and add a testcase to exercise this little used part
of Langkit.
2024-11-05 08:58:12 +00:00
Pierre-Marie de Rodat
9514b56cf6 Let language specs enable unparsers with a grammar annotation
Whether unparsers are generated or not has implications on legality
checks for the grammar, so it makes sense for this to be a property of
the grammar itself: introduce an Lkt annotation as well as a
langkit.parsers.Grammar argument for it, and remove the corresponding
CompileCtx argument.

Also rename "generate_unparser" to "generate_unparsers" for consistency
across the codebase.
2024-11-05 08:58:12 +00:00
Pierre-Marie de Rodat
3df6923bcc Testsuite: enable lkt_compile tests to check the CompileCtx
Transition the remaining Lkt tests that needed this feature from the
Python driver to the lkt_compile one.
2024-05-13 10:55:03 +00:00
Pierre-Marie de Rodat
a1ae4d9cda properties/warn_public_doc: transition to the lkt_compile driver 2023-12-13 13:36:33 +00:00
Pierre-Marie de Rodat
8af036b351 python_support/lkt_compile.py: accept "*.lkt" files as arguments
When debugging a testcase that contains multiple "*.lkt" files, it is
sometimes convenient to run the "lkt_compile.py" script on a single
source file. This commit extends this script to accept "lkt entry
points" as command line arguments.
2023-12-13 13:36:32 +00:00
Pierre-Marie de Rodat
2f0f07acbe lkt_compile driver: add support to run post-compilation test.py scripts
Some test will use this script to perform arbitrary checks on the result
of the compilation.
2023-12-13 13:36:32 +00:00
Pierre-Marie de Rodat
fa79e76f46 Testsuite: create a new "lkt_compile" test driver
All tests which just check the presence/absence of errors when compiling
Lkt language specs have the same "test.py" script: put a reference
script in "python_support", create a new test driver to let tests use
it easily and migrate relevant tests to it.

For GitHub issue #622
2022-06-08 12:24:31 +00:00