Testing Capstones disassembly results is possible via too many ways.
- Test binaries print (but not test!) the values of instruction detail (e.g. which operands are written and read etc.).
MC tests taken from LLVMs MC test files (in suite/MC). They only test the disassembly of bytes to their assembly strings. To test those a:
- Python script exists
- And the
cstest binary.
- Issue tests (files which name is
issue.cs). They look very similar to the MC tests, but are not related. They can test detail information as well. cstest processes them.
This is very confusing and could be unified.
I propose to:
- Get rid of the
test_<arch> binaries, because they hard code every test.
- Get rid of the Python scripts. Because they are a duplicate of
cstest.
- Rewrite
cstest
cstest
cstest should be written from scratch. It needs modernization anyway (e.g. remove global variables) and we could settle on a single test file format.
This new format should support simple bytes <-> assembly string testing, as well as testing the content of cs_detail.
Once this is done we can also write scripts to translate LLVMs MC regression tests to our file format.
Before the v6 release we should also test every possible detail setting for correctness. See #1984 (comment)
CI
Testing Capstones disassembly results is possible via too many ways.
MCtests taken from LLVMs MC test files (insuite/MC). They only test the disassembly of bytes to their assembly strings. To test those a:cstestbinary.issue.cs). They look very similar to the MC tests, but are not related. They can test detail information as well.cstestprocesses them.This is very confusing and could be unified.
I propose to:
test_<arch>binaries, because they hard code every test.cstest.cstestcstest
cstestshould be written from scratch. It needs modernization anyway (e.g. remove global variables) and we could settle on a single test file format.This new format should support simple
bytes <-> assembly stringtesting, as well as testing the content ofcs_detail.Once this is done we can also write scripts to translate LLVMs MC regression tests to our file format.
Before the
v6release we should also test every possibledetailsetting for correctness. See #1984 (comment)CI
-DCAPSTONE_DIET