* heapwalk/heapwalk.scn, heapwalk/init.c: Add missing _Heap_Walk test
	cases to get back to 100% object coverage.
This commit is contained in:
Joel Sherrill
2009-09-09 16:30:14 +00:00
parent 809fb589fc
commit b2f05456e3
3 changed files with 20 additions and 11 deletions

View File

@@ -1,3 +1,8 @@
2009-09-09 Sebastian Huber <Sebastian.Huber@embedded-brains.de>
* heapwalk/heapwalk.scn, heapwalk/init.c: Add missing _Heap_Walk test
cases to get back to 100% object coverage.
2009-09-09 Christian Mauderer <christian.mauderer@embedded-brains.de> 2009-09-09 Christian Mauderer <christian.mauderer@embedded-brains.de>
* heapwalk/init.c, heapwalk/heapwalk.scn, malloctest/init.c, * heapwalk/init.c, heapwalk/heapwalk.scn, malloctest/init.c,

View File

@@ -4,7 +4,7 @@ testing the _Heap_Walk_check_control() function
test what happens if page size = 0 test what happens if page size = 0
set page size to a not CPU-aligned value set page size to a not CPU-aligned value
set minimal block size to a not page aligned value set minimal block size to a not page aligned value
let the alloc area of the first block be not page-aligned set allocation area of the first block to be non page-aligned
clear the previous used flag of the first block clear the previous used flag of the first block
set the previous block size of the first block to an invalid value set the previous block size of the first block to an invalid value
set invalid next block for last block set invalid next block for last block
@@ -21,6 +21,7 @@ Test the main loop
create a block with a not page aligned size create a block with a not page aligned size
create a block with a size smaller than the min_block_size create a block with a size smaller than the min_block_size
make a block with a size, so that the block reaches into the next block make a block with a size, so that the block reaches into the next block
create a block with invalid successor
make a block with a size, so that it includes the next block make a block with a size, so that it includes the next block
test the _Heap_Walk_check_free_block() function test the _Heap_Walk_check_free_block() function
set a previous size for the next block which is not equal to the size of the actual block set a previous size for the next block which is not equal to the size of the actual block
@@ -29,8 +30,8 @@ test the _Heap_Walk_check_free_block() function
test the output-function for the _Heap_Walk() test the output-function for the _Heap_Walk()
therefore use the (already tested) case with a page size of 0 therefore use the (already tested) case with a page size of 0
PASS[0]: page size 0, min block size 16 PASS[0]: page size 0, min block size 16
area begin 0x????????, area end 0x???????? area begin 0x0202C4BC, area end 0x0202D4BC
first block 0x????????, last block 0x???????? first block 0x0202C4C0, last block 0x0202D4B0
first free 0x????????, last free 0x???????? first free 0x0202C4C0, last free 0x0202C4C0
FAIL[0]: page size is zero FAIL[0]: page size is zero
*** END OF HEAP WALK TEST *** *** END OF HEAP WALK TEST ***

View File

@@ -117,14 +117,9 @@ static void test_check_control(void)
TestHeap.min_block_size = TEST_DEFAULT_PAGESIZE / 2; TestHeap.min_block_size = TEST_DEFAULT_PAGESIZE / 2;
test_call_heap_walk( false ); test_call_heap_walk( false );
/* puts( "\tset allocation area of the first block to be non page-aligned" );
* Set the page size to a value, other than the first block alloc area. Set
* even the min_block_size to that value to avoid it being not alligned.
*/
puts( "\tlet the alloc area of the first block be not page-aligned" );
test_heap_init_custom(); test_heap_init_custom();
TestHeap.page_size = (uintptr_t) TestHeap.first_block + CPU_ALIGNMENT; TestHeap.first_block = (Heap_Block *) ((char *) TestHeap.first_block + CPU_ALIGNMENT);
TestHeap.min_block_size = TestHeap.page_size;
test_call_heap_walk( false ); test_call_heap_walk( false );
puts( "\tclear the previous used flag of the first block" ); puts( "\tclear the previous used flag of the first block" );
@@ -250,6 +245,14 @@ static void test_main_loop(void)
block->size_and_flag = ( 3 * _Heap_Block_size( block ) / 2 ) | HEAP_PREV_BLOCK_USED; block->size_and_flag = ( 3 * _Heap_Block_size( block ) / 2 ) | HEAP_PREV_BLOCK_USED;
test_call_heap_walk( false ); test_call_heap_walk( false );
puts( "\tcreate a block with invalid successor" );
test_heap_init_default();
test_allocate_block();
p1 = test_allocate_block();
block = _Heap_Block_of_alloc_area( (uintptr_t) p1, TestHeap.page_size );
block->size_and_flag = (0 - TestHeap.page_size) | HEAP_PREV_BLOCK_USED;
test_call_heap_walk( false );
puts( "\tmake a block with a size, so that it includes the next block" ); puts( "\tmake a block with a size, so that it includes the next block" );
test_heap_init_default(); test_heap_init_default();
p1 = test_allocate_block(); p1 = test_allocate_block();