diff options
Diffstat (limited to 'tests/analysis')
-rw-r--r-- | tests/analysis/contents/endian.py | 25 | ||||
-rw-r--r-- | tests/analysis/contents/memory.py | 7 | ||||
-rw-r--r-- | tests/analysis/contents/restricted.py | 21 | ||||
-rw-r--r-- | tests/analysis/disass/block.py | 6 |
4 files changed, 31 insertions, 28 deletions
diff --git a/tests/analysis/contents/endian.py b/tests/analysis/contents/endian.py index 209600a..77ed77a 100644 --- a/tests/analysis/contents/endian.py +++ b/tests/analysis/contents/endian.py @@ -6,6 +6,7 @@ from chrysacase import ChrysalideTestCase +from pychrysalide import arch from pychrysalide.analysis.contents import FileContent, RestrictedContent from pychrysalide.arch import vmpa import tempfile @@ -54,36 +55,36 @@ class TestEndianness(ChrysalideTestCase): start = vmpa(12, vmpa.VMPA_NO_VIRTUAL) - val = fcnt.read_u16(start, vmpa.SRE_LITTLE_WORD) + val = fcnt.read_u16(start, arch.SRE_LITTLE_WORD) self.assertEqual(val, 0x1516) start = vmpa(12, vmpa.VMPA_NO_VIRTUAL) - val = fcnt.read_u16(start, vmpa.SRE_BIG_WORD) + val = fcnt.read_u16(start, arch.SRE_BIG_WORD) self.assertEqual(val, 0x1615) # 32 bits start = vmpa(12, vmpa.VMPA_NO_VIRTUAL) - val = fcnt.read_u32(start, vmpa.SRE_LITTLE_WORD) + val = fcnt.read_u32(start, arch.SRE_LITTLE_WORD) self.assertEqual(val, 0x17181516) start = vmpa(12, vmpa.VMPA_NO_VIRTUAL) - val = fcnt.read_u32(start, vmpa.SRE_BIG_WORD) + val = fcnt.read_u32(start, arch.SRE_BIG_WORD) self.assertEqual(val, 0x16151817) # 64 bits start = vmpa(0, vmpa.VMPA_NO_VIRTUAL) - val = fcnt.read_u64(start, vmpa.SRE_LITTLE_WORD) + val = fcnt.read_u64(start, arch.SRE_LITTLE_WORD) self.assertEqual(val, 0x0708050603040102) start = vmpa(0, vmpa.VMPA_NO_VIRTUAL) - val = fcnt.read_u64(start, vmpa.SRE_BIG_WORD) + val = fcnt.read_u64(start, arch.SRE_BIG_WORD) self.assertEqual(val, 0x0201040306050807) @@ -96,34 +97,34 @@ class TestEndianness(ChrysalideTestCase): start = vmpa(12, vmpa.VMPA_NO_VIRTUAL) - val = fcnt.read_u16(start, vmpa.SRE_LITTLE) + val = fcnt.read_u16(start, arch.SRE_LITTLE) self.assertEqual(val, 0x1615) start = vmpa(12, vmpa.VMPA_NO_VIRTUAL) - val = fcnt.read_u16(start, vmpa.SRE_BIG) + val = fcnt.read_u16(start, arch.SRE_BIG) self.assertEqual(val, 0x1516) # 32 bits start = vmpa(12, vmpa.VMPA_NO_VIRTUAL) - val = fcnt.read_u32(start, vmpa.SRE_LITTLE) + val = fcnt.read_u32(start, arch.SRE_LITTLE) self.assertEqual(val, 0x18171615) start = vmpa(12, vmpa.VMPA_NO_VIRTUAL) - val = fcnt.read_u32(start, vmpa.SRE_BIG) + val = fcnt.read_u32(start, arch.SRE_BIG) self.assertEqual(val, 0x15161718) # 64 bits start = vmpa(0, vmpa.VMPA_NO_VIRTUAL) - val = fcnt.read_u64(start, vmpa.SRE_LITTLE) + val = fcnt.read_u64(start, arch.SRE_LITTLE) self.assertEqual(val, 0x0807060504030201) start = vmpa(0, vmpa.VMPA_NO_VIRTUAL) - val = fcnt.read_u64(start, vmpa.SRE_BIG) + val = fcnt.read_u64(start, arch.SRE_BIG) self.assertEqual(val, 0x0102030405060708) diff --git a/tests/analysis/contents/memory.py b/tests/analysis/contents/memory.py index e8ba6b5..55ce035 100644 --- a/tests/analysis/contents/memory.py +++ b/tests/analysis/contents/memory.py @@ -7,6 +7,7 @@ from chrysacase import ChrysalideTestCase +from pychrysalide import arch from pychrysalide.analysis.contents import MemoryContent from pychrysalide.arch import vmpa, mrange @@ -38,12 +39,12 @@ class TestMemoryContent(ChrysalideTestCase): start = vmpa(14, vmpa.VMPA_NO_VIRTUAL) - val = cnt.read_u16(start, vmpa.SRE_LITTLE) + val = cnt.read_u16(start, arch.SRE_LITTLE) self.assertEqual(val, 0x1817) start = vmpa(10, vmpa.VMPA_NO_VIRTUAL) - val = cnt.read_u32(start, vmpa.SRE_LITTLE) + val = cnt.read_u32(start, arch.SRE_LITTLE) self.assertEqual(val, 0x16150013) @@ -62,4 +63,4 @@ class TestMemoryContent(ChrysalideTestCase): with self.assertRaisesRegex(Exception, 'Invalid read access.'): start = vmpa(0, vmpa.VMPA_NO_VIRTUAL) - val = cnt.read_u16(start, vmpa.SRE_LITTLE) + val = cnt.read_u16(start, arch.SRE_LITTLE) diff --git a/tests/analysis/contents/restricted.py b/tests/analysis/contents/restricted.py index 6484299..08aa968 100644 --- a/tests/analysis/contents/restricted.py +++ b/tests/analysis/contents/restricted.py @@ -7,6 +7,7 @@ from chrysacase import ChrysalideTestCase +from pychrysalide import arch from pychrysalide.analysis.contents import FileContent, RestrictedContent from pychrysalide.arch import vmpa, mrange import tempfile @@ -63,10 +64,10 @@ class TestRestrictedContent(ChrysalideTestCase): val = rcnt.read_u8(start) self.assertEqual(val, 0x16) - val = rcnt.read_u16(start, vmpa.SRE_LITTLE) + val = rcnt.read_u16(start, arch.SRE_LITTLE) self.assertEqual(val, 0x1817) - val = rcnt.read_u32(start, vmpa.SRE_LITTLE) + val = rcnt.read_u32(start, arch.SRE_LITTLE) self.assertEqual(val, 0x24232221) @@ -110,15 +111,15 @@ class TestRestrictedContent(ChrysalideTestCase): self.assertEqual(val, 0x15) start = vmpa(12, vmpa.VMPA_NO_VIRTUAL) - val = rcnt.read_u16(start, vmpa.SRE_LITTLE) + val = rcnt.read_u16(start, arch.SRE_LITTLE) self.assertEqual(val, 0x1615) start = vmpa(12, vmpa.VMPA_NO_VIRTUAL) - val = rcnt.read_u32(start, vmpa.SRE_LITTLE) + val = rcnt.read_u32(start, arch.SRE_LITTLE) self.assertEqual(val, 0x18171615) start = vmpa(12, vmpa.VMPA_NO_VIRTUAL) - val = rcnt.read_u64(start, vmpa.SRE_LITTLE) + val = rcnt.read_u64(start, arch.SRE_LITTLE) self.assertEqual(val, 0x2423222118171615) start = vmpa(23, vmpa.VMPA_NO_VIRTUAL) @@ -126,15 +127,15 @@ class TestRestrictedContent(ChrysalideTestCase): self.assertEqual(val, 0x28) start = vmpa(22, vmpa.VMPA_NO_VIRTUAL) - val = rcnt.read_u16(start, vmpa.SRE_LITTLE) + val = rcnt.read_u16(start, arch.SRE_LITTLE) self.assertEqual(val, 0x2827) start = vmpa(20, vmpa.VMPA_NO_VIRTUAL) - val = rcnt.read_u32(start, vmpa.SRE_LITTLE) + val = rcnt.read_u32(start, arch.SRE_LITTLE) self.assertEqual(val, 0x28272625) start = vmpa(16, vmpa.VMPA_NO_VIRTUAL) - val = rcnt.read_u64(start, vmpa.SRE_LITTLE) + val = rcnt.read_u64(start, arch.SRE_LITTLE) self.assertEqual(val, 0x2827262524232221) @@ -201,9 +202,9 @@ class TestRestrictedContent(ChrysalideTestCase): with self.assertRaisesRegex(Exception, 'Invalid read access.'): start = vmpa(11, vmpa.VMPA_NO_VIRTUAL) - val = rcnt.read_u16(start, vmpa.SRE_LITTLE) + val = rcnt.read_u16(start, arch.SRE_LITTLE) with self.assertRaisesRegex(Exception, 'Invalid read access.'): start = vmpa(23, vmpa.VMPA_NO_VIRTUAL) - val = rcnt.read_u16(start, vmpa.SRE_LITTLE) + val = rcnt.read_u16(start, arch.SRE_LITTLE) diff --git a/tests/analysis/disass/block.py b/tests/analysis/disass/block.py index 8de44e1..1663150 100644 --- a/tests/analysis/disass/block.py +++ b/tests/analysis/disass/block.py @@ -26,7 +26,7 @@ class TestBasicBlocks(ChrysalideTestCase): fullname = sys.modules[cls.__module__].__file__ dirpath = os.path.dirname(fullname) - os.system('make -C %s hello 2>&1 > /dev/null' % dirpath) + os.system('make -C %s hello > /dev/null 2>&1' % dirpath) @classmethod @@ -39,7 +39,7 @@ class TestBasicBlocks(ChrysalideTestCase): fullname = sys.modules[cls.__module__].__file__ dirpath = os.path.dirname(fullname) - os.system('make -C %s clean 2>&1 > /dev/null' % dirpath) + os.system('make -C %s clean > /dev/null 2>&1' % dirpath) def testBlockList(self): @@ -67,7 +67,7 @@ class TestBasicBlocks(ChrysalideTestCase): found = sym.basic_blocks.find_by_starting_addr(sym.range.addr) self.assertIsNotNone(found) - self.assertEqual(found, sym.basic_blocks.items[0]) + self.assertEqual(found, list(sym.basic_blocks)[0]) self.assertEqual(found.index, 0) |