mirror of
https://github.com/ivellioscolin/pykd.git
synced 2025-04-20 03:23:23 +08:00

[0.2.x] added : getCurrentThreadId routine ( Return TID of the current thread ( user mode only ) ) [0.2.x] added : eventHandler.onExecutionStatusChange method ( Triggered execution status changed ) git-svn-id: https://pykd.svn.codeplex.com/svn@82898 9b283d60-5439-405e-af05-b73fd8c4d996
75 lines
2.7 KiB
Python
75 lines
2.7 KiB
Python
#
|
|
#
|
|
#
|
|
|
|
import sys
|
|
import os
|
|
import unittest
|
|
|
|
# Dynamically append current pykd.pyd path to PYTHONPATH
|
|
sys.path.insert(0, os.path.dirname(sys.argv[1]))
|
|
|
|
import pykd
|
|
|
|
import target
|
|
|
|
import intbase
|
|
import memtest
|
|
import moduletest
|
|
import typeinfo
|
|
import typedvar
|
|
import regtest
|
|
import localstest
|
|
import customtypestest
|
|
import ehexcepttest
|
|
import ehstatustest
|
|
|
|
class StartProcessWithoutParamsTest(unittest.TestCase):
|
|
def testStart(self):
|
|
target.processId = pykd.startProcess( target.appPath )
|
|
target.module = pykd.module( target.moduleName )
|
|
target.module.reload();
|
|
pykd.go()
|
|
|
|
class TerminateProcessTest(unittest.TestCase):
|
|
def testKill(self):
|
|
pykd.killProcess( target.processId )
|
|
pykd.detachProcess( target.processId )
|
|
|
|
def getTestSuite( singleName = "" ):
|
|
if singleName == "":
|
|
return unittest.TestSuite(
|
|
[
|
|
unittest.TestLoader().loadTestsFromTestCase( StartProcessWithoutParamsTest ),
|
|
# *** Test without start/kill new processes
|
|
unittest.TestLoader().loadTestsFromTestCase( intbase.IntBaseTest ),
|
|
unittest.TestLoader().loadTestsFromTestCase( moduletest.ModuleTest ),
|
|
unittest.TestLoader().loadTestsFromTestCase( memtest.MemoryTest ),
|
|
unittest.TestLoader().loadTestsFromTestCase( typeinfo.TypeInfoTest ),
|
|
unittest.TestLoader().loadTestsFromTestCase( typedvar.TypedVarTest ),
|
|
unittest.TestLoader().loadTestsFromTestCase( regtest.CpuRegTest ),
|
|
unittest.TestLoader().loadTestsFromTestCase( customtypestest.CustomTypesTest ),
|
|
# ^^^
|
|
unittest.TestLoader().loadTestsFromTestCase( TerminateProcessTest ),
|
|
|
|
unittest.TestLoader().loadTestsFromTestCase( localstest.LocalVarsTest ),
|
|
unittest.TestLoader().loadTestsFromTestCase( ehexcepttest.EhExceptionTest ),
|
|
unittest.TestLoader().loadTestsFromTestCase( ehstatustest.EhStatusTest ),
|
|
] )
|
|
else:
|
|
return unittest.TestSuite(
|
|
[
|
|
unittest.TestLoader().loadTestsFromTestCase( StartProcessWithoutParamsTest ),
|
|
unittest.TestLoader().loadTestsFromName( singleName ),
|
|
unittest.TestLoader().loadTestsFromTestCase( TerminateProcessTest )
|
|
] )
|
|
|
|
if __name__ == "__main__":
|
|
|
|
print "\nTesting PyKd ver. " + pykd.version
|
|
|
|
target.appPath = sys.argv[1]
|
|
target.moduleName = os.path.splitext(os.path.basename(target.appPath))[0]
|
|
|
|
unittest.TextTestRunner(stream=sys.stdout, verbosity=2).run( getTestSuite() )
|