diff options
Diffstat (limited to '')
| -rw-r--r-- | test/arch/mep/ir/test_arithmetic.py | 4 | ||||
| -rw-r--r-- | test/arch/mep/ir/test_bitmanipulation.py | 4 | ||||
| -rw-r--r-- | test/arch/mep/ir/test_branchjump.py | 4 | ||||
| -rw-r--r-- | test/arch/mep/ir/test_control.py | 4 | ||||
| -rw-r--r-- | test/arch/mep/ir/test_coprocessor.py | 4 | ||||
| -rw-r--r-- | test/arch/mep/ir/test_datacache.py | 2 | ||||
| -rw-r--r-- | test/arch/mep/ir/test_debug.py | 4 | ||||
| -rw-r--r-- | test/arch/mep/ir/test_divide.py | 6 | ||||
| -rw-r--r-- | test/arch/mep/ir/test_extension.py | 4 | ||||
| -rw-r--r-- | test/arch/mep/ir/test_ir.py | 35 | ||||
| -rw-r--r-- | test/arch/mep/ir/test_ldz.py | 4 | ||||
| -rw-r--r-- | test/arch/mep/ir/test_loadstore.py | 4 | ||||
| -rw-r--r-- | test/arch/mep/ir/test_logical.py | 4 | ||||
| -rw-r--r-- | test/arch/mep/ir/test_move.py | 4 | ||||
| -rw-r--r-- | test/arch/mep/ir/test_multiply.py | 4 | ||||
| -rw-r--r-- | test/arch/mep/ir/test_repeat.py | 4 | ||||
| -rw-r--r-- | test/arch/mep/ir/test_shift.py | 6 | ||||
| -rw-r--r-- | test/arch/mep/ir/ut_helpers_ir.py | 31 |
18 files changed, 69 insertions, 63 deletions
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) |