Changeset 5f6a4a2 in rtems
- Timestamp:
- Jun 10, 2009, 3:28:10 PM (10 years ago)
- Branches:
- 4.10, 4.11, master
- Children:
- 293a0a4
- Parents:
- e050d9a
- Location:
- testsuites/libtests
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
testsuites/libtests/ChangeLog
re050d9a r5f6a4a2 1 2009-06-10 Joel Sherrill <joel.sherrill@OARcorp.com> 2 3 * heapwalk/init.c: Add test code for first free block pointer not 4 aligned. 5 1 6 2009-06-08 Joel Sherrill <joel.sherrill@OARcorp.com> 2 7 -
testsuites/libtests/heapwalk/init.c
re050d9a r5f6a4a2 2 2 * Test of Heap Walker 3 3 * 4 * COPYRIGHT (c) 1989-200 8.4 * COPYRIGHT (c) 1989-2009. 5 5 * On-Line Applications Research Corporation (OAR). 6 6 * … … 33 33 } 34 34 35 void test_heap_walk( int source, bool do_dump ) 35 void test_heap_walk_body( int source, bool do_dump ); 36 37 void test_heap_walk( int source ) 38 { 39 test_heap_walk_body( source, true ); 40 test_heap_walk_body( source, false ); 41 } 42 43 void test_heap_walk_body( int source, bool do_dump ) 36 44 { 37 45 int i, j, original; 38 46 39 47 _Heap_Walk( &TestHeap, source, do_dump ); 40 48 41 49 /* 42 50 * Now corrupt all non-zero values … … 48 56 49 57 /* mark it free -- may or may not have already been */ 50 printf( "%p -- free\n", i ); 51 TestHeapMemory[i] &= ~0x01; 58 TestHeapMemory[i] &= ~0x01; 52 59 _Heap_Walk( &TestHeap, source, do_dump ); 53 60 54 61 /* mark it used -- may or may not have already been */ 55 printf( "%p -- used\n", i ); 56 TestHeapMemory[i] |= 0x01; 62 TestHeapMemory[i] |= 0x01; 57 63 _Heap_Walk( &TestHeap, source, do_dump ); 58 64 65 /* try values of 2-7 in the last three bits -- push alignment issues */ 66 for (j=2 ; j<=7 ; j++) { 67 TestHeapMemory[i] = (TestHeapMemory[i] & ~0x7) | j; 68 _Heap_Walk( &TestHeap, source, do_dump ); 69 } 70 71 59 72 /* try 0 and see what that does */ 60 printf( "%p -- 0x00\n", i ); 61 TestHeapMemory[i] = 0x00; 73 TestHeapMemory[i] = 0x00; 62 74 _Heap_Walk( &TestHeap, source, do_dump ); 63 75 64 76 /* try 0xffffffff and see what that does */ 65 printf( "%p -- 0xff\n", i ); 66 TestHeapMemory[i] = 0xffffffff; 77 TestHeapMemory[i] = 0xffffffff; 67 78 _Heap_Walk( &TestHeap, source, do_dump ); 68 79 … … 75 86 puts( "Walk freshly initialized heap" ); 76 87 test_heap_init(); 77 test_heap_walk(1 , true);88 test_heap_walk(1); 78 89 } 79 90 … … 86 97 puts( "Passing negative value for source" ); 87 98 test_heap_init(); 88 test_heap_walk( -1 , true);99 test_heap_walk( -1 ); 89 100 } 90 101 … … 96 107 */ 97 108 puts( "Calling Heap Walk without initialising" ); 98 test_heap_walk( 1 , true);109 test_heap_walk( 1 ); 99 110 } 100 111 … … 110 121 test_heap_init(); 111 122 TestHeap.page_size = 128; 112 test_heap_walk( -1, true ); 123 test_heap_walk( -1 ); 124 } 125 126 void test_first_block_not_aligned(void) 127 { 128 /* 129 * Hack to get to the error case where the blocks are 130 * not on the page size. We initialize a heap with 131 * default settings and change the page size to something 132 * large. 133 */ 134 puts( "Testing case of blocks not on page size" ); 135 test_heap_init(); 136 _Heap_Head(&TestHeap)->next = (void *)1; 137 test_heap_walk( -1 ); 113 138 } 114 139 … … 129 154 p3 =_Heap_Allocate( &TestHeap, 32 ); 130 155 _Heap_Free( &TestHeap, p2 ); 131 test_heap_walk( -1 , true);156 test_heap_walk( -1 ); 132 157 } 133 158 … … 143 168 test_not_aligned(); 144 169 test_not_in_free_list(); 170 test_first_block_not_aligned(); 145 171 146 172 puts( "*** END OF HEAP WALK TEST ***" );
Note: See TracChangeset
for help on using the changeset viewer.