-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Modernize Capstone testing #1984
Comments
Also considering #1281 when generating tests. |
The current MC test assume that a byte string can be disassembled independently from other byte strings. This is not true for instructions which depend on each other (IT/VPT blocks in ARM for example). |
@Rot127 Sounds make sense. Would you like to show us an code example? |
I'll add one once the |
Testing the build of bindings and their correct function isn't tested in the CI jobs as well (#2034 (comment)). |
See also #1954 |
To verify that the bindings lead to the same output as the raw C library, currently there are tests which reimplement the One could write a test runner in every supported binding language which can be triggered by the Currently there are multiple places where the instructions are printed which all have to be updated when the structs change:
Only having one place to stringify an instruction would streamline the update process. When using |
I very much like the idea to centralize the printing of instructions. Would you mind putting this into its own issue?
I am not sure if I understand you here correctly. But I think testing the instruction details by comparing strings between If we have the data to test in a |
Using YAML to test the data layout is also a custom in the LLVM project: |
The best approach would be a new small library in the same repository - |
Just an idea how to test every possible execution path and generate a set of instructions which cover every possible Depending on architecture the number of possible unique ways to set the For AArch64 for example this would be roughly To determine the execution path for each operand group:
|
Once it's done some files could be removed, e.g.:
|
Testing Capstones disassembly results is possible via too many ways.
MC
tests taken from LLVMs MC test files (insuite/MC
). They only test the disassembly of bytes to their assembly strings. To test those a:cstest
binary.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:
test_<arch>
binaries, because they hard code every test.cstest
.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 ofcs_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 possibledetail
setting for correctness. See #1984 (comment)CI
-DCAPSTONE_DIET
The text was updated successfully, but these errors were encountered: