Commit d67903a5 authored by Johannes Bechberger's avatar Johannes Bechberger

Improve README

parent b8fdbb2b
...@@ -22,11 +22,11 @@ The test cases are divided in 5 'modes': ...@@ -22,11 +22,11 @@ The test cases are divided in 5 'modes':
them. them.
- __ast__: Test cases that check the generated ast by using the pretty printing functionality. - __ast__: Test cases that check the generated ast by using the pretty printing functionality.
- __semantic__: Test cases that check semantic checking of MiniJava programs - __semantic__: Test cases that check semantic checking of MiniJava programs
- __exec__: Test cases that check the correct compilation and execution of MiniJava programs. - __compile-firm__: Test cases that check the correct compilation and execution of MiniJava programs with the libfirm backend.
_Only the lexer, syntax, ast and semantic mode are currently usable, but the others will follow._ The test different test cases for each mode are located in a folder with the same name.
Except the compile-firm test cases which are located in the `exec` folder.
The test different test cases for each mode are located in a folder with the same name.
The default directory that contains all test folders is `tests`. The default directory that contains all test folders is `tests`.
Sub folders in side the test case folders are allowed. Sub folders in side the test case folders are allowed.
...@@ -43,7 +43,7 @@ Test types for the lexer mode ...@@ -43,7 +43,7 @@ Test types for the lexer mode
<tr><th>File ending(s) of test cases</th><th>Expected behaviour to complete a test of this type</th></tr> <tr><th>File ending(s) of test cases</th><th>Expected behaviour to complete a test of this type</th></tr>
<tr> <tr>
<td><code>.valid.mj</code> <code>.mj</code></td> <td><code>.valid.mj</code> <code>.mj</code></td>
<td>Return code is <code>0</code> and the output matches the expected output (located in the file `[test file].out`</td> <td>Return code is <code>0</code> and the output matches the expected output (located in the file `[test file].out`)</td>
</tr> </tr>
<tr> <tr>
<td><code>.invalid.mj</code> <td><code>.invalid.mj</code>
...@@ -89,7 +89,7 @@ Test types for the semantic mode ...@@ -89,7 +89,7 @@ Test types for the semantic mode
<table> <table>
<tr><th>File ending(s) of test cases</th><th>Expected behaviour to complete a test of this type</th></tr> <tr><th>File ending(s) of test cases</th><th>Expected behaviour to complete a test of this type</th></tr>
<tr> <tr>
<td><code>.valid.mj</code> <code>.mj</code> <code>.valid.java</code> <code>.java</code> <td><code>.valid.mj</code> <code>.mj</code> <code>.valid.java</code> <code>.java</code></td>
<td>Return code is <code>0</code>, i.e. the MiniJava is accepted as semantically correct</td> <td>Return code is <code>0</code>, i.e. the MiniJava is accepted as semantically correct</td>
</tr> </tr>
<tr> <tr>
...@@ -101,6 +101,29 @@ Test types for the semantic mode ...@@ -101,6 +101,29 @@ Test types for the semantic mode
__All semantic mode tests have to be syntactically correct___ __All semantic mode tests have to be syntactically correct___
Test types for the compile-firm mode
------------------------------------
<table>
<tr><th>File ending(s) of test cases</th><th>Expected behaviour to complete a test of this type</th></tr>
<tr>
<td><code>.java</code> <code>.mj</code></td>
<td>The test file should compile. The resulting binary should be runnable and its output should be:<br/>
if a <code>[test file].out</code> exists: the content of this file<br/>
if no such file exists: the same as the execution of the file with <code>java</code></td>
</tr>
<tr>
<td><code>.inf.java</code> <code>.inf.mj</code></td>
<td>Tests for infinite loops. The test file should compile. The binary should run at least 1 second.
The output should start with the content of the <code>[test file].out</code> file, if such file exists.</td>
</tr>
</table>
__All compile-firm mode tests have to be semantically correct___
__All bigger test cases (e.g. for benchmarking) should be placed into the `big` folder__
Test runner Test runner
----------- -----------
...@@ -125,11 +148,11 @@ To get colored output install the python3 module `termcolor`. ...@@ -125,11 +148,11 @@ To get colored output install the python3 module `termcolor`.
Output of the `./mjt.py --help` Output of the `./mjt.py --help`
``` ```
usage: mjt.py [-h] [--only_incorrect_tests] [--produce_no_reports] usage: mjt.py [-h] [--only_incorrect_tests] [--all_exec_tests]
[--produce_all_reports] [--parallel] [--produce_no_reports] [--produce_all_reports] [--parallel]
[--output_no_incorrect_reports] [--color] [--ci_testing] [--output_no_incorrect_reports] [--color] [--ci_testing]
[--log_level LOG_LEVEL] [--log_level LOG_LEVEL]
{all,lexer,syntax,ast,semantic,compile-firm.exec} MJ_RUN {all,lexer,syntax,ast,semantic,compile-firm,exec} MJ_RUN
MiniJava test runner MiniJava test runner
...@@ -144,6 +167,8 @@ optional arguments: ...@@ -144,6 +167,8 @@ optional arguments:
-h, --help show this help message and exit -h, --help show this help message and exit
--only_incorrect_tests --only_incorrect_tests
Only run the tests that were incorrect the last run Only run the tests that were incorrect the last run
--all_exec_tests Run all exec (compile-firm...) tests, not only the
small ones
--produce_no_reports Produce no long reports besides the command line --produce_no_reports Produce no long reports besides the command line
output output
--produce_all_reports --produce_all_reports
...@@ -195,6 +220,8 @@ MiniJava style recommendations ...@@ -195,6 +220,8 @@ MiniJava style recommendations
### General ### General
- All code should be valid Java code - All code should be valid Java code
- If code isn't valid Java code it should be located in a `.mj` file
- All other code files should end with `.java`
- All functionality that could be useful for other test cases should be extracted into an importable files - All functionality that could be useful for other test cases should be extracted into an importable files
- Such importable files should be placed in a folder (or sub folder) of `lib` - Such importable files should be placed in a folder (or sub folder) of `lib`
- Classes and methods should be documented with Javadocs if there name isn't self explanatory - Classes and methods should be documented with Javadocs if there name isn't self explanatory
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment