Skip to content

Modernize Capstone testing  #1984

Closed
@Rot127

Description

@Rot127

Testing Capstones disassembly results is possible via too many ways.

  1. Test binaries print (but not test!) the values of instruction detail (e.g. which operands are written and read etc.).
  2. 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.
  1. 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:

  1. Get rid of the test_<arch> binaries, because they hard code every test.
  2. Get rid of the Python scripts. Because they are a duplicate of cstest.
  3. 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    TestingTest related issue

    Type

    No type

    Projects

    Status

    Done

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions