Skip to content

Commit

Permalink
Update DOS tests
Browse files Browse the repository at this point in the history
  • Loading branch information
elicn committed Mar 19, 2021
1 parent 1f29790 commit 393bd90
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
22 changes: 21 additions & 1 deletion tests/test_dos.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,32 @@
sys.path.append('..')

from qiling import Qiling
from qiling.const import QL_INTERCEPT

class Checklist:
def __init__(self) -> None:
self.visited_onenter = False
self.visited_onexit = False

class DOSTest(unittest.TestCase):

def test_dos_8086_hello(self):
ql = Qiling(["../examples/rootfs/8086/dos/HI.DOS_COM"], "../examples/rootfs/8086/dos")
ql = Qiling(["../examples/rootfs/8086/dos/HI.DOS_COM"], "../examples/rootfs/8086/dos", output='debug')
ck = Checklist()

def onenter(ql: Qiling):
ck.visited_onenter = True

def onexit(ql: Qiling):
ck.visited_onexit = True

ql.set_api((0x21, 0x09), onexit, QL_INTERCEPT.EXIT)
ql.set_api((0x21, 0x4c), onenter, QL_INTERCEPT.ENTER)

ql.run()

self.assertTrue(ck.visited_onenter)
self.assertTrue(ck.visited_onexit)

if __name__ == "__main__":
unittest.main()
2 changes: 1 addition & 1 deletion tests/test_dos_exe.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@

class DOSTest(unittest.TestCase):

# TODO: missing implemention of INT 3Ch and INT 03h
def test_dos_8086_hello(self):
ql = Qiling(["../examples/rootfs/8086/dos/ARKA.DOS_EXE"], "../examples/rootfs/8086/dos")
ql.run()
del ql

if __name__ == "__main__":
unittest.main()

0 comments on commit 393bd90

Please sign in to comment.