summaryrefslogtreecommitdiffstats
path: root/testsuites
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2011-03-09 15:39:58 +0000
committerSebastian Huber <sebastian.huber@embedded-brains.de>2011-03-09 15:39:58 +0000
commitce217f969911ea27d963f572b2a76cde4a86c323 (patch)
treec30433510a90afd75426e727227562a65fb7b157 /testsuites
parent2011-03-08 Joel Sherrill <joel.sherrilL@OARcorp.com> (diff)
downloadrtems-ce217f969911ea27d963f572b2a76cde4a86c323.tar.bz2
2011-03-09 Sebastian Huber <sebastian.huber@embedded-brains.de>
* malloctest/init.c: Improve coverage. * malloctest/malloctest.scn: Update.
Diffstat (limited to 'testsuites')
-rw-r--r--testsuites/libtests/ChangeLog5
-rw-r--r--testsuites/libtests/malloctest/init.c24
-rw-r--r--testsuites/libtests/malloctest/malloctest.scn9
3 files changed, 29 insertions, 9 deletions
diff --git a/testsuites/libtests/ChangeLog b/testsuites/libtests/ChangeLog
index e52fcb088d..68e59c2e26 100644
--- a/testsuites/libtests/ChangeLog
+++ b/testsuites/libtests/ChangeLog
@@ -1,3 +1,8 @@
+2011-03-09 Sebastian Huber <sebastian.huber@embedded-brains.de>
+
+ * malloctest/init.c: Improve coverage.
+ * malloctest/malloctest.scn: Update.
+
2011-02-22 Ralf Corsépius <ralf.corsepius@rtems.org>
* configure.ac: Add AC_CONFIG_HEADER(config.h).
diff --git a/testsuites/libtests/malloctest/init.c b/testsuites/libtests/malloctest/init.c
index 791e172626..35cb0c7f72 100644
--- a/testsuites/libtests/malloctest/init.c
+++ b/testsuites/libtests/malloctest/init.c
@@ -940,32 +940,42 @@ static void test_heap_assert(bool ret, bool expected)
static void test_heap_extend(void)
{
bool ret = false;
+ Heap_Control *heap = &TestHeap;
+ uint8_t *area_begin = TestHeapMemory;
- _Heap_Initialize( &TestHeap, TestHeapMemory + 768, 256, 0 );
+ _Heap_Initialize( heap, area_begin + 768, 256, 0 );
puts( "heap extend - link below" );
- ret = _Protected_heap_Extend( &TestHeap, TestHeapMemory + 0, 256 );
+ ret = _Protected_heap_Extend( heap, area_begin + 0, 256 );
test_heap_assert( ret, true );
puts( "heap extend - merge below" );
- ret = _Protected_heap_Extend( &TestHeap, TestHeapMemory + 512, 256 );
+ ret = _Protected_heap_Extend( heap, area_begin + 512, 256 );
test_heap_assert( ret, true );
puts( "heap extend - merge above" );
- ret = _Protected_heap_Extend( &TestHeap, TestHeapMemory + 1024, 256 );
+ ret = _Protected_heap_Extend( heap, area_begin + 1024, 256 );
test_heap_assert( ret, true );
puts( "heap extend - link above" );
- ret = _Protected_heap_Extend( &TestHeap, TestHeapMemory + 1536, 256 );
+ ret = _Protected_heap_Extend( heap, area_begin + 1536, 256 );
test_heap_assert( ret, true );
puts( "heap extend - area too small" );
- ret = _Protected_heap_Extend( &TestHeap, TestHeapMemory + 2048, 0 );
+ ret = _Protected_heap_Extend( heap, area_begin + 2048, 0 );
test_heap_assert( ret, false );
puts( "heap extend - invalid area" );
- ret = _Protected_heap_Extend( &TestHeap, (void *) -1, 2 );
+ ret = _Protected_heap_Extend( heap, (void *) -1, 2 );
test_heap_assert( ret, false );
+
+ area_begin = (uint8_t *) (((uintptr_t) area_begin) | 1);
+
+ _Heap_Initialize( heap, area_begin + 768, 256, 0 );
+
+ puts( "heap extend - merge below with align up" );
+ ret = _Protected_heap_Extend( heap, area_begin + 512, 256 );
+ test_heap_assert( ret, true );
}
static void test_heap_info(void)
diff --git a/testsuites/libtests/malloctest/malloctest.scn b/testsuites/libtests/malloctest/malloctest.scn
index 7e46ac0c18..ba0e19d999 100644
--- a/testsuites/libtests/malloctest/malloctest.scn
+++ b/testsuites/libtests/malloctest/malloctest.scn
@@ -44,8 +44,13 @@ run tests for _Heap_Resize_Block()
malloc_walk - normal path
malloc_walk - in critical section path
Heap Initialized
-heap extend - bad address
-heap extend - OK
+heap extend - link below
+heap extend - merge below
+heap extend - merge above
+heap extend - link above
+heap extend - area too small
+heap extend - invalid area
+heap extend - merge below with align up
malloc_free_space - check malloc space drops after malloc
malloc_free_space - verify free space returns to previous value
malloc_info - called with NULL