Skip to content
jvf edited this page Jun 15, 2013 · 24 revisions

Testing

Module Tests

The fuc group decided a goal of 90% test coverage for the project. The test can be found in the fuc/code/{module}/test of the respective {module}. The module tests are included in the default ant runt-tests target.

Integration Tests

Integration tests test the whole compiler chain: Lexer -> Parser -> Semantic Analyser -> IR Generator -> LLVM Backend.

The integration tests can be found in fuc/code/test. Due to the limitations of JUnit, in order to be able to use the example programes in different test classes, they are centralized in ExampleProgs.java. The example programs comprise of the examples from common/examples (loaded from there) plus some addition test programs. TestBase.java provides the base class for all integration tests.

There are two kinds of integration tests:

  1. Compilation Tests

  2. Runtime Tests

Compilation Tests

The compilation tests test if the example program compiles through all stages of the compiler, producing some kind of LLVM IR Code in the end. These tests only test if the compiler runs through without producing errors, not for the correctness of the resulting LLVM IR Code.

If the example programs are erroneous, they are testet for producing the expected error messages.

The compilation tests are included in the default run-tests ant target (and thereby also included in the travis CI testing).

Runtime Tests

The runtime tests compile the example programs and execute the resulting LLVM IR Code with lli. The results of the execution are then checked against the expected output (print statements) and exit code (return statement). The runtime tests hereby provide limited correctness testing (no proof of correctness of course!).

The runtime tests need a working LLVM installation (>= version 3.2). They are not included by default, but have their own ant target: ant run-tests-runtime.

Continuous Integration Tests

Every commit pushed to the remote master branch is tested with Travis CI. If something is pushed it will trigger an ant run-tests and send an Email to the commit author (email taken from git) if something fails.

The current build status of the master branch is displayed on the main fuc github page as a small png at the top of the README.md. The testing can be seen in action an the Travis CI status page for fuc.

Cross Testing

The cross tests test for the interchangeability of the fuc and the javabite modules.

For the tests to work, the javabite moduls have to be placed into the fuc/code/dist directory as jar-files. The javabite jars can be obtained be running ant buildCompiler in the javabite repository.

The only cross tests yet implemented (as required for milestone 2) switch the lexer, thus using the javabite lexer and the rest of the fuc front- and backend to perform the tests.

The crosstests are implemented as runtime tests, so they need a working LLVM installation (>= version 3.2). They have their own ant target run-tests-cross and are not included by default.

Clone this wiki locally