about summary refs log tree commit diff stats
path: root/test/arch/mep
diff options
context:
space:
mode:
authorCamille Mougey <commial@gmail.com>2019-03-07 14:37:07 +0100
committerGitHub <noreply@github.com>2019-03-07 14:37:07 +0100
commit4c2320b46250a8d6f8774e1218544b72a154cd8e (patch)
treeb67e7b072439f84109bd39dad8ed7f3f135224f8 /test/arch/mep
parenteab809932871f91d6f4aa770fc321af9e156e0f5 (diff)
parent26c1075723a02984da6d3bc7423c5c0c43082dc3 (diff)
downloadmiasm-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/mep/asm/test_asm.py20
-rw-r--r--test/arch/mep/asm/test_major_opcode_0.py2
-rw-r--r--test/arch/mep/asm/test_major_opcode_1.py2
-rw-r--r--test/arch/mep/asm/test_major_opcode_10.py2
-rw-r--r--test/arch/mep/asm/test_major_opcode_11.py2
-rw-r--r--test/arch/mep/asm/test_major_opcode_12.py2
-rw-r--r--test/arch/mep/asm/test_major_opcode_13.py2
-rw-r--r--test/arch/mep/asm/test_major_opcode_14.py2
-rw-r--r--test/arch/mep/asm/test_major_opcode_15.py2
-rw-r--r--test/arch/mep/asm/test_major_opcode_2.py2
-rw-r--r--test/arch/mep/asm/test_major_opcode_3.py2
-rw-r--r--test/arch/mep/asm/test_major_opcode_4.py2
-rw-r--r--test/arch/mep/asm/test_major_opcode_5.py2
-rw-r--r--test/arch/mep/asm/test_major_opcode_6.py2
-rw-r--r--test/arch/mep/asm/test_major_opcode_7.py2
-rw-r--r--test/arch/mep/asm/test_major_opcode_8.py2
-rw-r--r--test/arch/mep/asm/test_major_opcode_9.py2
-rw-r--r--test/arch/mep/asm/ut_helpers_asm.py41
-rw-r--r--test/arch/mep/ir/test_arithmetic.py4
-rw-r--r--test/arch/mep/ir/test_bitmanipulation.py4
-rw-r--r--test/arch/mep/ir/test_branchjump.py4
-rw-r--r--test/arch/mep/ir/test_control.py4
-rw-r--r--test/arch/mep/ir/test_coprocessor.py4
-rw-r--r--test/arch/mep/ir/test_datacache.py2
-rw-r--r--test/arch/mep/ir/test_debug.py4
-rw-r--r--test/arch/mep/ir/test_divide.py6
-rw-r--r--test/arch/mep/ir/test_extension.py4
-rw-r--r--test/arch/mep/ir/test_ir.py35
-rw-r--r--test/arch/mep/ir/test_ldz.py4
-rw-r--r--test/arch/mep/ir/test_loadstore.py4
-rw-r--r--test/arch/mep/ir/test_logical.py4
-rw-r--r--test/arch/mep/ir/test_move.py4
-rw-r--r--test/arch/mep/ir/test_multiply.py4
-rw-r--r--test/arch/mep/ir/test_repeat.py4
-rw-r--r--test/arch/mep/ir/test_shift.py6
-rw-r--r--test/arch/mep/ir/ut_helpers_ir.py31
-rw-r--r--test/arch/mep/jit/test_jit_branchjump.py2
-rw-r--r--test/arch/mep/jit/test_jit_repeat.py2
-rw-r--r--test/arch/mep/jit/ut_helpers_jit.py16
39 files changed, 133 insertions, 112 deletions
diff --git a/test/arch/mep/asm/test_asm.py b/test/arch/mep/asm/test_asm.py
index ddf91ed6..7762669a 100644
--- a/test/arch/mep/asm/test_asm.py
+++ b/test/arch/mep/asm/test_asm.py
@@ -1,9 +1,11 @@
 # Toshiba MeP-c4 - Misc unit tests
 # Guillaume Valadon <guillaume@valadon.net>
 
-from miasm2.arch.mep.arch import mn_mep
+from __future__ import print_function
+from miasm.core.utils import decode_hex, encode_hex
+from miasm.arch.mep.arch import mn_mep
 
-class TestMisc:
+class TestMisc(object):
 
     def test(self):
 
@@ -18,21 +20,23 @@ class TestMisc:
         unit_tests += [("SW R7, 0x50(SP)", "4752")]
 
         for mn_str, mn_hex in unit_tests:
-            print "-" * 49  # Tests separation
+            print("-" * 49)  # Tests separation
 
             # Dissassemble
-            mn_bin = mn_hex.decode("hex")
+            mn_bin = decode_hex(mn_hex)
             mn = mn_mep.dis(mn_bin, "b")
 
-            print "dis: %s -> %s" % (mn_hex.rjust(20), str(mn).rjust(20))
+            print("dis: %s -> %s" % (mn_hex.rjust(20), str(mn).rjust(20)))
             assert(str(mn) == mn_str)  # dissassemble assertion
 
             # Assemble and return all possible candidates
             instr = mn_mep.fromstring(str(mn), "b")
             instr.mode = "b"
-            asm_list = [i.encode("hex") for i in mn_mep.asm(instr)]
+            asm_list = [encode_hex(i).decode() for i in mn_mep.asm(instr)]
 
             # Print the results
-            print "asm: %s -> %s" % (mn_str.rjust(20),
-                                     ", ".join(asm_list).rjust(20))
+            print("asm: %s -> %s" % (
+                mn_str.rjust(20),
+                ", ".join(asm_list).rjust(20))
+            )
             assert(mn_hex in asm_list)  # assemble assertion
diff --git a/test/arch/mep/asm/test_major_opcode_0.py b/test/arch/mep/asm/test_major_opcode_0.py
index 69a9685c..db288e47 100644
--- a/test/arch/mep/asm/test_major_opcode_0.py
+++ b/test/arch/mep/asm/test_major_opcode_0.py
@@ -4,7 +4,7 @@
 from ut_helpers_asm import check_instruction
 
 
-class TestMajor0:
+class TestMajor0(object):
 
     def test_MOV(self):
         """Test the MOV instruction"""
diff --git a/test/arch/mep/asm/test_major_opcode_1.py b/test/arch/mep/asm/test_major_opcode_1.py
index c401bfd2..3a3c6538 100644
--- a/test/arch/mep/asm/test_major_opcode_1.py
+++ b/test/arch/mep/asm/test_major_opcode_1.py
@@ -4,7 +4,7 @@
 from ut_helpers_asm import check_instruction
 
 
-class TestMajor1:
+class TestMajor1(object):
 
     def test_OR(self):
         """Test the OR instruction"""
diff --git a/test/arch/mep/asm/test_major_opcode_10.py b/test/arch/mep/asm/test_major_opcode_10.py
index f1089c61..e10992c8 100644
--- a/test/arch/mep/asm/test_major_opcode_10.py
+++ b/test/arch/mep/asm/test_major_opcode_10.py
@@ -4,7 +4,7 @@
 from ut_helpers_asm import check_instruction
 
 
-class TestMajor10:
+class TestMajor10(object):
 
     def test_BEQZ(self):
         """Test the BEQZ instruction"""
diff --git a/test/arch/mep/asm/test_major_opcode_11.py b/test/arch/mep/asm/test_major_opcode_11.py
index b5d8a278..38f93e8b 100644
--- a/test/arch/mep/asm/test_major_opcode_11.py
+++ b/test/arch/mep/asm/test_major_opcode_11.py
@@ -4,7 +4,7 @@
 from ut_helpers_asm import check_instruction
 
 
-class TestMajor11:
+class TestMajor11(object):
 
     def test_BRA(self):
         """Test the BRA instruction"""
diff --git a/test/arch/mep/asm/test_major_opcode_12.py b/test/arch/mep/asm/test_major_opcode_12.py
index e721d287..c353861e 100644
--- a/test/arch/mep/asm/test_major_opcode_12.py
+++ b/test/arch/mep/asm/test_major_opcode_12.py
@@ -4,7 +4,7 @@
 from ut_helpers_asm import check_instruction
 
 
-class TestMajor12:
+class TestMajor12(object):
 
     def test_ADD3(self):
         """Test the ADD3 instruction"""
diff --git a/test/arch/mep/asm/test_major_opcode_13.py b/test/arch/mep/asm/test_major_opcode_13.py
index 996b47e3..bf95572c 100644
--- a/test/arch/mep/asm/test_major_opcode_13.py
+++ b/test/arch/mep/asm/test_major_opcode_13.py
@@ -4,7 +4,7 @@
 from ut_helpers_asm import check_instruction
 
 
-class TestMajor13:
+class TestMajor13(object):
 
     def test_MOVU(self):
         """Test the MOVU instruction"""
diff --git a/test/arch/mep/asm/test_major_opcode_14.py b/test/arch/mep/asm/test_major_opcode_14.py
index 6ad3c757..9ec99550 100644
--- a/test/arch/mep/asm/test_major_opcode_14.py
+++ b/test/arch/mep/asm/test_major_opcode_14.py
@@ -4,7 +4,7 @@
 from ut_helpers_asm import check_instruction
 
 
-class TestMajor14:
+class TestMajor14(object):
 
     def test_BEQI(self):
         """Test the BEQI instruction"""
diff --git a/test/arch/mep/asm/test_major_opcode_15.py b/test/arch/mep/asm/test_major_opcode_15.py
index ecad8b3f..891626e8 100644
--- a/test/arch/mep/asm/test_major_opcode_15.py
+++ b/test/arch/mep/asm/test_major_opcode_15.py
@@ -4,7 +4,7 @@
 from ut_helpers_asm import check_instruction
 
 
-class TestMajor15:
+class TestMajor15(object):
 
     def test_DSP(self):
         """Test the DSP instruction"""
diff --git a/test/arch/mep/asm/test_major_opcode_2.py b/test/arch/mep/asm/test_major_opcode_2.py
index 07743813..4cbe36ca 100644
--- a/test/arch/mep/asm/test_major_opcode_2.py
+++ b/test/arch/mep/asm/test_major_opcode_2.py
@@ -4,7 +4,7 @@
 from ut_helpers_asm import check_instruction
 
 
-class TestMajor2:
+class TestMajor2(object):
 
     def test_BSETM(self):
         """Test the BSETM instruction"""
diff --git a/test/arch/mep/asm/test_major_opcode_3.py b/test/arch/mep/asm/test_major_opcode_3.py
index 3e0c5864..793a4e87 100644
--- a/test/arch/mep/asm/test_major_opcode_3.py
+++ b/test/arch/mep/asm/test_major_opcode_3.py
@@ -4,7 +4,7 @@
 from ut_helpers_asm import check_instruction
 
 
-class TestMajor3:
+class TestMajor3(object):
 
     def test_SWCPI(self):
         """Test the SWCPI instruction"""
diff --git a/test/arch/mep/asm/test_major_opcode_4.py b/test/arch/mep/asm/test_major_opcode_4.py
index e52acf3f..a6f57ac2 100644
--- a/test/arch/mep/asm/test_major_opcode_4.py
+++ b/test/arch/mep/asm/test_major_opcode_4.py
@@ -4,7 +4,7 @@
 from ut_helpers_asm import check_instruction
 
 
-class TestMajor4:
+class TestMajor4(object):
 
     def test_ADD3(self):
         """Test the ADD3 instruction"""
diff --git a/test/arch/mep/asm/test_major_opcode_5.py b/test/arch/mep/asm/test_major_opcode_5.py
index e39230f4..2250c123 100644
--- a/test/arch/mep/asm/test_major_opcode_5.py
+++ b/test/arch/mep/asm/test_major_opcode_5.py
@@ -4,7 +4,7 @@
 from ut_helpers_asm import check_instruction
 
 
-class TestMajor5:
+class TestMajor5(object):
 
     def test_MOV(self):
         """Test the MOV instruction"""
diff --git a/test/arch/mep/asm/test_major_opcode_6.py b/test/arch/mep/asm/test_major_opcode_6.py
index 5eda1ea6..e10d1064 100644
--- a/test/arch/mep/asm/test_major_opcode_6.py
+++ b/test/arch/mep/asm/test_major_opcode_6.py
@@ -4,7 +4,7 @@
 from ut_helpers_asm import check_instruction
 
 
-class TestMajor6:
+class TestMajor6(object):
 
     def test_ADD(self):
         """Test the ADD instruction"""
diff --git a/test/arch/mep/asm/test_major_opcode_7.py b/test/arch/mep/asm/test_major_opcode_7.py
index 15a045da..1b1fba78 100644
--- a/test/arch/mep/asm/test_major_opcode_7.py
+++ b/test/arch/mep/asm/test_major_opcode_7.py
@@ -4,7 +4,7 @@
 from ut_helpers_asm import check_instruction
 
 
-class TestMajor7:
+class TestMajor7(object):
 
     def test_DI(self):
         """Test the DI instruction"""
diff --git a/test/arch/mep/asm/test_major_opcode_8.py b/test/arch/mep/asm/test_major_opcode_8.py
index 7f15f9e8..900cf004 100644
--- a/test/arch/mep/asm/test_major_opcode_8.py
+++ b/test/arch/mep/asm/test_major_opcode_8.py
@@ -4,7 +4,7 @@
 from ut_helpers_asm import check_instruction
 
 
-class TestMajor8:
+class TestMajor8(object):
 
     def test_SB(self):
         """Test the SB instruction"""
diff --git a/test/arch/mep/asm/test_major_opcode_9.py b/test/arch/mep/asm/test_major_opcode_9.py
index b8949887..9e59a863 100644
--- a/test/arch/mep/asm/test_major_opcode_9.py
+++ b/test/arch/mep/asm/test_major_opcode_9.py
@@ -4,7 +4,7 @@
 from ut_helpers_asm import check_instruction
 
 
-class TestMajor9:
+class TestMajor9(object):
 
     def test_ADD3(self):
         """Test the ADD3 instruction"""
diff --git a/test/arch/mep/asm/ut_helpers_asm.py b/test/arch/mep/asm/ut_helpers_asm.py
index af010afc..9f6dc5c2 100644
--- a/test/arch/mep/asm/ut_helpers_asm.py
+++ b/test/arch/mep/asm/ut_helpers_asm.py
@@ -1,17 +1,22 @@
 # Toshiba MeP-c4 - unit tests helpers
 # Guillaume Valadon <guillaume@valadon.net>
 
-from miasm2.arch.mep.arch import mn_mep
-from miasm2.core.cpu import Disasm_Exception
-from miasm2.core.locationdb import LocationDB
-from miasm2.expression.expression import ExprId, ExprInt, ExprLoc
+from __future__ import print_function
+
+from builtins import range
+
+from miasm.core.utils import decode_hex, encode_hex
+from miasm.arch.mep.arch import mn_mep
+from miasm.core.cpu import Disasm_Exception
+from miasm.core.locationdb import LocationDB
+from miasm.expression.expression import ExprId, ExprInt, ExprLoc
 
 import re
 
 
 def dis(mn_hex):
     """Disassembly helper"""
-    mn_bin = mn_hex.decode("hex")
+    mn_bin = decode_hex(mn_hex)
     try:
         return mn_mep.dis(mn_bin, "b")
     except Disasm_Exception:
@@ -50,7 +55,7 @@ def check_instruction(mn_str, mn_hex, multi=None, offset=0):
                 addr = loc_db.get_location_offset(mn.args[i].loc_key)
                 mn.args[i] = ExprInt(addr, args_size[i])
 
-    print "dis: %s -> %s" % (mn_hex.rjust(20), str(mn).rjust(20))
+    print("dis: %s -> %s" % (mn_hex.rjust(20), str(mn).rjust(20)))
     assert(str(mn) == mn_str)  # disassemble assertion
 
     # Assemble and return all possible candidates
@@ -59,21 +64,25 @@ def check_instruction(mn_str, mn_hex, multi=None, offset=0):
     instr.mode = "b"
     if instr.offset:
         instr.fixDstOffset()
-    asm_list = [i.encode("hex") for i in mn_mep.asm(instr)]
+    asm_list = [encode_hex(i).decode() for i in mn_mep.asm(instr)]
 
     # Check instructions variants
     if multi:
-        print "Instructions count:", len(asm_list)
+        print("Instructions count:", len(asm_list))
         assert(len(asm_list) == multi)
 
         # Ensure that variants correspond to the same disassembled instruction
-        for mn_hex in asm_list:
-            mn = dis(mn_hex)
-            print "dis: %s -> %s" % (mn_hex.rjust(20), str(mn).rjust(20))
+        for mn_hex_tmp in asm_list:
+            mn = dis(mn_hex_tmp)
+            print("dis: %s -> %s" % (mn_hex_tmp.rjust(20), str(mn).rjust(20)))
 
     # Check the assembly result
-    print "asm: %s -> %s" % (mn_str.rjust(20),
-                             ", ".join(asm_list).rjust(20))
+    print(
+        "asm: %s -> %s" % (
+            mn_str.rjust(20),
+            ", ".join(asm_list).rjust(20)
+        )
+    )
     assert(mn_hex in asm_list)  # assemble assertion
 
 
@@ -83,10 +92,10 @@ def launch_tests(obj):
     test_methods = [name for name in dir(obj) if name.startswith("test")]
 
     for method in test_methods:
-        print method
+        print(method)
         try:
             getattr(obj, method)()
         except AttributeError as e:
-            print "Method not found: %s" % method
+            print("Method not found: %s" % method)
             assert(False)
-        print '-' * 42
+        print('-' * 42)
diff --git a/test/arch/mep/ir/test_arithmetic.py b/test/arch/mep/ir/test_arithmetic.py
index 6da938e9..d404f51c 100644
--- a/test/arch/mep/ir/test_arithmetic.py
+++ b/test/arch/mep/ir/test_arithmetic.py
@@ -3,10 +3,10 @@
 
 from ut_helpers_ir import exec_instruction
 
-from miasm2.expression.expression import ExprId, ExprInt, ExprCond, ExprOp
+from miasm.expression.expression import ExprId, ExprInt, ExprCond, ExprOp
 
 
-class TestArithmetic:
+class TestArithmetic(object):
 
     def test_add3(self):
         """Test ADD3 execution"""
diff --git a/test/arch/mep/ir/test_bitmanipulation.py b/test/arch/mep/ir/test_bitmanipulation.py
index 06466f9d..6ec200c5 100644
--- a/test/arch/mep/ir/test_bitmanipulation.py
+++ b/test/arch/mep/ir/test_bitmanipulation.py
@@ -3,10 +3,10 @@
 
 from ut_helpers_ir import exec_instruction
 
-from miasm2.expression.expression import ExprId, ExprInt, ExprMem
+from miasm.expression.expression import ExprId, ExprInt, ExprMem
 
 
-class TestBitManipulation:
+class TestBitManipulation(object):
 
     def test_bsetm(self):
         """Test BSETM execution"""
diff --git a/test/arch/mep/ir/test_branchjump.py b/test/arch/mep/ir/test_branchjump.py
index 3f78558b..828b172f 100644
--- a/test/arch/mep/ir/test_branchjump.py
+++ b/test/arch/mep/ir/test_branchjump.py
@@ -3,10 +3,10 @@
 
 from ut_helpers_ir import exec_instruction
 
-from miasm2.expression.expression import ExprId, ExprInt
+from miasm.expression.expression import ExprId, ExprInt
 
 
-class TestBranchJump:
+class TestBranchJump(object):
 
     def test_bra(self):
         """Test BRA execution"""
diff --git a/test/arch/mep/ir/test_control.py b/test/arch/mep/ir/test_control.py
index a1b3c7c7..04c8b4d0 100644
--- a/test/arch/mep/ir/test_control.py
+++ b/test/arch/mep/ir/test_control.py
@@ -3,10 +3,10 @@
 
 from ut_helpers_ir import exec_instruction
 
-from miasm2.expression.expression import ExprId, ExprInt, ExprCond, ExprOp
+from miasm.expression.expression import ExprId, ExprInt, ExprCond, ExprOp
 
 
-class TestControl:
+class TestControl(object):
 
     def test_stc(self):
         """Test STC execution"""
diff --git a/test/arch/mep/ir/test_coprocessor.py b/test/arch/mep/ir/test_coprocessor.py
index e9b745ff..bd8fd39c 100644
--- a/test/arch/mep/ir/test_coprocessor.py
+++ b/test/arch/mep/ir/test_coprocessor.py
@@ -3,10 +3,10 @@
 
 from ut_helpers_ir import exec_instruction
 
-from miasm2.expression.expression import ExprId, ExprMem, ExprInt
+from miasm.expression.expression import ExprId, ExprMem, ExprInt
 
 
-class TestCoprocessor:
+class TestCoprocessor(object):
 
     def test_swcp(self):
         """Test SWCP execution"""
diff --git a/test/arch/mep/ir/test_datacache.py b/test/arch/mep/ir/test_datacache.py
index a462315d..7d92f9c7 100644
--- a/test/arch/mep/ir/test_datacache.py
+++ b/test/arch/mep/ir/test_datacache.py
@@ -4,7 +4,7 @@
 from ut_helpers_ir import exec_instruction
 
 
-class TestDataCache:
+class TestDataCache(object):
 
     def test_cache(self):
         """Test CACHE execution"""
diff --git a/test/arch/mep/ir/test_debug.py b/test/arch/mep/ir/test_debug.py
index 53f4064d..0c1026de 100644
--- a/test/arch/mep/ir/test_debug.py
+++ b/test/arch/mep/ir/test_debug.py
@@ -3,10 +3,10 @@
 
 from ut_helpers_ir import exec_instruction
 
-from miasm2.expression.expression import ExprId, ExprInt, ExprCond, ExprOp
+from miasm.expression.expression import ExprId, ExprInt, ExprCond, ExprOp
 
 
-class TestDebug:
+class TestDebug(object):
 
     def test_dret(self):
         """Test DRET execution"""
diff --git a/test/arch/mep/ir/test_divide.py b/test/arch/mep/ir/test_divide.py
index a63d0c5e..424a9876 100644
--- a/test/arch/mep/ir/test_divide.py
+++ b/test/arch/mep/ir/test_divide.py
@@ -3,11 +3,11 @@
 
 from ut_helpers_ir import exec_instruction
 
-from miasm2.expression.expression import ExprId, ExprInt, ExprCond, ExprOp
-from miasm2.jitter.csts import EXCEPT_DIV_BY_ZERO
+from miasm.expression.expression import ExprId, ExprInt, ExprCond, ExprOp
+from miasm.jitter.csts import EXCEPT_DIV_BY_ZERO
 
 
-class TestDivide:
+class TestDivide(object):
 
     def test_div(self):
         """Test DIV execution"""
diff --git a/test/arch/mep/ir/test_extension.py b/test/arch/mep/ir/test_extension.py
index 72423220..72ad8c22 100644
--- a/test/arch/mep/ir/test_extension.py
+++ b/test/arch/mep/ir/test_extension.py
@@ -3,10 +3,10 @@
 
 from ut_helpers_ir import exec_instruction
 
-from miasm2.expression.expression import ExprId, ExprMem, ExprInt
+from miasm.expression.expression import ExprId, ExprMem, ExprInt
 
 
-class TestExtension:
+class TestExtension(object):
 
     def test_extb(self):
         """Test EXTB execution"""
diff --git a/test/arch/mep/ir/test_ir.py b/test/arch/mep/ir/test_ir.py
index 3fec9ec9..be8e24e1 100644
--- a/test/arch/mep/ir/test_ir.py
+++ b/test/arch/mep/ir/test_ir.py
@@ -1,15 +1,18 @@
 # Toshiba MeP-c4 - Misc unit tests
 # Guillaume Valadon <guillaume@valadon.net>
 
-from miasm2.arch.mep.arch import mn_mep
-from miasm2.arch.mep.regs import regs_init
-from miasm2.arch.mep.ira import ir_mepb, ir_a_mepb
-from miasm2.expression.expression import ExprId, ExprInt, ExprMem
-from miasm2.ir.symbexec import SymbolicExecutionEngine
-from miasm2.core.locationdb import LocationDB
+from __future__ import print_function
 
+from miasm.core.utils import decode_hex
+from miasm.arch.mep.arch import mn_mep
+from miasm.arch.mep.regs import regs_init
+from miasm.arch.mep.ira import ir_mepb, ir_a_mepb
+from miasm.expression.expression import ExprId, ExprInt, ExprMem
+from miasm.ir.symbexec import SymbolicExecutionEngine
+from miasm.core.locationdb import LocationDB
 
-class TestMisc:
+
+class TestMisc(object):
 
     def test(self):
 
@@ -18,16 +21,16 @@ class TestMisc:
         def exec_instruction(hex_asm, init_values):
             """Symbolically execute an instruction"""
 
-            print "Hex:", hex_asm
+            print("Hex:", hex_asm)
 
             # Disassemble an instruction
-            mn = mn_mep.dis(hex_asm.decode("hex"), "b")
-            print "Dis:", mn
+            mn = mn_mep.dis(decode_hex(hex_asm), "b")
+            print("Dis:", mn)
 
             # Get the IR
             im = ir_mepb()
             iir, eiir, = im.get_ir(mn)
-            print "\nInternal representation:", iir
+            print("\nInternal representation:", iir)
 
             # Symbolic execution
             loc_db = LocationDB()
@@ -37,13 +40,13 @@ class TestMisc:
             for reg_expr_id, reg_expr_value in init_values:
                 sb.symbols[reg_expr_id] = reg_expr_value
 
-            print "\nModified registers:", [reg for reg in sb.modified(mems=False)]
-            print "Modified memories:", [mem for mem in sb.modified()]
+            print("\nModified registers:", [reg for reg in sb.modified(mems=False)])
+            print("Modified memories:", [mem for mem in sb.modified()])
 
-            print "\nFinal registers:"
+            print("\nFinal registers:")
             sb.dump(mems=False)
 
-            print "\nFinal mems:"
+            print("\nFinal mems:")
             sb.dump()
 
         for hex_asm, init_values in [("6108", [(ExprId("R1", 32), ExprInt(0x40, 32))]),
@@ -52,5 +55,5 @@ class TestMisc:
                                      ("0948", [(ExprId("R4", 32), ExprInt(0x41, 32)),
                                                (ExprId("R9", 32), ExprInt(0x28, 32)),
                                                (ExprMem(ExprInt(0x41, 32), 8), ExprInt(0, 8))])]:
-            print "-" * 49  # Tests separation
+            print("-" * 49)  # Tests separation
             exec_instruction(hex_asm, init_values)
diff --git a/test/arch/mep/ir/test_ldz.py b/test/arch/mep/ir/test_ldz.py
index 02960b60..f14172b2 100644
--- a/test/arch/mep/ir/test_ldz.py
+++ b/test/arch/mep/ir/test_ldz.py
@@ -3,10 +3,10 @@
 
 from ut_helpers_ir import exec_instruction
 
-from miasm2.expression.expression import ExprId, ExprInt, ExprCond, ExprOp
+from miasm.expression.expression import ExprId, ExprInt, ExprCond, ExprOp
 
 
-class TestLdz:
+class TestLdz(object):
 
     def test_ldz(self):
         """Test LDZ execution"""
diff --git a/test/arch/mep/ir/test_loadstore.py b/test/arch/mep/ir/test_loadstore.py
index c6b40d55..87343fcb 100644
--- a/test/arch/mep/ir/test_loadstore.py
+++ b/test/arch/mep/ir/test_loadstore.py
@@ -3,10 +3,10 @@
 
 from ut_helpers_ir import exec_instruction
 
-from miasm2.expression.expression import ExprId, ExprMem, ExprInt
+from miasm.expression.expression import ExprId, ExprMem, ExprInt
 
 
-class TestLoadStore:
+class TestLoadStore(object):
 
     def test_sb(self):
         """Test SB execution"""
diff --git a/test/arch/mep/ir/test_logical.py b/test/arch/mep/ir/test_logical.py
index 61cbbf0a..0e5aef76 100644
--- a/test/arch/mep/ir/test_logical.py
+++ b/test/arch/mep/ir/test_logical.py
@@ -3,10 +3,10 @@
 
 from ut_helpers_ir import exec_instruction
 
-from miasm2.expression.expression import ExprId, ExprInt, ExprCond, ExprOp
+from miasm.expression.expression import ExprId, ExprInt, ExprCond, ExprOp
 
 
-class TestLogical:
+class TestLogical(object):
 
     def test_or(self):
         """Test OR execution"""
diff --git a/test/arch/mep/ir/test_move.py b/test/arch/mep/ir/test_move.py
index 56a4225e..30af1a74 100644
--- a/test/arch/mep/ir/test_move.py
+++ b/test/arch/mep/ir/test_move.py
@@ -3,10 +3,10 @@
 
 from ut_helpers_ir import exec_instruction
 
-from miasm2.expression.expression import ExprId, ExprMem, ExprInt
+from miasm.expression.expression import ExprId, ExprMem, ExprInt
 
 
-class TestMove:
+class TestMove(object):
 
     def test_mov(self):
         """Test MOV execution"""
diff --git a/test/arch/mep/ir/test_multiply.py b/test/arch/mep/ir/test_multiply.py
index 0618f69f..065f1a59 100644
--- a/test/arch/mep/ir/test_multiply.py
+++ b/test/arch/mep/ir/test_multiply.py
@@ -3,10 +3,10 @@
 
 from ut_helpers_ir import exec_instruction
 
-from miasm2.expression.expression import ExprId, ExprInt, ExprCond, ExprOp
+from miasm.expression.expression import ExprId, ExprInt, ExprCond, ExprOp
 
 
-class TestMultiply:
+class TestMultiply(object):
 
     def test_mul(self):
         """Test MUL execution"""
diff --git a/test/arch/mep/ir/test_repeat.py b/test/arch/mep/ir/test_repeat.py
index 252764b1..e684ef87 100644
--- a/test/arch/mep/ir/test_repeat.py
+++ b/test/arch/mep/ir/test_repeat.py
@@ -3,10 +3,10 @@
 
 from ut_helpers_ir import exec_instruction
 
-from miasm2.expression.expression import ExprId, ExprInt, ExprCond, ExprOp
+from miasm.expression.expression import ExprId, ExprInt, ExprCond, ExprOp
 
 
-class TestRepeat:
+class TestRepeat(object):
 
     def test_repeat(self):
         """Test REPEAT execution"""
diff --git a/test/arch/mep/ir/test_shift.py b/test/arch/mep/ir/test_shift.py
index b63f9ed7..cac48660 100644
--- a/test/arch/mep/ir/test_shift.py
+++ b/test/arch/mep/ir/test_shift.py
@@ -3,11 +3,11 @@
 
 from ut_helpers_ir import exec_instruction
 
-from miasm2.expression.expression import ExprId, ExprInt, ExprCond, ExprOp
-from miasm2.core.cpu import sign_ext
+from miasm.expression.expression import ExprId, ExprInt, ExprCond, ExprOp
+from miasm.core.cpu import sign_ext
 
 
-class TestShift:
+class TestShift(object):
 
     def test_sra(self):
         """Test SRA execution"""
diff --git a/test/arch/mep/ir/ut_helpers_ir.py b/test/arch/mep/ir/ut_helpers_ir.py
index 9c9efdfa..c5bf36b9 100644
--- a/test/arch/mep/ir/ut_helpers_ir.py
+++ b/test/arch/mep/ir/ut_helpers_ir.py
@@ -1,16 +1,19 @@
 # Toshiba MeP-c4 - unit tests helpers
 # Guillaume Valadon <guillaume@valadon.net>
 
-from miasm2.arch.mep.arch import mn_mep
-from miasm2.arch.mep.sem import ir_mepb
-from miasm2.arch.mep.regs import regs_init
+from __future__ import print_function
 
-from miasm2.ir.symbexec import SymbolicExecutionEngine
-from miasm2.core.locationdb import LocationDB
-from miasm2.core.utils import Disasm_Exception
-from miasm2.ir.ir import AssignBlock
-from miasm2.arch.mep.ira import ir_a_mepb
-from miasm2.expression.expression import ExprId, ExprInt, ExprOp, ExprMem, ExprAssign, ExprLoc
+from miasm.arch.mep.arch import mn_mep
+from miasm.arch.mep.sem import ir_mepb
+from miasm.arch.mep.regs import regs_init
+
+from miasm.ir.symbexec import SymbolicExecutionEngine
+from miasm.core.locationdb import LocationDB
+from miasm.core.utils import Disasm_Exception
+from miasm.ir.ir import AssignBlock
+from miasm.arch.mep.ira import ir_a_mepb
+from miasm.expression.expression import ExprId, ExprInt, ExprOp, ExprMem, \
+    ExprAssign, ExprLoc
 
 
 def exec_instruction(mn_str, init_values, results, index=0, offset=0):
@@ -67,8 +70,8 @@ def exec_instruction(mn_str, init_values, results, index=0, offset=0):
 
     # Ensure that all expected results were verified
     if len(results) is not matched_results:
-        print "Expected:", results
-        print "Modified:", [r for r in sb.modified(mems=False)]
+        print("Expected:", results)
+        print("Modified:", [r for r in sb.modified(mems=False)])
         assert(False)
 
 
@@ -78,10 +81,10 @@ def launch_tests(obj):
     test_methods = [name for name in dir(obj) if name.startswith("test")]
 
     for method in test_methods:
-        print method
+        print(method)
         try:
             getattr(obj, method)()
         except AttributeError as e:
-            print "Method not found: %s" % method
+            print("Method not found: %s" % method)
             assert(False)
-        print '-' * 42
+        print('-' * 42)
diff --git a/test/arch/mep/jit/test_jit_branchjump.py b/test/arch/mep/jit/test_jit_branchjump.py
index baf602d8..1f932aa9 100644
--- a/test/arch/mep/jit/test_jit_branchjump.py
+++ b/test/arch/mep/jit/test_jit_branchjump.py
@@ -4,7 +4,7 @@
 from ut_helpers_jit import jit_instructions
 
 
-class TestBranchJump:
+class TestBranchJump(object):
 
     def test_blti(self):
         """Test BLTI jit"""
diff --git a/test/arch/mep/jit/test_jit_repeat.py b/test/arch/mep/jit/test_jit_repeat.py
index 9fa64fa5..eaac1a1d 100644
--- a/test/arch/mep/jit/test_jit_repeat.py
+++ b/test/arch/mep/jit/test_jit_repeat.py
@@ -4,7 +4,7 @@
 from ut_helpers_jit import jit_instructions
 
 
-class TestRepeat:
+class TestRepeat(object):
     def test_repeat(self):
         """Test REPEAT jit"""
 
diff --git a/test/arch/mep/jit/ut_helpers_jit.py b/test/arch/mep/jit/ut_helpers_jit.py
index 590c534f..0c756e39 100644
--- a/test/arch/mep/jit/ut_helpers_jit.py
+++ b/test/arch/mep/jit/ut_helpers_jit.py
@@ -1,19 +1,21 @@
 # Toshiba MeP-c4 - unit tests helpers
 # Guillaume Valadon <guillaume@valadon.net>
 
-from miasm2.analysis.machine import Machine
-from miasm2.jitter.csts import PAGE_READ, PAGE_WRITE
+from __future__ import print_function
+
+from miasm.analysis.machine import Machine
+from miasm.jitter.csts import PAGE_READ, PAGE_WRITE
 
 
 def jit_instructions(mn_str):
     """JIT instructions and return the jitter object."""
 
-    # Get the miasm2 Machine
+    # Get the miasm Machine
     machine = Machine("mepb")
     mn_mep = machine.mn()
 
     # Assemble the instructions
-    asm = ""
+    asm = b""
     for instr_str in mn_str.split("\n"):
         instr = mn_mep.fromstring(instr_str, "b")
         instr.mode = "b"
@@ -40,10 +42,10 @@ def launch_tests(obj):
     test_methods = [name for name in dir(obj) if name.startswith("test")]
 
     for method in test_methods:
-        print method
+        print(method)
         try:
             getattr(obj, method)()
         except AttributeError as e:
-            print "Method not found: %s" % method
+            print("Method not found: %s" % method)
             assert(False)
-        print '-' * 42
+        print('-' * 42)