def test_search(self): import ctypes from test.src import ctypes7 self.assertEquals(ctypes.sizeof(ctypes7.struct_Node), 16) self.assertEquals(len(ctypes7.struct_Node.expectedValues.keys()), 2) retstr = abouchet.search_struct_dumpname( self.classname, self.memdumpname, rtype='string') self.assertIn("3735928559L,", retstr) self.assertIn("struct_Node at 0x%x>" % (self.address), retstr) self.assertIn('"ptr2": 0x%016x' % (self.address), retstr) # python results = abouchet.search_struct_dumpname( self.classname, self.memdumpname, rtype='python') self.assertEquals(len(results), 1) for node, offset in results: self.assertEquals(offset, self.address) self.assertEquals(node.val1, 0xdeadbeef) #self.assertEquals(node.ptr2, self.address) self.assertIsNone(node.ptr2) return # python results = abouchet.search_struct_dumpname( self.classname, self.memdumpname, maxnum=10, rtype='python') self.assertEquals(len(results), 1) for node, offset in results: self.assertEquals(offset, self.address) self.assertEquals(node.val1, 0xdeadbeef) #self.assertEquals(node.ptr2, self.address) self.assertIsNone(node.ptr2) return
def test_search(self): if True: import ctypes self.assertIn('CTypesProxy-8:8:16', '%s' % ctypes) self.assertEquals(ctypes.sizeof(ctypes.c_long), 8) from test.src import ctypes6 self.assertEquals(len(ctypes6.struct_Node.expectedValues.keys()), 2) retstr = abouchet.search_struct_dumpname( self.node_structname, self.memdumpname, rtype='string') self.assertIn("3735928559L,", retstr) # 0xdeadbeef self.assertIn(hex(self.address2), retstr) # python results = abouchet.search_struct_dumpname( self.node_structname, self.memdumpname, rtype='python') self.assertEquals(len(results), 1) # python nultiple results results = abouchet.search_struct_dumpname( self.node_structname, self.memdumpname, maxnum=10, rtype='python') self.assertEquals(len(results), 2) (node1, offset1), (node2, offset2) = results self.assertEquals(node1.val1, 0xdeadbeef) self.assertEquals(node1.val2, 0xffffffff) self.assertEquals(node2.val1, 0xdeadbabe) self.assertEquals(node2.val2, 0xffffffff) if True: import ctypes self.assertIn('CTypesProxy-8:8:16', '%s' % ctypes) self.assertEquals(ctypes.sizeof(ctypes.c_long), 8) return