diff options
Diffstat (limited to 'test/arch/mep/ir')
| -rw-r--r-- | test/arch/mep/ir/test_arithmetic.py | 2 | ||||
| -rw-r--r-- | test/arch/mep/ir/test_bitmanipulation.py | 2 | ||||
| -rw-r--r-- | test/arch/mep/ir/test_branchjump.py | 2 | ||||
| -rw-r--r-- | test/arch/mep/ir/test_control.py | 2 | ||||
| -rw-r--r-- | test/arch/mep/ir/test_coprocessor.py | 2 | ||||
| -rw-r--r-- | test/arch/mep/ir/test_datacache.py | 2 | ||||
| -rw-r--r-- | test/arch/mep/ir/test_debug.py | 2 | ||||
| -rw-r--r-- | test/arch/mep/ir/test_divide.py | 2 | ||||
| -rw-r--r-- | test/arch/mep/ir/test_extension.py | 2 | ||||
| -rw-r--r-- | test/arch/mep/ir/test_ir.py | 23 | ||||
| -rw-r--r-- | test/arch/mep/ir/test_ldz.py | 2 | ||||
| -rw-r--r-- | test/arch/mep/ir/test_loadstore.py | 2 | ||||
| -rw-r--r-- | test/arch/mep/ir/test_logical.py | 2 | ||||
| -rw-r--r-- | test/arch/mep/ir/test_move.py | 2 | ||||
| -rw-r--r-- | test/arch/mep/ir/test_multiply.py | 2 | ||||
| -rw-r--r-- | test/arch/mep/ir/test_repeat.py | 2 | ||||
| -rw-r--r-- | test/arch/mep/ir/test_shift.py | 2 | ||||
| -rw-r--r-- | test/arch/mep/ir/ut_helpers_ir.py | 15 |
18 files changed, 38 insertions, 32 deletions
diff --git a/test/arch/mep/ir/test_arithmetic.py b/test/arch/mep/ir/test_arithmetic.py index 6da938e9..2e0dbf32 100644 --- a/test/arch/mep/ir/test_arithmetic.py +++ b/test/arch/mep/ir/test_arithmetic.py @@ -6,7 +6,7 @@ from ut_helpers_ir import exec_instruction from miasm2.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..f4ea2f29 100644 --- a/test/arch/mep/ir/test_bitmanipulation.py +++ b/test/arch/mep/ir/test_bitmanipulation.py @@ -6,7 +6,7 @@ from ut_helpers_ir import exec_instruction from miasm2.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..7e0953fd 100644 --- a/test/arch/mep/ir/test_branchjump.py +++ b/test/arch/mep/ir/test_branchjump.py @@ -6,7 +6,7 @@ from ut_helpers_ir import exec_instruction from miasm2.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..92dcb371 100644 --- a/test/arch/mep/ir/test_control.py +++ b/test/arch/mep/ir/test_control.py @@ -6,7 +6,7 @@ from ut_helpers_ir import exec_instruction from miasm2.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..e9829c08 100644 --- a/test/arch/mep/ir/test_coprocessor.py +++ b/test/arch/mep/ir/test_coprocessor.py @@ -6,7 +6,7 @@ from ut_helpers_ir import exec_instruction from miasm2.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..b25e3a19 100644 --- a/test/arch/mep/ir/test_debug.py +++ b/test/arch/mep/ir/test_debug.py @@ -6,7 +6,7 @@ from ut_helpers_ir import exec_instruction from miasm2.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..e3e4cb99 100644 --- a/test/arch/mep/ir/test_divide.py +++ b/test/arch/mep/ir/test_divide.py @@ -7,7 +7,7 @@ from miasm2.expression.expression import ExprId, ExprInt, ExprCond, ExprOp from miasm2.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..10f16ebf 100644 --- a/test/arch/mep/ir/test_extension.py +++ b/test/arch/mep/ir/test_extension.py @@ -6,7 +6,7 @@ from ut_helpers_ir import exec_instruction from miasm2.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..be717db8 100644 --- a/test/arch/mep/ir/test_ir.py +++ b/test/arch/mep/ir/test_ir.py @@ -1,6 +1,9 @@ # Toshiba MeP-c4 - Misc unit tests # Guillaume Valadon <guillaume@valadon.net> +from __future__ import print_function + +from miasm2.core.utils import decode_hex 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 @@ -9,7 +12,7 @@ from miasm2.ir.symbexec import SymbolicExecutionEngine from miasm2.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..668030c8 100644 --- a/test/arch/mep/ir/test_ldz.py +++ b/test/arch/mep/ir/test_ldz.py @@ -6,7 +6,7 @@ from ut_helpers_ir import exec_instruction from miasm2.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..22cb4304 100644 --- a/test/arch/mep/ir/test_loadstore.py +++ b/test/arch/mep/ir/test_loadstore.py @@ -6,7 +6,7 @@ from ut_helpers_ir import exec_instruction from miasm2.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..e78b5488 100644 --- a/test/arch/mep/ir/test_logical.py +++ b/test/arch/mep/ir/test_logical.py @@ -6,7 +6,7 @@ from ut_helpers_ir import exec_instruction from miasm2.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..8da7a18a 100644 --- a/test/arch/mep/ir/test_move.py +++ b/test/arch/mep/ir/test_move.py @@ -6,7 +6,7 @@ from ut_helpers_ir import exec_instruction from miasm2.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..5673994c 100644 --- a/test/arch/mep/ir/test_multiply.py +++ b/test/arch/mep/ir/test_multiply.py @@ -6,7 +6,7 @@ from ut_helpers_ir import exec_instruction from miasm2.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..1e0e2f86 100644 --- a/test/arch/mep/ir/test_repeat.py +++ b/test/arch/mep/ir/test_repeat.py @@ -6,7 +6,7 @@ from ut_helpers_ir import exec_instruction from miasm2.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..99755ba5 100644 --- a/test/arch/mep/ir/test_shift.py +++ b/test/arch/mep/ir/test_shift.py @@ -7,7 +7,7 @@ from miasm2.expression.expression import ExprId, ExprInt, ExprCond, ExprOp from miasm2.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..26eebeda 100644 --- a/test/arch/mep/ir/ut_helpers_ir.py +++ b/test/arch/mep/ir/ut_helpers_ir.py @@ -1,6 +1,8 @@ # Toshiba MeP-c4 - unit tests helpers # Guillaume Valadon <guillaume@valadon.net> +from __future__ import print_function + from miasm2.arch.mep.arch import mn_mep from miasm2.arch.mep.sem import ir_mepb from miasm2.arch.mep.regs import regs_init @@ -10,7 +12,8 @@ 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 miasm2.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) |