diff options
| author | Camille Mougey <commial@gmail.com> | 2019-03-07 14:37:07 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-03-07 14:37:07 +0100 |
| commit | 4c2320b46250a8d6f8774e1218544b72a154cd8e (patch) | |
| tree | b67e7b072439f84109bd39dad8ed7f3f135224f8 /test/arch/mips32 | |
| parent | eab809932871f91d6f4aa770fc321af9e156e0f5 (diff) | |
| parent | 26c1075723a02984da6d3bc7423c5c0c43082dc3 (diff) | |
| download | miasm-4c2320b46250a8d6f8774e1218544b72a154cd8e.tar.gz miasm-4c2320b46250a8d6f8774e1218544b72a154cd8e.zip | |
Merge pull request #990 from serpilliere/support_python2_python3
Support python2 python3
Diffstat (limited to '')
| -rw-r--r-- | test/arch/mips32/arch.py | 20 | ||||
| -rw-r--r-- | test/arch/mips32/unit/asm_test.py | 20 |
2 files changed, 22 insertions, 18 deletions
diff --git a/test/arch/mips32/arch.py b/test/arch/mips32/arch.py index 1cbb554d..e5e8cff6 100644 --- a/test/arch/mips32/arch.py +++ b/test/arch/mips32/arch.py @@ -1,8 +1,10 @@ +from __future__ import print_function import time from pdb import pm -from miasm2.core.locationdb import LocationDB -from miasm2.arch.mips32.arch import * +from miasm.core.utils import decode_hex, encode_hex +from miasm.core.locationdb import LocationDB +from miasm.arch.mips32.arch import * loc_db = LocationDB() @@ -217,20 +219,20 @@ reg_tests_mips32 = [ ts = time.time() def h2i(s): - return s.replace(' ', '').decode('hex') + return decode_hex(s.replace(' ', '')) for s, l in reg_tests_mips32: - print "-" * 80 + print("-" * 80) s = s[12:] b = h2i((l)) mn = mn_mips32.dis(b, 'b') - print [str(x) for x in mn.args] - print s - print mn + print([str(x) for x in mn.args]) + print(s) + print(mn) assert(str(mn) == s) l = mn_mips32.fromstring(s, loc_db, 'b') assert(str(l) == s) a = mn_mips32.asm(l, 'b') - print [x for x in a] - print repr(b) + print([x for x in a]) + print(repr(b)) assert(b in a) diff --git a/test/arch/mips32/unit/asm_test.py b/test/arch/mips32/unit/asm_test.py index da792874..2dcaf6fc 100644 --- a/test/arch/mips32/unit/asm_test.py +++ b/test/arch/mips32/unit/asm_test.py @@ -1,13 +1,15 @@ import sys import os -from miasm2.arch.mips32.arch import mn_mips32 -from miasm2.core import parse_asm -from miasm2.expression.expression import * -from miasm2.core import asmblock -from elfesteem.strpatchwork import StrPatchwork -from miasm2.analysis.machine import Machine -from miasm2.jitter.csts import * +from future.utils import viewitems + +from miasm.arch.mips32.arch import mn_mips32 +from miasm.core import parse_asm +from miasm.expression.expression import * +from miasm.core import asmblock +from miasm.loader.strpatchwork import StrPatchwork +from miasm.analysis.machine import Machine +from miasm.jitter.csts import * reg_and_id = dict(mn_mips32.regs.all_regs_ids_byname) @@ -30,10 +32,10 @@ class Asm_Test(object): loc_db.set_location_offset(loc_db.get_name_location("main"), 0x0) s = StrPatchwork() patches = asmblock.asm_resolve_final(mn_mips32, blocks, loc_db) - for offset, raw in patches.items(): + for offset, raw in viewitems(patches): s[offset] = raw - s = str(s) + s = bytes(s) self.assembly = s def run(self): |