Ignore:
Timestamp:
Jun 8, 2009, 10:49:58 PM (11 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.10, 4.11, master
Children:
e050d9a
Parents:
25686a57
Message:

2009-06-08 Joel Sherrill <joel.sherrill@…>

  • heapwalk/init.c: Add more cases.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • testsuites/libtests/heapwalk/init.c

    r25686a57 r93f4ac26  
    2121#include <string.h>
    2222#include <rtems/score/heap.h>
     23#include <rtems/dumpbuf.h>
    2324
    2425#define TEST_HEAP_SIZE 1024
     
    4748
    4849    /* mark it free -- may or may not have already been */
     50printf( "%p -- free\n", i );
    4951    TestHeapMemory[i] &= ~0x01;   
    5052    _Heap_Walk( &TestHeap, source, do_dump );
    5153
    5254    /* mark it used -- may or may not have already been */
     55printf( "%p -- used\n", i );
    5356    TestHeapMemory[i] |= 0x01;   
    5457    _Heap_Walk( &TestHeap, source, do_dump );
    5558
    5659    /* try 0 and see what that does */
     60printf( "%p -- 0x00\n", i );
    5761    TestHeapMemory[i] = 0x00;   
    5862    _Heap_Walk( &TestHeap, source, do_dump );
    5963
    6064    /* try 0xffffffff and see what that does */
     65printf( "%p -- 0xff\n", i );
    6166    TestHeapMemory[i] = 0xffffffff;   
    6267    _Heap_Walk( &TestHeap, source, do_dump );
     
    7580void test_negative_source_value(void)
    7681{
    77   test_heap_init();
    7882  /*
    7983   * Passing a negative value for source so that
     
    8185   */
    8286  puts( "Passing negative value for source" );
     87  test_heap_init();
    8388  test_heap_walk( -1, true );
    8489}
     
    9196   */
    9297  puts( "Calling Heap Walk without initialising" );
    93   _Heap_Walk( &TestHeap, 0x01, true );
     98  test_heap_walk( 1, true );
     99}
     100
     101void test_not_aligned(void)
     102{
     103  /*
     104   * Hack to get to the error case where the blocks are
     105   * not on the page size.  We initialize a heap with
     106   * default settings and change the page size to something
     107   * large.
     108   */
     109  puts( "Testing case of blocks not on page size" );
     110  test_heap_init();
     111  TestHeap.page_size = 128;
     112  test_heap_walk( -1, true );
     113}
     114
     115void test_not_in_free_list(void)
     116{
     117  void *p1, *p2, *p3;
     118
     119  /*
     120   * Hack to get to the error case where the blocks are
     121   * not on the page size.  We initialize a heap with
     122   * default settings and change the page size to something
     123   * large.
     124   */
     125  puts( "Testing case of blocks not on page size" );
     126  test_heap_init();
     127  p1 =_Heap_Allocate( &TestHeap, 32 );
     128  p2 =_Heap_Allocate( &TestHeap, 32 );
     129  p3 =_Heap_Allocate( &TestHeap, 32 );
     130  _Heap_Free( &TestHeap, p2 );
     131  test_heap_walk( -1, true );
    94132}
    95133
     
    103141  test_walk_freshly_initialized();
    104142  test_negative_source_value();
     143  test_not_aligned();
     144  test_not_in_free_list();
    105145
    106146  puts( "*** END OF HEAP WALK TEST ***" );
Note: See TracChangeset for help on using the changeset viewer.