Test Python bindings in CI#2161
Merged
kabeor merged 6 commits intocapstone-engine:nextfrom Sep 15, 2023
Merged
Conversation
There used to be tests comparing the output of the C test_* programs with the equivalent test in the binding language. Update the tests to match the Python bindings.
Don't build libcapstone using make again when running setup.py. Use the library we built earlier.
Rot127
approved these changes
Sep 12, 2023
| print("\tgroups_count: %u" % len(insn.groups)) | ||
|
|
||
| print_read_write_regs(insn) | ||
| print("\tgroups_count: %u" % len(insn.groups)) |
Collaborator
There was a problem hiding this comment.
Better use formatted strings for those cases (f"\tgroups_count: {len(insn.groups)}" and the like). Also below and above. Its easier for future editing IMHO.
Maybe doesn't matter that much. Since this should be replaced anyway by some proper testing code.
Contributor
Author
There was a problem hiding this comment.
(f-strings aren't supported in python 2 too)
Member
|
Awesome, thanks! |
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
There is a test setup for the python bindings in the
bindings/Makefile, which compare the output of the/tests/test_<arch>programs with the equivalentbindings/python/test_<arch>.pyscripts. They weren't run in CI and the tests were heavily out of sync.Comparing text output is annoying and the test-case coverage of the instructions in those old test binaries doesn't test all of the possible encodings, but this hopefully gets the job done of keeping the python bindings from getting out of sync.
This is the second attempt at #2086, this time with smaller changes outside the tests. The PPC bindings and ARM constants needed a little tweak in the last second which might be better off in a seperate PR again.. There always seems to be something while the codebase keeps moving -.-