- 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:
@@ -1,10 +1,10 @@
|
||||
[build-system]
|
||||
requires = ["setuptools", "build", "wheel"]
|
||||
requires = ["setuptools", "build", "wheel", "versioningit"]
|
||||
build-backend = "setuptools.build_meta"
|
||||
|
||||
[project]
|
||||
name = "unicorn"
|
||||
version = "2.1.1"
|
||||
dynamic = ["version"]
|
||||
requires-python = ">= 2.7, != 3.0.*, != 3.1.*, != 3.2.*, != 3.3.*, != 3.4.*, != 3.5.*, != 3.6.*"
|
||||
authors = [
|
||||
{ name = "Nguyen Anh Quynh", email = "quynh@gmail.com" },
|
||||
@@ -33,9 +33,11 @@ Changelog = "https://github.com/unicorn-engine/unicorn/blob/master/ChangeLog"
|
||||
|
||||
[project.optional-dependencies]
|
||||
test = [
|
||||
"pytest",
|
||||
"pytest-cov",
|
||||
"capstone==6.0.0a2;python_version>'3.7'",
|
||||
"capstone==5.0.1;python_version<='3.7'"
|
||||
]
|
||||
|
||||
[tool.setuptools.packages.find]
|
||||
include = ["unicorn*"]
|
||||
|
||||
[tool.versioningit]
|
||||
|
||||
@@ -102,12 +102,17 @@ def build_libraries():
|
||||
|
||||
has_msbuild = shutil.which('msbuild') is not None
|
||||
conf = 'Debug' if int(os.getenv('DEBUG', 0)) else 'Release'
|
||||
cmake_args = ['cmake', '-B', BUILD_DIR, "-DCMAKE_BUILD_TYPE=" + conf]
|
||||
if os.getenv("UNICORN_TRACER"):
|
||||
cmake_args += ["-DUNICORN_TRACER=on"]
|
||||
if conf == 'Debug':
|
||||
cmake_args += ["-DUNICORN_LOGGING=on"]
|
||||
|
||||
if has_msbuild and sys.platform == 'win32':
|
||||
generators = os.getenv('GENERATORS') or 'Visual Studio 16 2019'
|
||||
plat = 'Win32' if platform.architecture()[0] == '32bit' else 'x64'
|
||||
|
||||
subprocess.check_call(['cmake', '-B', BUILD_DIR, '-G', "Visual Studio 16 2019", "-A", plat,
|
||||
"-DCMAKE_BUILD_TYPE=" + conf], cwd=UC_DIR)
|
||||
cmake_args += ['-G', generators, "-A", plat]
|
||||
subprocess.check_call(cmake_args, cwd=UC_DIR)
|
||||
subprocess.check_call(['msbuild', 'unicorn.sln', '-m', '-p:Platform=' + plat, '-p:Configuration=' + conf],
|
||||
cwd=BUILD_DIR)
|
||||
|
||||
@@ -115,11 +120,7 @@ def build_libraries():
|
||||
shutil.copy(os.path.join(obj_dir, LIBRARY_FILE), LIBS_DIR)
|
||||
shutil.copy(os.path.join(obj_dir, STATIC_LIBRARY_FILE), LIBS_DIR)
|
||||
else:
|
||||
cmake_args = ["cmake", '-B', BUILD_DIR, '-S', UC_DIR, "-DCMAKE_BUILD_TYPE=" + conf]
|
||||
if os.getenv("TRACE"):
|
||||
cmake_args += ["-DUNICORN_TRACER=on"]
|
||||
if conf == "Debug":
|
||||
cmake_args += ["-DUNICORN_LOGGING=on"]
|
||||
cmake_args += ['-S', UC_DIR]
|
||||
subprocess.check_call(cmake_args, cwd=UC_DIR)
|
||||
threads = os.getenv("THREADS", "4")
|
||||
subprocess.check_call(["cmake", "--build", ".", "-j" + threads], cwd=BUILD_DIR)
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
# Sample code for ARM of Unicorn. Nguyen Anh Quynh <aquynh@gmail.com>
|
||||
# Python sample ported by Loi Anh Tuan <loianhtuan@gmail.com>
|
||||
|
||||
from __future__ import print_function
|
||||
from unicorn import *
|
||||
from unicorn.arm_const import *
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
# Sample code for ARM64 of Unicorn. Nguyen Anh Quynh <aquynh@gmail.com>
|
||||
# Python sample ported by Loi Anh Tuan <loianhtuan@gmail.com>
|
||||
|
||||
from __future__ import print_function
|
||||
from unicorn import *
|
||||
from unicorn.arm64_const import *
|
||||
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
# Python sample ported by Loi Anh Tuan <loianhtuan@gmail.com>
|
||||
# AARCH64 Python sample ported by zhangwm <rustydaar@gmail.com>
|
||||
|
||||
from __future__ import print_function
|
||||
from unicorn import *
|
||||
from unicorn.arm64_const import *
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
#!/usr/bin/env python
|
||||
# Sample code for ARM big endian of Unicorn. zhangwm <rustydaar@gmail.com>
|
||||
|
||||
from __future__ import print_function
|
||||
from unicorn import *
|
||||
from unicorn.arm_const import *
|
||||
|
||||
|
||||
@@ -2,8 +2,6 @@
|
||||
# Sample code for Unicorn.
|
||||
# By Lazymio(@wtdcode), 2021
|
||||
|
||||
import pytest
|
||||
import sys
|
||||
from unicorn import *
|
||||
from unicorn.x86_const import *
|
||||
from datetime import datetime
|
||||
@@ -36,7 +34,6 @@ def time_emulation(uc, start, end):
|
||||
|
||||
|
||||
# TODO: Check if worth adapting the ctl_request_cache method for py2 bindings
|
||||
@pytest.mark.skipif(sys.version_info < (3, 7), reason="requires python3.7 or higher")
|
||||
def test_uc_ctl_tb_cache():
|
||||
# Initialize emulator in X86-32bit mode
|
||||
uc = Uc(UC_ARCH_X86, UC_MODE_32)
|
||||
@@ -84,7 +81,6 @@ def trace_tcg_sub(uc, address, arg1, arg2, size, data):
|
||||
|
||||
|
||||
# TODO: Check if worth adapting the hook_add method for py2 bindings
|
||||
@pytest.mark.skipif(sys.version_info < (3, 7), reason="requires python3.7 or higher")
|
||||
def test_uc_ctl_exits():
|
||||
uc = Uc(UC_ARCH_X86, UC_MODE_32)
|
||||
addr = 0x1000
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
# Sample code for ARM of Unicorn. Nguyen Anh Quynh <aquynh@gmail.com>
|
||||
# Python sample ported by Loi Anh Tuan <loianhtuan@gmail.com>
|
||||
|
||||
from __future__ import print_function
|
||||
from unicorn import *
|
||||
from unicorn.m68k_const import *
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
# Sample code for MIPS of Unicorn. Nguyen Anh Quynh <aquynh@gmail.com>
|
||||
# Python sample ported by Loi Anh Tuan <loianhtuan@gmail.com>
|
||||
|
||||
from __future__ import print_function
|
||||
from unicorn import *
|
||||
from unicorn.mips_const import *
|
||||
|
||||
|
||||
@@ -2,8 +2,6 @@
|
||||
# Unicorn sample for auditing network connection and file handling in shellcode.
|
||||
# Nguyen Tan Cong <shenlongbk@gmail.com>
|
||||
|
||||
from __future__ import print_function
|
||||
import pytest
|
||||
import struct
|
||||
import uuid
|
||||
from unicorn import *
|
||||
@@ -361,7 +359,6 @@ def hook_intr(uc, intno, user_data):
|
||||
print_sockcall(msg)
|
||||
|
||||
|
||||
@pytest.mark.parametrize("code", [X86_SEND_ETCPASSWD, X86_BIND_TCP, X86_REVERSE_TCP, X86_REVERSE_TCP_2])
|
||||
# Test X86 32 bit
|
||||
def test_i386(code):
|
||||
global fd_chains
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
#!/usr/bin/env python
|
||||
# Sample code for PPC of Unicorn. Nguyen Anh Quynh <aquynh@gmail.com>
|
||||
|
||||
from __future__ import print_function
|
||||
from unicorn import *
|
||||
from unicorn.ppc_const import *
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
#!/usr/bin/env python
|
||||
# Sample code for RISCV of Unicorn. Nguyen Anh Quynh <aquynh@gmail.com>
|
||||
|
||||
from __future__ import print_function
|
||||
from unicorn import *
|
||||
from unicorn.riscv_const import *
|
||||
|
||||
|
||||
@@ -3,8 +3,6 @@
|
||||
# Nguyen Anh Quynh <aquynh@gmail.com>
|
||||
# KaiJern Lau <kj@theshepherdlab.io>
|
||||
|
||||
from __future__ import print_function
|
||||
import pytest
|
||||
from unicorn import *
|
||||
from unicorn.x86_const import *
|
||||
|
||||
@@ -134,8 +132,6 @@ def hook_syscall64(mu, user_data):
|
||||
mu.emu_stop()
|
||||
|
||||
|
||||
@pytest.mark.parametrize("mode,code",
|
||||
[(UC_MODE_32, X86_CODE32_SELF), (UC_MODE_32, X86_CODE32), (UC_MODE_64, X86_CODE64)])
|
||||
# Test X86 32 bit
|
||||
def test_i386(mode, code):
|
||||
if mode == UC_MODE_32:
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
# Sample code for SPARC of Unicorn. Nguyen Anh Quynh <aquynh@gmail.com>
|
||||
# Python sample ported by Loi Anh Tuan <loianhtuan@gmail.com>
|
||||
|
||||
from __future__ import print_function
|
||||
from unicorn import *
|
||||
from unicorn.sparc_const import *
|
||||
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
Copyright 2022 Aptiv
|
||||
"""
|
||||
|
||||
from __future__ import print_function
|
||||
from unicorn import *
|
||||
from unicorn.tricore_const import *
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
#!/usr/bin/env python
|
||||
# Sample code for X86 of Unicorn. Nguyen Anh Quynh <aquynh@gmail.com>
|
||||
|
||||
from __future__ import print_function
|
||||
import pickle
|
||||
from unicorn import *
|
||||
from unicorn.x86_const import *
|
||||
|
||||
Reference in New Issue
Block a user