forked from Imagelibrary/rtems
2009-07-09 Joel Sherrill <joel.sherrill@OARcorp.com>
* malloctest/init.c, malloctest/malloctest.scn: Add heap resize test for shrinking a block enough to need to free the newly unused portion.
This commit is contained in:
@@ -1,3 +1,9 @@
|
||||
2009-07-09 Joel Sherrill <joel.sherrill@OARcorp.com>
|
||||
|
||||
* malloctest/init.c, malloctest/malloctest.scn: Add heap resize test
|
||||
for shrinking a block enough to need to free the newly unused
|
||||
portion.
|
||||
|
||||
2009-07-08 Joel Sherrill <joel.sherrill@OARcorp.com>
|
||||
|
||||
* malloctest/init.c, malloctest/malloctest.scn: Add error cases for
|
||||
|
||||
@@ -252,6 +252,25 @@ void test_protected_heap_info(void)
|
||||
rtems_test_assert( rc == false );
|
||||
}
|
||||
|
||||
void test_heap_resize(void)
|
||||
{
|
||||
Heap_Resize_status rc;
|
||||
void *p1;
|
||||
intptr_t oldsize;
|
||||
intptr_t avail;
|
||||
|
||||
puts( "Initialize Test Heap" );
|
||||
test_heap_init();
|
||||
|
||||
puts( "Allocate most of heap" );
|
||||
p1 = _Heap_Allocate( &TestHeap, TEST_HEAP_SIZE - 32 );
|
||||
rtems_test_assert( p1 != NULL );
|
||||
|
||||
puts( "Resize (shrink) the area to 8 bytes to ensure remainder gets freed" );
|
||||
rc = _Heap_Resize_block( &TestHeap, p1, 8, &oldsize, &avail );
|
||||
rtems_test_assert( rc == HEAP_RESIZE_SUCCESSFUL );
|
||||
}
|
||||
|
||||
/*
|
||||
* A simple test of posix_memalign
|
||||
*/
|
||||
@@ -319,6 +338,7 @@ rtems_task Init(
|
||||
test_heap_extend();
|
||||
test_heap_info();
|
||||
test_protected_heap_info();
|
||||
test_heap_resize();
|
||||
|
||||
test_posix_memalign();
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user