angr/tests/factory/block/test_block_cache.py
Kevin Phoenix f939c5b88c
Enable ruff isort rule (#6452)
* Enable ruff isort rule

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2026-06-02 14:48:07 -07:00

33 lines
954 B
Python
Executable file

#!/usr/bin/env python3
from __future__ import annotations
__package__ = __package__ or "tests.factory.block" # pylint:disable=redefined-builtin
import logging
import os
import unittest
import angr
from tests.common import bin_location
test_location = os.path.join(bin_location, "tests")
l = logging.getLogger("angr.tests")
# pylint: disable=missing-class-docstring
# pylint: disable=no-self-use
class TestBlockCache(unittest.TestCase):
def test_block_cache(self):
p = angr.Project(
os.path.join(test_location, "x86_64", "fauxware"), translation_cache=True, auto_load_libs=False
)
b = p.factory.block(p.entry)
assert p.factory.block(p.entry).vex is b.vex
p = angr.Project(os.path.join(test_location, "x86_64", "fauxware"), translation_cache=False)
b = p.factory.block(p.entry)
assert p.factory.block(p.entry).vex is not b.vex
if __name__ == "__main__":
unittest.main()