- Improved the GitHub python binding workflow: (#2072)

- Added fullMode input in workflow_dispatch
    - Take decision whether to build either in debug or release mode and if to build for all python versions according to the commit message patterns
    - Set proper artifact names
    - Removed not needed steps
    - Compacted some steps in order to leverage more the matrix feature
    - Bumped cibuildwheel action to 2.22.0
    - Run actual regress tests in place of sample scripts
- Specify optional test install in pyproject.toml with proper requirements
- Derive package version from git tags
- Add GENERATORS env var support in setup.py to specify cmake generator and minor refactoring
- Minor cleanup/refactoring for the regress test suite
- Marked some regress tests with skipIf to skip them in case of old python versions
- Marked some failing regress tests to be checked with skipIf
This commit is contained in:
@Antelox
2024-12-29 15:24:48 +01:00
committed by GitHub
parent 07e8162cca
commit 9cfd5cfac3
85 changed files with 543 additions and 838 deletions

View File

@@ -1,4 +1,3 @@
#!/usr/bin/python
#
# This test demonstrates emulation behavior within and across
# basic blocks.
@@ -6,11 +5,9 @@
import binascii
import struct
import regress
from unicorn import *
from unicorn.x86_const import *
CODE = (
b"\xb8\x00\x00\x00\x00" # 1000: mov eax,0x0
b"\x40" # 1005: inc eax
@@ -22,7 +19,7 @@ CODE = (
b"\xcc" # 100f: int3
b"\xb8\x00\x00\x00\x00" # 1010: mov eax,0x0
b"\x40" # 1015: inc eax
b"\x40" # 1016: inc eax
b"\x40" # 1016: inc eax
)
@@ -116,13 +113,11 @@ class RunAcrossBBTest(regress.RegressTest):
showpc(mu)
#######################################################################
# emu_run ONE:
# exectue four instructions, until the last instruction in a BB
#######################################################################
mu.emu_start(0x1000, 0x100c)
# should exec the following four instructions:
# 1000: b8 00 00 00 00 mov eax,0x0 <
@@ -134,22 +129,20 @@ class RunAcrossBBTest(regress.RegressTest):
self.assertEqual(0x100c, mu.reg_read(UC_X86_REG_EIP), "unexpected PC (2)")
# single push, so stack diff is 0x4
TOP_OF_STACK = 0x2800-0x4
TOP_OF_STACK = 0x2800 - 0x4
self.assertEqual(TOP_OF_STACK, mu.reg_read(UC_X86_REG_ESP), "unexpected SP (2)")
# top of stack should be 0x1010
self.assertEqual(0x1010,
self.assertEqual(0x1010,
struct.unpack("<I", mu.mem_read(TOP_OF_STACK, 0x4))[0],
"unexpected stack value")
showpc(mu)
#######################################################################
# emu_run TWO
# execute one instruction that jumps to a new BB
#######################################################################
mu.emu_start(0x100c, 0x1010)
# should exec one instruction that jumps to 0x1010:
# 100c: c3 ret -----------+
@@ -165,21 +158,18 @@ class RunAcrossBBTest(regress.RegressTest):
self.assertEqual(0x2800, mu.reg_read(UC_X86_REG_ESP), "unexpected SP (3)")
showpc(mu)
#######################################################################
# emu_run THREE
# execute three instructions to verify things work as expected
#######################################################################
mu.emu_start(0x1010, 0x1016)
# should exec the following three instructions:
# 1010: b8 00 00 00 00 mov eax,0x0 <
# 1015: 40 inc eax <
# 1016: 40 inc eax <
self.assertEqual(0x1016, mu.reg_read(UC_X86_REG_EIP),
"unexpected PC (4): 0x%x vs 0x%x" % (
0x1016, mu.reg_read(UC_X86_REG_EIP)))
"unexpected PC (4): 0x%x vs 0x%x" % (0x1016, mu.reg_read(UC_X86_REG_EIP)))
showpc(mu)
except UcError as e: