Skip to content

Commit

Permalink
fix TU
Browse files Browse the repository at this point in the history
  • Loading branch information
trolldbois committed Jan 23, 2016
1 parent c44e280 commit d7eb927
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions test/haystack/allocators/win32/test_win7walker.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

from test.testfiles import putty_1_win7

log = logging.getLogger('testwalker')
log = logging.getLogger('testwin7walker')


class TestWin7HeapWalker(unittest.TestCase):
Expand Down Expand Up @@ -40,7 +40,7 @@ def tearDown(self):
def test_freelists(self):
""" List all free blocks """

# TODO test 0x0061a000 for overflow
# FIXME: the sum calculation is per segment, not per mapping.

self.assertNotEqual(self._memory_handler, None)
# test the heaps
Expand Down Expand Up @@ -90,10 +90,14 @@ def test_freelists(self):

maxlen = len(heap)
cheap = walker.get_heap()
self.assertEquals(cheap.TotalFreeSize * 8, total)
log.debug(
'heap: 0x%0.8x free: %0.5x \texpected: %0.5x \tmmap len:%0.5x' %
(heap.start, total, cheap.TotalFreeSize, maxlen))
#if cheap.FrontEndHeapType == 0:
self.assertEquals(cheap.TotalFreeSize * 8, total)
#else:
# # FIXME
# log.warning('we are not good ar handling 64 b heaps :FH,. backend')

return

Expand All @@ -103,8 +107,11 @@ def test_sorted_heaps(self):
finder = win7heapwalker.Win7HeapFinder(self._memory_handler)
walkers = finder.list_heap_walkers()
self.assertEquals(len(walkers), len(putty_1_win7.known_heaps))
last = 0
for i, walker in enumerate(walkers):
self.assertEquals(walker.get_heap().ProcessHeapsListIndex, i + 1, 'ProcessHeaps should have correct indexes')
this = walker.get_heap_address()
self.assertLess(last, this, "Heaps are ordered by base address")
last = this
return

def test_get_frontendheap(self):
Expand Down Expand Up @@ -393,6 +400,7 @@ def test_get_user_allocations(self):
if __name__ == '__main__':
logging.basicConfig(stream=sys.stderr, level=logging.INFO)
# logging.basicConfig(stream=sys.stderr, level=logging.DEBUG)
logging.getLogger('testwin7walker').setLevel(level=logging.DEBUG)
unittest.main(verbosity=2)
#suite = unittest.TestLoader().loadTestsFromTestCase(TestFunctions)
# unittest.TextTestRunner(verbosity=2).run(suite)

0 comments on commit d7eb927

Please sign in to comment.