Fix cstest_py and add negative tests.#2807
Merged
Rot127 merged 5 commits intocapstone-engine:nextfrom Oct 29, 2025
Merged
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR fixes a bug in cstest_py that prevented failing tests from being properly reported and adds negative test cases to prevent regression. It also addresses memory leaks that occurred when tests failed.
Key changes:
- Fixed
cstest_pyto return test failures correctly by replacing non-returning_check()function calls with direct conditional checks - Added memory cleanup functions to fix leaks in the C
cstestimplementation - Created six negative test cases to verify that test failures are properly detected
Reviewed Changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| bindings/python/cstest_py/src/cstest_py/cstest.py | Fixed bug where comparison failures didn't return and added exit on inconsistent statistics |
| suite/cstest/src/test_case.c | Added cs_free() call in failure macro to prevent memory leaks |
| suite/cstest/src/cstest.c | Added cleanup_test_files() function and calls to free memory on exit paths |
| suite/cstest/CMakeLists.txt | Added six negative test cases marked with WILL_FAIL property |
| suite/run_tests.py | Added logic to run negative tests and verify they fail as expected |
| tests/negative/should_fail_*.yaml | Six new test case files designed to fail for different reasons |
| .github/workflows/CITest.yml | Updated CI to run negative tests and use more specific valgrind test paths |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
jiegec
approved these changes
Oct 29, 2025
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.
Your checklist for this pull request
Detailed description
Fixes a bug in
cstest_pywhich didn't report failing tests.The C
cstestwas luckily not affected.It also fixes several small leaks which occur when tests fail.
Test plan
Because of this the PR adds negative tests so it won't happen again.
Closing issues
...