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:
Eli
2024-10-13 08:14:10 +03:00
committed by GitHub
parent 78580ca8f9
commit 9f578946d5
58 changed files with 1903 additions and 1455 deletions

View File

@@ -1,31 +1,34 @@
#!/usr/bin/env python
from unicorn import *
from unicorn.x86_const import *
from struct import pack
import regress
CODE_ADDR = 0x1000000
from unicorn import *
from unicorn.x86_const import *
CODE = (
'\xb8\x00\x00\x00\x02' # mov eax, 0x2000000
'\xdb\x28' # fldt [eax]
'\xd9\xfa' # fsqrt
b'\xb8\x00\x00\x00\x02' # mov eax, 0x2000000
b'\xdb\x28' # fldt [eax]
b'\xd9\xfa' # fsqrt
)
BASE = 0x1000000
DATA_ADDR = 0x2000000
DATA = '\0\0\0\0\0\0\0\0\0\1'
DATA = b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01'
class FldtFsqrt(regress.RegressTest):
def test_fldt_fsqrt(self):
uc = Uc(UC_ARCH_X86, UC_MODE_32)
uc.mem_map(CODE_ADDR, 0x1000)
uc.mem_write(CODE_ADDR, CODE)
uc.mem_map(BASE, 0x1000)
uc.mem_write(BASE, CODE)
uc.mem_map(DATA_ADDR, 0x1000)
uc.mem_write(DATA_ADDR, DATA)
uc.emu_start(CODE_ADDR, CODE_ADDR + len(CODE), 10000, 10)
uc.emu_start(BASE, BASE + len(CODE), 10000, 10)
if __name__ == '__main__':
regress.main()