The testbench is written in Python 2.7.
As Python is not installed by default on the test machines, we are using pyinstaller to bundle our testbench with Python, into a single binary, which can be executed on its own.
-
If any test takes longer than 5 seconds to run, then the testbench will automatically timeout.
-
To increase the timeout, change
TEST_TIMEOUTas required intest/mips_testbench.pyand runmake testbench-buildon a machine withpyinstallerto rebundle the testbench. -
Alternatively, if Python is installed on the machine, simply run
python test/mips_testbench.py <path-to-mips-simulator>to use the testbench
To add a new test:
-
Create a file in
test/src/with the code to be compiled/assembled:<test-name>.sfor MIPS assembly instructions<test-name>.cfor C code (note that using standard libraries such asstdiomay not work)- Implementing input and output should be done by reading and writing to
0x30000000and0x30000004respectively - An example of how to do this is shown in
test/src/function.04.c
- Implementing input and output should be done by reading and writing to
-
Create a file
<test-name>.mips.outintest/output/with:- 1st line with the exit code (e.g.
0) - Output (checked against
stdout) on the rest of the lines
- 1st line with the exit code (e.g.
-
Any data to be input into
stdinwhile running the test should be put into a filetest/input/<test-name>.in- If no input is needed, then there's no need to create the file