diff options
Diffstat (limited to 'test')
| -rw-r--r-- | test/arch/aarch64/arch.py | 12 | ||||
| -rw-r--r-- | test/core/modint.py (renamed from test/expression/modint.py) | 2 | ||||
| -rwxr-xr-x | test/core/test_types.py | 25 | ||||
| -rw-r--r-- | test/expression/simplifications.py | 25 | ||||
| -rw-r--r-- | test/jitter/jitload.py | 2 | ||||
| -rwxr-xr-x | test/test_all.py | 6 |
6 files changed, 61 insertions, 11 deletions
diff --git a/test/arch/aarch64/arch.py b/test/arch/aarch64/arch.py index 9fc6ee8e..62105236 100644 --- a/test/arch/aarch64/arch.py +++ b/test/arch/aarch64/arch.py @@ -1740,14 +1740,14 @@ reg_tests_aarch64 = [ "010000D4"), - ("00458FF4 MRS X0, 0x3, c13, c0, 0x2", + ("00458FF4 MRS X0, 0x3, 0x3, c13, c0, 0x2", "40D03BD5"), - ("0045BA04 MSR 0x3, c13, c0, 0x2, X0", + ("0045BA04 MSR 0x3, 0x3, c13, c0, 0x2, X0", "40D01BD5"), - ("0048A2E8 MRS X13, 0x3, c4, c4, 0x0", - "0D443BD5"), - ("0048A9DC MRS X0, 0x3, c4, c4, 0x1", - "20443BD5"), + ("0048A2E8 MRS X8, 0x3, 0x3, c4, c2, 0x0", + "08423BD5"), + ("0048A9DC MSR 0x3, 0x3, c4, c2, 0x0, X7", + "07421BD5"), ("004010C8 ORR W2, 0x0, 0x1", "E2030032"), diff --git a/test/expression/modint.py b/test/core/modint.py index af80b284..d493b44e 100644 --- a/test/expression/modint.py +++ b/test/core/modint.py @@ -1,6 +1,6 @@ from __future__ import print_function -from miasm.expression.modint import * +from miasm.core.modint import * a = uint8(0x42) b = uint8(0xFF) diff --git a/test/core/test_types.py b/test/core/test_types.py index 1b15630c..13a7824e 100755 --- a/test/core/test_types.py +++ b/test/core/test_types.py @@ -351,6 +351,31 @@ assert bit.flags.f2_5 == 0b01110 assert bit.flags.f3_8 == 0b01010101 assert bit.flags.f4_1 == 1 +try: + class BitStruct(MemUnion): + fields = [ + ("ValueB", BitField(Num("<Q"), [ + ("field_00", 32), + ("field_01", 32), + ])), + ("Value", Num("<Q")), + ] +except ValueError: + assert False, "Should not raise" + +try: + class BitStruct(MemUnion): + fields = [ + ("ValueB", BitField(Num("<Q"), [ + ("field_00", 32), + ("field_01", 32), + ("field_02", 1), + ])), + ("Value", Num("<Q")), + ] + assert False, "Should raise" +except ValueError: + pass # Unhealthy ideas class UnhealthyIdeas(MemStruct): diff --git a/test/expression/simplifications.py b/test/expression/simplifications.py index 1f243425..c75dc0d3 100644 --- a/test/expression/simplifications.py +++ b/test/expression/simplifications.py @@ -784,6 +784,31 @@ to_test = [ ExprOp(TOK_EQUAL, a, i0) ), + + ( + ExprCond( + ExprOp("CC_U<", a[0:1]), + b, c + ), + ExprCond( + a[0:1], + b, c + ), + ), + + ( + ExprCond( + ExprOp("CC_U>=", a[0:1]), + b, c + ), + ExprCond( + a[0:1], + c, b + ), + ), + + + ] for e_input, e_check in to_test: diff --git a/test/jitter/jitload.py b/test/jitter/jitload.py index 8b758a89..3038c21c 100644 --- a/test/jitter/jitload.py +++ b/test/jitter/jitload.py @@ -47,4 +47,4 @@ assert myjit.eval_expr(eax) == imm4 ## Changes must be passed on myjit.cpu instance assert myjit.cpu.EAX == 4 ## Memory -assert myjit.eval_expr(memdata).arg.arg == int(encode_hex(data[::-1]), 16) +assert int(myjit.eval_expr(memdata)) == int(encode_hex(data[::-1]), 16) diff --git a/test/test_all.py b/test/test_all.py index 71eccc6f..2670761b 100755 --- a/test/test_all.py +++ b/test/test_all.py @@ -305,7 +305,8 @@ testset += SemanticTestExec("x86_32", "PE", 0x401000, ["bsr_bsf"], depends=[test_x86_32_bsr_bsf]) ## Core -for script in ["interval.py", +for script in ["modint.py", + "interval.py", "graph.py", "parse_asm.py", "utils.py", @@ -318,8 +319,7 @@ testset += RegressionTest(["asmblock.py"], base_dir="core", products=["graph.dot", "graph2.dot", "graph3.dot", "graph4.dot"]) ## Expression -for script in ["modint.py", - "expression.py", +for script in ["expression.py", "stp.py", "simplifications.py", "expression_helper.py", |