2009-05-07 Santosh G Vattam <vattam.santosh@gmail.com>

* malloctest/init.c: Add test case for heap resize block when the
	resize creates a free block large enough to free.
This commit is contained in:
Joel Sherrill
2009-05-07 17:08:28 +00:00
parent d2ec6433fa
commit 8814cf04cc
2 changed files with 24 additions and 0 deletions

View File

@@ -1,3 +1,8 @@
2009-05-07 Santosh G Vattam <vattam.santosh@gmail.com>
* malloctest/init.c: Add test case for heap resize block when the
resize creates a free block large enough to free.
2009-04-03 Ralf Corsépius <ralf.corsepius@rtems.org> 2009-04-03 Ralf Corsépius <ralf.corsepius@rtems.org>
* cpuuse/Makefile.am, malloctest/Makefile.am, * cpuuse/Makefile.am, malloctest/Makefile.am,

View File

@@ -150,6 +150,25 @@ void test_heap_cases_1()
/* XXX what should we expect */ /* XXX what should we expect */
_Heap_Free( &TestHeap, p3 ); _Heap_Free( &TestHeap, p3 );
_Heap_Free( &TestHeap, p4 ); _Heap_Free( &TestHeap, p4 );
_Heap_Free( &TestHeap, p1 );
/*
* To tackle a special case of resizing a block in order to cover the
* code in heapresizeblock.c
*
* Re-initialise the heap, so that the blocks created from now on
* are contiguous.
*/
test_heap_init();
puts( "Heap Initialized" );
p1 = _Heap_Allocate( &TestHeap, 500 );
rtems_test_assert( p2 != NULL );
p2 = _Heap_Allocate( &TestHeap, 500 );
rtems_test_assert( p2 != NULL );
rsc = _Heap_Resize_block( &TestHeap, p1, 256, &u1, &u2 );
rtems_test_assert( rsc == HEAP_RESIZE_SUCCESSFUL );
_Heap_Free( &TestHeap, p1 );
_Heap_Free( &TestHeap, p2 );
} }
void test_heap_extend() void test_heap_extend()