Add pytest test suite and GitHub Actions CI#17
Merged
Conversation
54 tests covering the architecture abstraction, address helpers, gadget model, gadget finder (canary dedup + sorting), ROPLang parser, operation matching and the ELF loader (including --base relocation). Binary loader tests build minimal ELFs in memory, so no binary blobs are committed. CI runs the suite on Python 3.11, 3.12 and 3.13 for every push to master and every pull request. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
Summary
Adds an automated test suite and continuous integration, so regressions in the recent refactor and bug fixes are caught automatically.
Tests (
tests/, 54 cases)test_arch.py— architecture singleton, mode-awarenormalize_reg(x86 vs x64),REG_BY_WIDTH, abstract-register validation.test_utils.py—pretty_addr/pack_addrwidths and the unsupported-mode guard (pretty_addr/pack_addr raise NameError on an unknown capstone mode #15).test_gadget.py— text representation, equality/hash, side-effect calculation (32- vs 64-bit names), subsumption, heuristic cost, and ANSI gating on non-TTY output (ANSI color codes are emitted even when output is not a TTY #14).test_gadfinder.py— canary byte avoidance on dedup (Avoid terminator canary bytes in ROP gadget's addresses (by default) when duplicated gadgets are removed #5),--keep-canary-addressbehaviour, address scoring, and deterministic sorting.test_parser.py— ROPLang op loading, composite ops, per-archREG_BPalias resolution.test_operation.py— operation matching/filtering and immediate parsing.test_elf.py— ELF arch detection, executable-section extraction, and--baserelocation (--base is silently ignored for ELF and Mach-O binaries #13).Binary-loader tests build minimal ELFs in memory (see
conftest.py), so no binary blobs are committed. An autouse fixture resets the global architecture singleton between tests.CI (
.github/workflows/ci.yml)Runs
pyteston Python 3.11, 3.12 and 3.13 for every push tomasterand every pull request.Notes
--basefix.🤖 Generated with Claude Code