mirror of
https://github.com/angr/angr
synced 2026-06-08 13:09:39 +00:00
563fb5f862
* [pre-commit.ci] pre-commit autoupdate updates: - [github.com/astral-sh/ruff-pre-commit: v0.14.11 → v0.14.13](https://github.com/astral-sh/ruff-pre-commit/compare/v0.14.11...v0.14.13) - [github.com/psf/black-pre-commit-mirror: 25.12.0 → 26.1.0](https://github.com/psf/black-pre-commit-mirror/compare/25.12.0...26.1.0) * [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>
55 lines
1.4 KiB
Python
Executable File
55 lines
1.4 KiB
Python
Executable File
#!/usr/bin/env python3
|
|
from __future__ import annotations
|
|
|
|
__package__ = __package__ or "tests.sim" # pylint:disable=redefined-builtin
|
|
|
|
import os
|
|
import unittest
|
|
|
|
import angr
|
|
|
|
from tests.common import bin_location
|
|
|
|
test_location = os.path.join(bin_location, "tests")
|
|
|
|
|
|
# TODO: arches += ( "armhf", )
|
|
|
|
|
|
# pylint: disable=missing-class-docstring
|
|
# pylint: disable=no-self-use
|
|
class TestCheckbyte(unittest.TestCase):
|
|
def _run_checkbyte(self, arch):
|
|
p = angr.Project(os.path.join(test_location, arch, "checkbyte"), auto_load_libs=False)
|
|
results = p.factory.simulation_manager().run(n=100) # , until=lambda lpg: len(lpg.active) > 1)
|
|
|
|
assert len(results.deadended) == 2
|
|
one = results.deadended[0].posix.dumps(1)
|
|
two = results.deadended[1].posix.dumps(1)
|
|
assert {one, two} == {b"First letter good\n", b"First letter bad\n"}
|
|
|
|
def test_checkbyte_armel(self):
|
|
self._run_checkbyte("armel")
|
|
|
|
def test_checkbyte_i386(self):
|
|
self._run_checkbyte("i386")
|
|
|
|
def test_checkbyte_mips(self):
|
|
self._run_checkbyte("mips")
|
|
|
|
def test_checkbyte_mipsel(self):
|
|
self._run_checkbyte("mipsel")
|
|
|
|
def test_checkbyte_ppc64(self):
|
|
self._run_checkbyte("ppc64")
|
|
|
|
def test_checkbyte_ppc(self):
|
|
self._run_checkbyte("ppc")
|
|
|
|
def test_checkbyte_x86_64(self):
|
|
self._run_checkbyte("x86_64")
|
|
|
|
|
|
if __name__ == "__main__":
|
|
unittest.main()
|