diff --git a/testsuites/libtests/ChangeLog b/testsuites/libtests/ChangeLog index 9e218c40bf..2720adecf3 100644 --- a/testsuites/libtests/ChangeLog +++ b/testsuites/libtests/ChangeLog @@ -1,3 +1,7 @@ +2009-06-05 Santosh G Vattam + + * heapwalk/heapwalk.scn, heapwalk/init.c: Add a test case. + 2009-05-19 Chris Johns * cpuuse/tswitch.c: Lower sample count for small memory targets. diff --git a/testsuites/libtests/heapwalk/heapwalk.scn b/testsuites/libtests/heapwalk/heapwalk.scn index 8a1f9cd806..4d41167903 100644 --- a/testsuites/libtests/heapwalk/heapwalk.scn +++ b/testsuites/libtests/heapwalk/heapwalk.scn @@ -1,3 +1,6 @@ *** HEAP WALK TEST *** +Calling Heap Walk without initialising +PASS: 1 !HEAP_PREV_USED flag of 1st block isn't set Walk freshly initialized heap +Passing negative value for source *** END OF HEAP WALK TEST *** diff --git a/testsuites/libtests/heapwalk/init.c b/testsuites/libtests/heapwalk/init.c index 1aeadb4be4..ef7732b905 100644 --- a/testsuites/libtests/heapwalk/init.c +++ b/testsuites/libtests/heapwalk/init.c @@ -33,7 +33,27 @@ void test_walk_freshly_initialized(void) { puts( "Walk freshly initialized heap" ); test_heap_init(); + _Heap_Walk( &TestHeap, 0x01, true ); +} +void test_negative_source_value(void) +{ + test_heap_init(); +/* Passing a negative value for source so that + * the control enters the if block on line 67 + */ + puts( "Passing negative value for source" ); + _Heap_Walk( &TestHeap, -1, true ); + +} + +void test_prev_block_flag_check(void) +{ + /* Calling heapwalk without initialising the heap. + * Covers line 80 and 85 on heapwalk. + * Actually covers more than that. + */ + puts( "Calling Heap Walk without initialising" ); _Heap_Walk( &TestHeap, 0x01, true ); } @@ -43,7 +63,9 @@ rtems_task Init( { puts( "\n\n*** HEAP WALK TEST ***" ); + test_prev_block_flag_check(); test_walk_freshly_initialized(); + test_negative_source_value(); puts( "*** END OF HEAP WALK TEST ***" ); rtems_test_exit(0);