Changeset 1097
- Timestamp:
- Jun 25, 2004, 11:51:46 AM (22 years ago)
- Location:
- trunk/psLib/test/sysUtils
- Files:
-
- 2 edited
-
tst_psMemory.c (modified) (4 diffs)
-
verified/tst_psMemory.stderr (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/test/sysUtils/tst_psMemory.c
r1075 r1097 6 6 * @author Robert DeSonia, MHPCC 7 7 * 8 * @version $Revision: 1.1 7$ $Name: not supported by cvs2svn $9 * @date $Date: 2004-06-2 4 00:54:59$8 * @version $Revision: 1.18 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2004-06-25 21:51:46 $ 10 10 * 11 11 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 28 28 static int TPFreeReferencedMemory(void); 29 29 static int TPOutOfMemory(void); 30 static int TPReallocOutOfMemory(void); 30 31 static void* TPOutOfMemoryExhaustedCallback(size_t size); 31 32 static int TPCheckBufferPositive(void); … … 46 47 {TPCheckBufferPositive,"449-TPCheckBufferPositive",0}, 47 48 {TPOutOfMemory,"450-TPOutOfMemory",-6}, 49 {TPReallocOutOfMemory,"562-TPReallocOutOfMemory",-6}, 48 50 {TPrealloc,"451-TPrealloc",0}, 49 51 {TPallocCallback,"452/453-TPallocCallback",0}, … … 145 147 } 146 148 149 // Bug/Task #562 regression test. Upon requesting more memory than is available, psRealloc shall call 150 // the psMemExhaustedCallback. 151 int TPReallocOutOfMemory(void) 152 { 153 int* mem[100]; 154 psMemExhaustedCallback cb; 155 156 for (int lcv = 0; lcv<100; lcv++) { 157 mem[lcv] = NULL; 158 } 159 160 psLogMsg(__func__,PS_LOG_INFO,"Upon requesting more memory than is available, psRealloc shall call " 161 "the psMemExhaustedCallback.\n"); 162 163 exhaustedCallbackCalled = 0; 164 165 cb = psMemExhaustedCallbackSet(TPOutOfMemoryExhaustedCallback); 166 167 for (int lcv = 0; lcv<100; lcv++) { 168 mem[lcv] = (int*) psAlloc(10); 169 } 170 171 for (int lcv = 0; lcv<100; lcv++) { 172 mem[lcv] = (int*) psRealloc(mem[lcv],SIZE_MAX-1000); 173 } 174 175 psMemExhaustedCallbackSet(cb); 176 177 if (exhaustedCallbackCalled == 0) { 178 psError(__FILE__,"Called psRealloc with HUGE memory requirement and survived in %s!",__func__); 179 return 1; 180 } 181 182 for (int lcv = 0; lcv<100; lcv++) { 183 psFree(mem[lcv]); 184 } 185 186 return 0; 187 } 147 188 // Testpoint #450, Upon requesting more memory than is available, psalloc shall call 148 189 // the psMemExhaustedCallback. -
trunk/psLib/test/sysUtils/verified/tst_psMemory.stderr
r1075 r1097 17 17 <DATE> <TIME> <HOST> |I| TPOutOfMemory|Upon requesting more memory than is available, psalloc shall call the psMemExhaustedCallback. 18 18 <DATE> <TIME> <HOST> |I|TPOutOfMemoryEx|Custom MemExhaustedCallback was invoked. 19 <DATE> <TIME> <HOST> |A| p_psAlloc|Failed to allocate 4294966295 bytes at tst_psMemory.c: 16619 <DATE> <TIME> <HOST> |A| p_psAlloc|Failed to allocate 4294966295 bytes at tst_psMemory.c:207 20 20 21 21 ---> TESTPOINT PASSED (psMemory{450-TPOutOfMemory} | tst_psMemory.c) 22 23 /***************************** TESTPOINT ******************************************\ 24 * TestFile: tst_psMemory.c * 25 * TestPoint: psMemory{562-TPReallocOutOfMemory} * 26 * TestType: Positive * 27 \**********************************************************************************/ 28 29 <DATE> <TIME> <HOST> |I|TPReallocOutOfM|Upon requesting more memory than is available, psRealloc shall call the psMemExhaustedCallback. 30 <DATE> <TIME> <HOST> |I|TPOutOfMemoryEx|Custom MemExhaustedCallback was invoked. 31 <DATE> <TIME> <HOST> |A| p_psRealloc|Failed to reallocate -1001 bytes at tst_psMemory.c:172 32 33 ---> TESTPOINT PASSED (psMemory{562-TPReallocOutOfMemory} | tst_psMemory.c) 22 34 23 35 /***************************** TESTPOINT ******************************************\ … … 59 71 <DATE> <TIME> <HOST> |I| TPcheckLeaks|following psMemCheckLeaks call should produce one instance. 60 72 file:line ID 61 tst_psMemory.c:3 16173 tst_psMemory.c:357 1 62 74 <DATE> <TIME> <HOST> |I| TPcheckLeaks|Testing psMemCheckLeaks again with a different leak location 63 75 <DATE> <TIME> <HOST> |I| TPcheckLeaks|following psMemCheckLeaks call should produce one error. 64 76 file:line ID 65 tst_psMemory.c:3 461177 tst_psMemory.c:387 11 66 78 <DATE> <TIME> <HOST> |I| TPcheckLeaks|Testing psMemCheckLeaks again with multiple leak locations. 67 79 <DATE> <TIME> <HOST> |I| TPcheckLeaks|following psMemCheckLeaks call should produce two errors. 68 80 file:line ID 69 tst_psMemory.c: 3741670 tst_psMemory.c: 3741481 tst_psMemory.c:415 16 82 tst_psMemory.c:415 14 71 83 72 84 ---> TESTPOINT PASSED (psMemory{454-TPcheckLeaks} | tst_psMemory.c) … … 81 93 <DATE> <TIME> <HOST> |I|TPmemCorruption|psMemCheckCorruption should output an error message and memProblemCallback callback should be called. 82 94 <DATE> <TIME> <HOST> |E|psMemCheckCorru|psMemCheckCorruption: memory block 1 is corrupted (buffer underflow) 83 <DATE> <TIME> <HOST> |I|memProblemCallb|memory callback called for id 1 (psMemCheckCorruption:22 6).95 <DATE> <TIME> <HOST> |I|memProblemCallb|memory callback called for id 1 (psMemCheckCorruption:221). 84 96 85 97 ---> TESTPOINT PASSED (psMemory{455-TPmemCorruption} | tst_psMemory.c)
Note:
See TracChangeset
for help on using the changeset viewer.
