diff options
Diffstat (limited to 'test')
| -rw-r--r-- | test/analysis/data_flow.py | 1 | ||||
| -rw-r--r-- | test/analysis/depgraph.py | 2 | ||||
| -rw-r--r-- | test/arch/arm/arch.py | 62 | ||||
| -rw-r--r-- | test/arch/mips32/arch.py | 4 | ||||
| -rw-r--r-- | test/arch/msp430/arch.py | 4 | ||||
| -rw-r--r-- | test/arch/sh4/arch.py | 4 | ||||
| -rw-r--r-- | test/arch/x86/arch.py | 7 | ||||
| -rw-r--r-- | test/expression/simplifications.py | 4 |
8 files changed, 5 insertions, 83 deletions
diff --git a/test/analysis/data_flow.py b/test/analysis/data_flow.py index c3469109..d5b197d2 100644 --- a/test/analysis/data_flow.py +++ b/test/analysis/data_flow.py @@ -673,7 +673,6 @@ for test_nb, test in enumerate([(G1_IRA, G1_EXP_IRA), reaching_defs = ReachingDefinitions(g_ira) defuse = DiGraphDefUse(reaching_defs, deref_mem=True) - #open("defuse_%02d.dot" % (test_nb+1), "w").write(defuse.dot()) # # Simplify graph dead_simp(g_ira) diff --git a/test/analysis/depgraph.py b/test/analysis/depgraph.py index 4e023761..86857182 100644 --- a/test/analysis/depgraph.py +++ b/test/analysis/depgraph.py @@ -1058,7 +1058,7 @@ for test_nb, test in enumerate([(G1_IRA, G1_INPUT), all_results.add(unflatGraph(flatGraph(result.graph))) open("graph_test_%02d_%02d.dot" % (test_nb + 1, i), "w").write(dg2graph(result.graph)) - # print all_flat + if g_ind == 0: all_flat = sorted(all_flat) all_flats.append(all_flat) diff --git a/test/arch/arm/arch.py b/test/arch/arm/arch.py index 90d137d0..f69bb104 100644 --- a/test/arch/arm/arch.py +++ b/test/arch/arm/arch.py @@ -5,41 +5,6 @@ from pdb import pm symbol_pool = AsmSymbolPool() -if 0: - a = bs('00') - b = bs('01') - c = bs(l=2) - d = bs(l=4, fname='rd') - e = bs_name(l=1, name={'ADD': 0, 'SUB': 1}) - assert(isinstance(e, bs_divert)) - scc = bs_mod_name(l=1, mn_mod=['', 'S']) - f = bs(l=1, cls=(arm_reg,)) - - class arm_mov(mn_arm): - fields = [bs('0000'), bs('0000'), bs('0000')] - - class arm_DATA(mn_arm): - fields = [bs('1111'), e, scc, f, bs('0')] - mn = mn_arm.dis(0xF000000) - - -if 0: - import cProfile - cProfile.run('mn_arm.dis("\xe1\xa0\xa0\x06", "l")') - # l = mn_arm.dis(bin_stream("\xe1\xa0\xa0\x06"), mode_arm) - # print l - """ - mode = 64 - l = mn_x86.fromstring("ADC DWORD PTR [RAX], 0x11223344", mode) - print 'xx' - #t= time.time() - import cProfile - def f(): - x = l.asm(mode) - print x - cProfile.run('f()') - """ - def h2i(s): return s.replace(' ', '').decode('hex') @@ -268,15 +233,11 @@ for s, l in reg_tests_arm: print s print mn assert(str(mn) == s) - # print hex(b) - # print [str(x.get()) for x in mn.args] l = mn_arm.fromstring(s, symbol_pool, 'l') - # print l assert(str(l) == s) a = mn_arm.asm(l) print [x for x in a] print repr(b) - # print mn.args assert(b in a) reg_tests_armt = [ @@ -720,36 +681,14 @@ for s, l in reg_tests_armt: print s print mn assert(str(mn) == s) - # print hex(b) - # print [str(x.get()) for x in mn.args] l = mn_armt.fromstring(s, symbol_pool, 'l') - # print l assert(str(l) == s) print 'Asm..', l a = mn_armt.asm(l) print [x for x in a] print repr(b) - # print mn.args assert(b in a) -""" -print "*"*30, "START SPECIAL PARSING", "*"*30 -parse_tests = [ - "MOV LR, toto", - "MOV LR, 1+toto", - "MOV LR, (lend-lstart)^toto<<<R1", - "MOV LR, R1 LSL (l_end-l_start)^toto<<<R1", - "MOV LR, R1 LSL (l_end-l_start)^toto<<<R1", - "EOR R0, R1, toto^titi+1", - ] - -for l in parse_tests: - print "-"*80 - l = mn_arm.fromstring(l, 'l') - print l.name, ", ".join([str(a) for a in l.args]) -""" - - print 'TEST time', time.time() - ts # speed test arm @@ -787,7 +726,6 @@ instr_num = 0 ts = time.time() while off < bs.getlen(): mn = mn_armt.dis(bs, 'l', off) - # print instr_num, off, str(mn) instr_num += 1 off += mn.l print 'instr per sec:', instr_num / (time.time() - ts) diff --git a/test/arch/mips32/arch.py b/test/arch/mips32/arch.py index c6b68c0c..6fc36d13 100644 --- a/test/arch/mips32/arch.py +++ b/test/arch/mips32/arch.py @@ -228,13 +228,9 @@ for s, l in reg_tests_mips32: print s print mn assert(str(mn) == s) - # print hex(b) - # print [str(x.get()) for x in mn.args] l = mn_mips32.fromstring(s, symbol_pool, 'b') - # print l assert(str(l) == s) a = mn_mips32.asm(l, 'b') print [x for x in a] print repr(b) - # print mn.args assert(b in a) diff --git a/test/arch/msp430/arch.py b/test/arch/msp430/arch.py index 3df2becb..08e5bdae 100644 --- a/test/arch/msp430/arch.py +++ b/test/arch/msp430/arch.py @@ -95,13 +95,9 @@ for s, l in reg_tests_msp: print s print mn assert(str(mn) == s) - # print hex(b) - # print [str(x.get()) for x in mn.args] l = mn_msp430.fromstring(s, symbol_pool, None) - # print l assert(str(l) == s) a = mn_msp430.asm(l) print [x for x in a] print repr(b) - # print mn.args assert(b in a) diff --git a/test/arch/sh4/arch.py b/test/arch/sh4/arch.py index 574dcf49..9162fdbc 100644 --- a/test/arch/sh4/arch.py +++ b/test/arch/sh4/arch.py @@ -398,15 +398,11 @@ for s, l in reg_tests_sh4: print s print mn assert(str(mn) == s) - # print hex(b) - # print [str(x.get()) for x in mn.args] l = mn_sh4.fromstring(s, symbol_pool, None) - # print l assert(str(l) == s) a = mn_sh4.asm(l) print [x for x in a] print repr(b) - # print mn.args assert(b in a) diff --git a/test/arch/x86/arch.py b/test/arch/x86/arch.py index 05b31815..1865ceba 100644 --- a/test/arch/x86/arch.py +++ b/test/arch/x86/arch.py @@ -3062,17 +3062,13 @@ for mode, s, l, in reg_tests: print s print mn assert(str(mn).strip() == s) - # print hex(b) - # print [str(x.get()) for x in mn.args] print 'fromstring', repr(s) l = mn_x86.fromstring(s, symbol_pool, mode) - # print l print 'str args', [(str(x), x.size) for x in l.args] assert(str(l).strip(' ') == s) a = mn_x86.asm(l) print 'asm result', [x for x in a] print repr(b) - # test_file[mode[0]].write(b) for x in a: print "BYTES", repr(x) @@ -3086,7 +3082,6 @@ for mode, s, l, in reg_tests: assert(str(rl).strip(' ') == s) print repr(b), a assert(b in a) - # print mn.args print 'TEST time', time.time() - ts @@ -3118,9 +3113,7 @@ def profile_dis(o): print 'instr per sec:', instr_num / (time.time() - ts) import cProfile -# cProfile.run(r'mn_x86.dis("\x81\x54\x18\xfe\x44\x33\x22\x11", m32)') cProfile.run('profile_dis(o)') -# profile_dis(o) # Test instruction representation with prefix instr_bytes = '\x65\xc7\x00\x09\x00\x00\x00' diff --git a/test/expression/simplifications.py b/test/expression/simplifications.py index a4e839cf..b2591a83 100644 --- a/test/expression/simplifications.py +++ b/test/expression/simplifications.py @@ -177,6 +177,10 @@ to_test = [(ExprInt(1, 32) - ExprInt(1, 32), ExprInt(0, 32)), (ExprInt(0x4142, 32)[:32], ExprInt(0x4142, 32)), (ExprInt(0x4142, 32)[:8], ExprInt(0x42, 8)), (ExprInt(0x4142, 32)[8:16], ExprInt(0x41, 8)), + (ExprOp('>>', ExprOp('<<', a, ExprInt(0x4, 32)), ExprInt(0x4, 32)), + ExprOp('&', a, ExprInt(0x0FFFFFFF, 32))), + (ExprOp('<<', ExprOp('>>', a, ExprInt(0x4, 32)), ExprInt(0x4, 32)), + ExprOp('&', a, ExprInt(0xFFFFFFF0, 32))), (a[:32], a), (a[:8][:8], a[:8]), (a[:16][:8], a[:8]), |