1
"""Local variables tests"""
9
def testEnumWindowsProc1Locals(testCase, locals):
10
testCase.assertNotEqual( 0, locals["hWindow"] )
12
testCase.assertEqual( DataIsParam, locals["hWindow"].dataKind() )
14
testCase.assertEqual( 6, locals["lParam"] )
15
testCase.assertEqual( DataIsParam, locals["lParam"].dataKind() )
18
testCase.assertNotEqual( 0, locals["dwProccessId"] )
19
testCase.assertEqual( DataIsLocal, locals["dwProccessId"].dataKind() )
22
testCase.assertNotEqual( 0, locals["staticVar"] )
23
testCase.assertEqual( DataIsStaticLocal, locals["staticVar"].dataKind() )
25
testCase.assertEqual( locals["dwProccessId"] + 1, locals["staticVar"] )
28
class LocalVarsTest(unittest.TestCase):
29
def testLocalVariable(self):
30
"""Start new process and test local variables"""
31
_locProcessId = pykd.startProcess( target.appPath + " -testEnumWindows" )
32
with testutils.ContextCallIt( testutils.KillProcess(_locProcessId) ) as killStartedProcess :
36
testEnumWindowsProc1Locals(self, pykd.getLocals())
39
testEnumWindowsProc1Locals(self, pykd.getStack()[1].locals )
42
locals = pykd.getLocals()
43
self.assertEqual( len(locals), 2 )
44
self.assertTrue( locals[0] == 7 or locals[1] == 7 )
46
funcParams = pykd.getParams()
47
self.assertEqual( len(funcParams), 2 )
48
self.assertTrue( funcParams[0] == 7 or funcParams[1] == 7 )