test
The idea is to run those tests before each commit.
All tests are done via file:src/Makefile; it runs the lus2lic compiler with various options on every files contained in
- file:tests/should_work/ that contains correct Lustre V6 programs
- file:tests/should_fail/ that contains incorrect ones (e.g., that contains a type error).
Testing Correct Lustre V6 programs
The output of all lus2lic invocation are redirected to test.res
.
This file is then compared to test.res.exp
(exp
stands for
expected). When the results (.res
) and the expected results
(.res.exp
) differs, the test fails. Note that tests do not only
fail during a regression, but also during a progression!
In order to update the expected result, just issue a ‘make utest’.
Actually, 3 kinds of lus2lic invocation are performed:
- lic: just use lus2lic on all lustre files
- ec: ditto using the -ec option, plus calling ec2c on the generated files
- lv4: ditto using the -lv4 option, plus calling lus2ec on the generated files
Testing Incorrect Lustre V6 programs
We check that all progs in file:tests/should_fail/ returns with an exit code > 0.
src
Here follows a description of the different modules used by this lus2lic compiler (in src)
First of all, the Lustre files are parsed,
lexer.mll parser.mly parserUtils.ml lxm.mli/ml
which results into a parse tree containing raw source expressions.
syntaxTreeCore.ml, syntaxTree.ml -> should rather be called rawSyntaxTab.ml ? or just Src ?
Then, we perform reference checking at module level + model expansion.
syntaxTab.mli/ml syntaxTabUtil.ml/mli instanciateModel.mli/ml symbolTab.mli/ml (type/const/node)
syntaxTab is a kind of layer above syntaxTree to make things easier afterwards.
Finally, the compilation (type checking+const/type evaluation) is performed.
compile.ml lazyCompiler.mli/ml evalConst.mli/ml evalType.mli/ml compiledData.ml
Some misc (eponymous) modules are used along the way.
errors.ml verbose.mli/ml version.ml ident.ml
todo
cf file:todo.org