[rtems commit] libtests/malloctest: Add test case
Sebastian Huber
sebh at rtems.org
Sat Dec 22 15:24:47 UTC 2012
Module: rtems
Branch: master
Commit: d8efe3dc71d881ccf99bde5d803778286b71dbf6
Changeset: http://git.rtems.org/rtems/commit/?id=d8efe3dc71d881ccf99bde5d803778286b71dbf6
Author: Sebastian Huber <sebastian.huber at embedded-brains.de>
Date: Sat Dec 22 16:28:26 2012 +0100
libtests/malloctest: Add test case
---
testsuites/libtests/malloctest/init.c | 24 ++++++++++++++++++++++++
1 files changed, 24 insertions(+), 0 deletions(-)
diff --git a/testsuites/libtests/malloctest/init.c b/testsuites/libtests/malloctest/init.c
index f783924..008377c 100644
--- a/testsuites/libtests/malloctest/init.c
+++ b/testsuites/libtests/malloctest/init.c
@@ -1147,6 +1147,29 @@ static void test_posix_memalign(void)
}
+static void test_greedy_allocate(void)
+{
+ Heap_Control *heap = &TestHeap;
+ uintptr_t block_size = 1;
+ void *p;
+
+ _Heap_Initialize( heap, &TestHeapMemory[0], sizeof(TestHeapMemory), 0 );
+
+ _Heap_Greedy_allocate( heap, &block_size, 1 );
+
+ p = _Heap_Allocate( heap, 1 );
+ rtems_test_assert( p != NULL );
+
+ p = _Heap_Allocate( heap, 1 );
+ rtems_test_assert( p == NULL );
+
+ /* The internal allocation fails */
+ _Heap_Greedy_allocate( heap, &block_size, 1 );
+
+ p = _Heap_Allocate( heap, 1 );
+ rtems_test_assert( p == NULL );
+}
+
rtems_task Init(
rtems_task_argument argument
)
@@ -1194,6 +1217,7 @@ rtems_task Init(
test_heap_info();
test_protected_heap_info();
test_rtems_heap_allocate_aligned_with_boundary();
+ test_greedy_allocate();
test_posix_memalign();
More information about the vc
mailing list