Revamp Python regression tests suite (#2022)
* Fix Python regression test suite (partial) * Fix Python regression test suite * Add a test for mapping at high addresses * Add ctl tests
This commit is contained in:
@@ -1,23 +1,24 @@
|
||||
#!/usr/bin/python
|
||||
|
||||
import regress
|
||||
|
||||
from unicorn import *
|
||||
from unicorn.arm_const import *
|
||||
|
||||
import regress
|
||||
|
||||
class MovHang(regress.RegressTest):
|
||||
|
||||
def runTest(self):
|
||||
uc = Uc(UC_ARCH_ARM, UC_MODE_ARM)
|
||||
uc.mem_map(0x1000, 0x1000)
|
||||
uc.mem_write(0x1000, '00c000e3'.decode('hex')) # movw r12, #0
|
||||
uc.mem_write(0x1000, b'\x00\xc0\x00\xe3') # movw r12, #0
|
||||
|
||||
def hook_block(uc, addr, *args):
|
||||
print 'enter block 0x%04x' % addr
|
||||
regress.logger.debug('enter block 0x%#06x', addr)
|
||||
uc.count += 1
|
||||
|
||||
uc.reg_write(UC_ARM_REG_R12, 0x123)
|
||||
self.assertEquals(uc.reg_read(UC_ARM_REG_R12), 0x123)
|
||||
self.assertEqual(0x123, uc.reg_read(UC_ARM_REG_R12))
|
||||
|
||||
uc.hook_add(UC_HOOK_BLOCK, hook_block)
|
||||
uc.count = 0
|
||||
@@ -25,8 +26,9 @@ class MovHang(regress.RegressTest):
|
||||
#print 'block should only run once'
|
||||
uc.emu_start(0x1000, 0x1004, timeout=500)
|
||||
|
||||
self.assertEquals(uc.reg_read(UC_ARM_REG_R12), 0x0)
|
||||
self.assertEquals(uc.count, 1)
|
||||
self.assertEqual(0x0, uc.reg_read(UC_ARM_REG_R12))
|
||||
self.assertEqual(uc.count, 1)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
regress.main()
|
||||
|
||||
Reference in New Issue
Block a user