blob: 5ad6490e6054ccfa3f1f504c63e7af33281d0ec4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
#!/usr/bin/python3-dbg
# -*- coding: utf-8 -*-
import pychrysalide
from chrysacase import ChrysalideTestCase
from pychrysalide.analysis.contents import MemoryContent
from pychrysalide.arch import ArchProcessor
from pychrysalide.arch import ProcContext
from pychrysalide.arch import vmpa
from pychrysalide.format import FlatFormat
class TestProcessor(ChrysalideTestCase):
"""TestCase for arch.ArchProcessor."""
def testGI(self):
"""Validate the GObject introspection."""
with self.assertRaises(RuntimeError):
np = ArchProcessor()
class NewContext(ProcContext):
pass
class NewProc(ArchProcessor):
def _get_context(self):
return NewContext()
def _disassemble(self, ctx, content, pos, format):
return None
np = NewProc()
data = b'\x01\x02\x03\x04'
cnt = MemoryContent(data)
fmt = FlatFormat(cnt)
ctx = np.get_context()
self.assertTrue(type(ctx) == NewContext)
pos = vmpa(0)
ins = np.disassemble(ctx, cnt, pos, fmt)
self.assertIsNone(ins)
|