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_TIMEOUT
as required intest/mips_testbench.py
and runmake testbench-build
on a machine withpyinstaller
to 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>.s
for MIPS assembly instructions<test-name>.c
for C code (note that using standard libraries such asstdio
may not work)- Implementing input and output should be done by reading and writing to
0x30000000
and0x30000004
respectively - 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.out
intest/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
stdin
while 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