diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2014-01-28 11:49:57 +0100 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2014-02-04 10:06:34 +0100 |
commit | a49bc354a77f7710fcfa7995e18107170d32eb70 (patch) | |
tree | 55660903659862a0d481ee6db136154437c02c6f /testsuites | |
parent | score: Add _Workspace_Allocate_aligned() (diff) | |
download | rtems-a49bc354a77f7710fcfa7995e18107170d32eb70.tar.bz2 |
score: Add _Heap_Size_with_overhead()
Diffstat (limited to 'testsuites')
-rw-r--r-- | testsuites/libtests/malloctest/init.c | 20 | ||||
-rw-r--r-- | testsuites/libtests/malloctest/malloctest.scn | 1 |
2 files changed, 21 insertions, 0 deletions
diff --git a/testsuites/libtests/malloctest/init.c b/testsuites/libtests/malloctest/init.c index ace454f69d..0cdbe844f4 100644 --- a/testsuites/libtests/malloctest/init.c +++ b/testsuites/libtests/malloctest/init.c @@ -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(); diff --git a/testsuites/libtests/malloctest/malloctest.scn b/testsuites/libtests/malloctest/malloctest.scn index dcb529ddb8..ec684c6f1f 100644 --- a/testsuites/libtests/malloctest/malloctest.scn +++ b/testsuites/libtests/malloctest/malloctest.scn @@ -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 |