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,15 +1,19 @@
|
||||
#!/usr/bin/python
|
||||
|
||||
import regress
|
||||
import unicorn as U
|
||||
|
||||
from unicorn import *
|
||||
from unicorn.x86_const import *
|
||||
|
||||
|
||||
class WrongEFLAGS(regress.RegressTest):
|
||||
def test_eflags(self):
|
||||
# xor r14,r14
|
||||
CODE = 'M1\xf6'
|
||||
CODE = b'M1\xf6'
|
||||
|
||||
uc = U.Uc(U.UC_ARCH_X86, U.UC_MODE_64)
|
||||
uc.reg_write(U.x86_const.UC_X86_REG_RIP, 0x6000b0)
|
||||
uc.reg_write(U.x86_const.UC_X86_REG_EFLAGS, 0x200)
|
||||
uc = Uc(UC_ARCH_X86, UC_MODE_64)
|
||||
uc.reg_write(UC_X86_REG_RIP, 0x6000b0)
|
||||
uc.reg_write(UC_X86_REG_EFLAGS, 0x200)
|
||||
|
||||
uc.mem_map(0x600000, 0x1000)
|
||||
uc.mem_write(0x6000b0, CODE)
|
||||
@@ -31,8 +35,9 @@ class WrongEFLAGS(regress.RegressTest):
|
||||
# (gdb) p $eflags
|
||||
# $4 = [ PF ZF IF ]
|
||||
|
||||
self.assertEqual(0x6000b3, uc.reg_read(U.x86_const.UC_X86_REG_RIP))
|
||||
self.assertEqual(0x246, uc.reg_read(U.x86_const.UC_X86_REG_EFLAGS))
|
||||
self.assertEqual(0x6000b3, uc.reg_read(UC_X86_REG_RIP))
|
||||
self.assertEqual(0x246, uc.reg_read(UC_X86_REG_EFLAGS))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
regress.main()
|
||||
|
||||
Reference in New Issue
Block a user