Kingcom / armips

An assembler for various ARM and MIPS platforms. Builds available at http://buildbot.orphis.net/armips/
MIT License
363 stars 77 forks source link

Test cases with arbitrary command line arguments (e.g. -definelabel) #160

Closed Prof9 closed 4 years ago

Prof9 commented 5 years ago

This PR adds a feature to the testing framework to run a test with specific command line arguments, and also to check the exit code.

This is done by adding a file named commandLine.txt to the folder of the specific test, which contains a single line. The line starts with an integer (the expected exit code), followed by the arguments to be run; all separated by spaces.

For instance, take the following commandLine.txt:

0 -definelabel testlabel 0x123456 test.asm

This will run ARMIPS as if you ran it from the command line as follows:

armips.exe -definelabel testlabel 0x123456 test.asm

Then, it will compare output as normal (expected.txt, expected.bin), and in addition, it will also check that the exit code is 0 as specified at the start of the commandLine.txt.

If a commandLine.txt file is not provided for a specific test case, that test case is ran just as it was before.

This PR also adds a test which uses this feature, namely one for the -definelabel argument. This test fails as-is, but with the fix from #159, it passes.