score: Add _Heap_Size_with_overhead()

This commit is contained in:
Sebastian Huber
2014-01-28 11:49:57 +01:00
parent a850d040ab
commit a49bc354a7
3 changed files with 44 additions and 0 deletions

View File

@@ -1157,6 +1157,25 @@ static void test_rtems_heap_allocate_aligned_with_boundary(void)
rtems_test_assert( p == NULL );
}
static void test_heap_size_with_overhead(void)
{
uintptr_t s;
puts( "_Heap_Size_with_overhead" );
s = _Heap_Size_with_overhead(0, 0, 0);
rtems_test_assert(s == HEAP_BLOCK_HEADER_SIZE + CPU_ALIGNMENT - 1);
s = _Heap_Size_with_overhead(CPU_ALIGNMENT, 0, 0);
rtems_test_assert(s == HEAP_BLOCK_HEADER_SIZE + CPU_ALIGNMENT - 1);
s = _Heap_Size_with_overhead(CPU_ALIGNMENT, 0, 2 * CPU_ALIGNMENT);
rtems_test_assert(s == HEAP_BLOCK_HEADER_SIZE + 2 * CPU_ALIGNMENT - 1);
s = _Heap_Size_with_overhead(CPU_ALIGNMENT, 123, 0);
rtems_test_assert(s == HEAP_BLOCK_HEADER_SIZE + CPU_ALIGNMENT - 1 + 123);
}
/*
* A simple test of posix_memalign
*/
@@ -1268,6 +1287,7 @@ rtems_task Init(
test_heap_extend_allocation_order_with_empty_heap();
test_heap_no_extend();
test_heap_info();
test_heap_size_with_overhead();
test_protected_heap_info();
test_rtems_heap_allocate_aligned_with_boundary();
test_greedy_allocate();

View File

@@ -59,6 +59,7 @@ malloc_info - called with NULL
malloc_info - check free space drops after malloc
malloc_info - verify free space returns to previous value
_Heap_Size_with_overhead
_Protected_heap_Get_information - NULL heap
_Protected_heap_Get_information - NULL info
posix_memalign - NULL return pointer -- EINVAL