angr/tests
atipriya 6d45a3c53e Decompiler: fix four defects in the Insert lowering pass
Follow-up to 90359a2b0, addressing code-review findings against the
lowering pass itself.

- LowerInsert tagged only the top-level Or with the original tags, so
  the generated Convert/Shl/And/Const nodes carried no ins_addr and the
  codegen's expression-to-address map had no entry for them. Every
  generated node now carries **expr.tags.

- The width cutoff gated on arch.bits, which refused ordinary 64-bit
  Inserts on 32-bit targets even though they are plain long long
  arithmetic. Those reached the backend as _INSERT across the whole
  32-bit family. The cutoff is now the widest C integer type.

- _lower_residual_inserts discarded walk()'s return value. Handlers for
  nodes that cannot be rewritten in place (LoopNode above all) return a
  fresh node, so a replacement produced at the root was dropped and the
  lowering silently did not happen for it.

- _lower_block built a fresh _PeepholeExprsWalker per block, rebuilding
  the dispatch table each time. It now reuses a cached walker, matching
  AILBlockSimplifier.

Not addressed here: the stack-base and uninitialized-base bail-outs
still let Inserts reach the C backend as _INSERT. Both defer to a
rendering in _handle_Stmt_Assignment that is keyed on the assignment
destination, which an expression-level peephole rule cannot see, so the
fix belongs in the backend rather than in these bail-outs.

Co-Authored-By:

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-20 19:19:51 +00:00
..
ailment AIL: Port the AIL VEX lifter to Rust. (#6608) 2026-07-15 01:23:34 -07:00
analyses Decompiler: fix four defects in the Insert lowering pass 2026-07-20 19:19:51 +00:00
angrdb Enable ruff isort rule (#6452) 2026-06-02 14:48:07 -07:00
engines LightEngine: Fix an off-by-one error in matching handlers. (#6504) 2026-06-16 03:33:11 -07:00
exploration_techniques Enable ruff isort rule (#6452) 2026-06-02 14:48:07 -07:00
factory tests: sum floats sequentially in run_manyfloatsum_symbolic (#6509) 2026-06-16 17:25:37 -07:00
gui [pre-commit.ci] pre-commit autoupdate (#6025) 2026-01-19 13:37:06 -07:00
knowledge_plugins FunctionParser: Serialize Function._call_sites. (#6613) 2026-07-14 17:15:50 -07:00
llm Enable ruff isort rule (#6452) 2026-06-02 14:48:07 -07:00
manual Enable ruff isort rule (#6452) 2026-06-02 14:48:07 -07:00
mcp Enable ruff isort rule (#6452) 2026-06-02 14:48:07 -07:00
misc Enable ruff isort rule (#6452) 2026-06-02 14:48:07 -07:00
perf Enable ruff isort rule (#6452) 2026-06-02 14:48:07 -07:00
procedures Enable ruff isort rule (#6452) 2026-06-02 14:48:07 -07:00
regression Enable ruff isort rule (#6452) 2026-06-02 14:48:07 -07:00
serialization angrDb: Direct load and store of serialized bytes for CFG and functions. (#6610) 2026-07-15 01:40:46 -07:00
sim Remove widen() from state api (#6632) 2026-07-17 13:23:53 -07:00
simos Enable ruff isort rule (#6452) 2026-06-02 14:48:07 -07:00
state_plugins Enable ruff isort rule (#6452) 2026-06-02 14:48:07 -07:00
storage Enable ruff isort rule (#6452) 2026-06-02 14:48:07 -07:00
types Enable ruff isort rule (#6452) 2026-06-02 14:48:07 -07:00
utils should_use_hex: Remove value saturation rule. (#6593) 2026-07-08 17:34:26 -07:00
__init__.py tests: Structure test files into directories 2023-09-08 16:05:33 -07:00
common.py Speed up test cases by building scoped CFGs. (#6601) 2026-07-10 01:17:46 -07:00
README.md Update test/README.md with current tools (#3774) 2023-02-01 18:48:16 -07:00
test_calling_conventions.py SimCCMicrosoftFastcall: Implement next_arg. (#6491) 2026-06-10 03:19:34 -07:00
test_cli.py Add Rust decompiler support to CLI (#6421) 2026-05-19 23:00:07 -07:00
test_fuzzer.py Fuzzer infrastructure: engine caching, custom breakpoints, icicle bump (#6346) 2026-04-15 15:22:31 -07:00
test_load_shellcode.py Enable ruff isort rule (#6452) 2026-06-02 14:48:07 -07:00

Tests

Running tests

These tests require the binaries repository, clone it in the folder where angr was cloned.

git clone https://github.com/angr/binaries

nose2 or pytest may be used to run tests. Each tool can be installed with pip:

pip install nose2
pip install pytest

To run the tests with nose2, from the root of the repository, run:

nose2 -s tests

Or if using pytest, simply run:

pytest

Writing new tests

New tests should be written using unittest, part of Python's standard library. For more information about unittest, see https://docs.python.org/3/library/unittest.html. While we prefer nose2 and pytest for running tests, avoid using nose2 or pytest features in tests themselves, to avoid dependency on a specific runner.