Skip to content

Conversation

@Rot127
Copy link
Collaborator

@Rot127 Rot127 commented Oct 21, 2025

Your checklist for this pull request

  • I've documented or updated the documentation of every API function and struct this PR changes.
  • I've added tests that prove my fix is effective or that my feature works (if possible)

Detailed description

Fixes a bug in cstest_py which didn't report failing tests.
The C cstest was 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

...

@github-actions github-actions bot added Python Bindings Github-files Github related files labels Oct 21, 2025
@Rot127 Rot127 marked this pull request as ready for review October 21, 2025 15:15
@Rot127 Rot127 changed the title Fix ci tests Fix CI Oct 21, 2025
@Rot127 Rot127 changed the title Fix CI Fix cstest_py and add negative tests. Oct 21, 2025
@Rot127 Rot127 mentioned this pull request Oct 25, 2025
2 tasks
@Rot127 Rot127 requested a review from Copilot October 28, 2025 10:51
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_py to 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 cstest implementation
  • 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.

@Rot127 Rot127 merged commit 155a483 into capstone-engine:next Oct 29, 2025
23 checks passed
@Rot127 Rot127 deleted the fix-ci-tests branch October 29, 2025 10:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Github-files Github related files Python Bindings

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants