Changeset 2273 for trunk/psLib/test/sysUtils
- Timestamp:
- Nov 3, 2004, 3:05:00 PM (22 years ago)
- Location:
- trunk/psLib/test/sysUtils
- Files:
-
- 2 edited
-
tst_psError.c (modified) (10 diffs)
-
tst_psMemory.c (modified) (17 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/test/sysUtils/tst_psError.c
r2204 r2273 13 13 * @author Eric Van Alst, MHPCC 14 14 * 15 * @version $Revision: 1.1 4$ $Name: not supported by cvs2svn $16 * @date $Date: 2004-1 0-27 00:57:33$15 * @version $Revision: 1.15 $ $Name: not supported by cvs2svn $ 16 * @date $Date: 2004-11-04 01:05:00 $ 17 17 * 18 18 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 99 99 100 100 // Generate three error messages to have messages on error stack 101 if (psError Msg("test4A",code, true, "Error code = %d", code) != code) {101 if (psError(code, true, "Error code = %d", code) != code) { 102 102 psLogMsg("tst_psError04", PS_LOG_ERROR, "Failed return value verify."); 103 103 return 31; 104 104 } 105 if (psError Msg("test4A",(code+1), false, "Error code = %d", (code+1)) != (code+1)) {105 if (psError((code+1), false, "Error code = %d", (code+1)) != (code+1)) { 106 106 psLogMsg("tst_psError04", PS_LOG_ERROR, "Failed return value verify."); 107 107 return 32; 108 108 } 109 if (psError Msg("test4A",(code+2), false, "Error code = %d", (code+2)) != (code+2)) {109 if (psError((code+2), false, "Error code = %d", (code+2)) != (code+2)) { 110 110 psLogMsg("tst_psError04", PS_LOG_ERROR, "Failed return value verify."); 111 111 return 33; … … 165 165 166 166 // Generate three error messages 167 if (psError Msg("test3A",code, true, "Error code = %d", code) != code) {167 if (psError(code, true, "Error code = %d", code) != code) { 168 168 psLogMsg("tst_psError03", PS_LOG_ERROR, "Failed return value verify."); 169 169 return 23; 170 170 } 171 if (psError Msg("test3A",(code+1), false, "Error code = %d", (code+1)) != (code+1)) {171 if (psError((code+1), false, "Error code = %d", (code+1)) != (code+1)) { 172 172 psLogMsg("tst_psError03", PS_LOG_ERROR, "Failed return value verify."); 173 173 return 24; 174 174 } 175 if (psError Msg("test3A",(code+2), false, "Error code = %d", (code+2)) != (code+2)) {175 if (psError((code+2), false, "Error code = %d", (code+2)) != (code+2)) { 176 176 psLogMsg("tst_psError03", PS_LOG_ERROR, "Failed return value verify."); 177 177 return 25; … … 219 219 220 220 // Generate error message and verify return value 221 if (psError Msg("test2A",code, true, "Error code = %d", code) != code ) {221 if (psError(code, true, "Error code = %d", code) != code ) { 222 222 psLogMsg("tst_psError02", PS_LOG_ERROR, "Failed return value verify."); 223 223 return 10; … … 233 233 234 234 // Verify the return value of psErrorMsg is the psErrorCode passed 235 if ( psError Msg("test1A",code, true, "Error code = %d", code) != code) {235 if ( psError(code, true, "Error code = %d", code) != code) { 236 236 psLogMsg("tst_psError01", PS_LOG_ERROR, "Failed return value verify."); 237 237 return 1; … … 240 240 241 241 // test1B empty string in for name argument 242 if ( psError Msg("",code+1, true, "Error code = %d", code+1) != code+1) {242 if ( psError(code+1, true, "Error code = %d", code+1) != code+1) { 243 243 psLogMsg("tst_psError01", PS_LOG_ERROR, "Failed return with empty string."); 244 244 return 2; … … 246 246 psErrorStackPrint(stderr,"ERROR STACK PRINT Test1B"); 247 247 248 // test1C null pointer in for name argument249 if ( psErrorMsg(NULL, code+2, true, "Error code = %d", code+2) != code+2) {250 psLogMsg("tst_psError01", PS_LOG_ERROR, "Failed return with null name arg.");251 return 3;252 }253 psErrorStackPrint(stderr,"ERROR STACK PRINT Test1C");254 255 248 // test1D undefined code 256 if ( psError Msg("test1D",-1, true, "Error code = %d", -1) != -1) {249 if ( psError(-1, true, "Error code = %d", -1) != -1) { 257 250 psLogMsg("test_psError01", PS_LOG_ERROR, "Failed return with undefined code."); 258 251 return 4; … … 261 254 262 255 // test1E set psErrorMsg argument to false 263 if( psError Msg("test1E",code, false, "Error code = %d", code) != code) {256 if( psError(code, false, "Error code = %d", code) != code) { 264 257 psLogMsg("test_psError01", PS_LOG_ERROR, "Failed return with false new arg."); 265 258 return 5; … … 268 261 269 262 // test1F psErrorMsg with a error code less then PS_ERR_BASE(256) 270 if( psError Msg("test1F",9, true, "Errno code = %d", 9) != 9) {263 if( psError(9, true, "Errno code = %d", 9) != 9) { 271 264 psLogMsg("test_psError01", PS_LOG_ERROR, "Failed return with errno code."); 272 265 return 6; … … 287 280 288 281 // Test point #1 Multiple type values placed in the error string 289 psError( __func__,282 psError(PS_ERR_UNKNOWN, true, 290 283 "ALL TYPES intval = %d longval = %ld floatval = %f charval = %c strval = %s", 291 284 intval,longval,floatval,charval,stringval); 292 285 293 286 // Test point #2 String values in error message 294 psError(PS_ STRING(__LINE__),"NO VALUES");287 psError(PS_ERR_UNKNOWN, true, "NO VALUES"); 295 288 296 289 // Test point #3 Empty strings in error message 297 psError( "","");290 psError(PS_ERR_UNKNOWN, true, ""); 298 291 299 292 return 0; -
trunk/psLib/test/sysUtils/tst_psMemory.c
r2204 r2273 6 6 * @author Robert DeSonia, MHPCC 7 7 * 8 * @version $Revision: 1.2 6$ $Name: not supported by cvs2svn $9 * @date $Date: 2004-1 0-27 00:57:33$8 * @version $Revision: 1.27 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2004-11-04 01:05:00 $ 10 10 * 11 11 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 99 99 mem = ( psS32* ) psAlloc( size * sizeof( psS32 ) ); 100 100 if ( mem == NULL ) { 101 psError( __FILE__, "psAlloc returned a NULL value in %s!", __func__ );101 psError(PS_ERR_UNKNOWN, true, "psAlloc returned a NULL value in %s!", __func__ ); 102 102 return 1; 103 103 } … … 130 130 ref = psMemGetRefCounter( mem ); 131 131 if ( ref != 1 ) { 132 psError( __func__, "Expected to buffer reference count to be initially 1, but it was %d.", ref );132 psError(PS_ERR_UNKNOWN, true, "Expected to buffer reference count to be initially 1, but it was %d.", ref ); 133 133 return 1; 134 134 } … … 140 140 ref = psMemGetRefCounter( mem ); 141 141 if ( ref != 4 ) { 142 psError( __func__, "Expected to find buffer reference count to be 4, but it was %d.", ref );142 psError(PS_ERR_UNKNOWN, true, "Expected to find buffer reference count to be 4, but it was %d.", ref ); 143 143 return 1; 144 144 } … … 149 149 ref = psMemGetRefCounter( mem ); 150 150 if ( ref != 2 ) { 151 psError( __func__, "Expected to find buffer reference count to be 2, but it was %d.", ref );151 psError(PS_ERR_UNKNOWN, true, "Expected to find buffer reference count to be 2, but it was %d.", ref ); 152 152 return 1; 153 153 } … … 159 159 ref = psMemGetRefCounter( mem ); 160 160 if ( ref != 1 ) { 161 psError( __func__, "Expected to find buffer reference count to be 1, but it was %d.", ref );161 psError(PS_ERR_UNKNOWN, true, "Expected to find buffer reference count to be 1, but it was %d.", ref ); 162 162 return 1; 163 163 } … … 197 197 198 198 if ( exhaustedCallbackCalled == 0 ) { 199 psError( __FILE__, "Called psRealloc with HUGE memory requirement and survived in %s!", __func__ );199 psError(PS_ERR_UNKNOWN,true, "Called psRealloc with HUGE memory requirement and survived in %s!", __func__ ); 200 200 return 1; 201 201 } … … 232 232 233 233 if ( exhaustedCallbackCalled == 0 ) { 234 psError( __FILE__, "Called psAlloc with HUGE memory requirement and survived in %s!", __func__ );234 psError(PS_ERR_UNKNOWN,true, "Called psAlloc with HUGE memory requirement and survived in %s!", __func__ ); 235 235 return 1; 236 236 } … … 273 273 for ( psS32 i = 0;i < initialSize;i++ ) { 274 274 if ( mem1[ i ] != i || mem2[ i ] != i || mem3[ i ] != i ) { 275 psError( __FILE__, "Realloc didn't preserve the contents with expanding buffer in %s.",276 __func__ );275 psError(PS_ERR_UNKNOWN,true, "Realloc didn't preserve the contents with expanding buffer in %s.", 276 __func__ ); 277 277 break; 278 278 } … … 290 290 for ( psS32 i = 0;i < initialSize / 2;i++ ) { 291 291 if ( mem1[ i ] != i || mem2[ i ] != i || mem3[ i ] != i ) { 292 psError( __FILE__, "Realloc didn't preserve the contents with shrinking buffer in %s.",293 __func__ );292 psError(PS_ERR_UNKNOWN,true, "Realloc didn't preserve the contents with shrinking buffer in %s.", 293 __func__ ); 294 294 break; 295 295 } … … 333 333 334 334 if ( allocCallbackCalled != 2 || freeCallbackCalled != 2 ) { 335 psError( __FILE__, "alloc/free callbacks were not called the proper number of times in %s",336 __func__ );335 psError(PS_ERR_UNKNOWN,true, "alloc/free callbacks were not called the proper number of times in %s", 336 __func__ ); 337 337 return 1; 338 338 } … … 352 352 353 353 if ( allocCallbackCalled != 2 ) { 354 psError( __FILE__, "realloc callbacks were not called the proper number of times in %s",355 __func__ );354 psError(PS_ERR_UNKNOWN,true, "realloc callbacks were not called the proper number of times in %s", 355 __func__ ); 356 356 return 1; 357 357 } … … 388 388 389 389 if ( nLeaks != 1 ) { 390 psError( __FILE__, "psMemCheckLeaks should have found 1 leak, but found %d in %s.", nLeaks, __func__ );390 psError(PS_ERR_UNKNOWN,true, "psMemCheckLeaks should have found 1 leak, but found %d in %s.", nLeaks, __func__ ); 391 391 return 1; 392 392 } 393 393 394 394 if ( blks[ 0 ] ->lineno != lineMark ) { 395 psError( __FILE__, "psMemCheckLeaks found a leak other than the expected one (line %d vs %d) in %s.",396 lineMark, blks[ 0 ] ->lineno, __func__ );395 psError(PS_ERR_UNKNOWN,true, "psMemCheckLeaks found a leak other than the expected one (line %d vs %d) in %s.", 396 lineMark, blks[ 0 ] ->lineno, __func__ ); 397 397 return 1; 398 398 } … … 418 418 419 419 if ( nLeaks != 1 ) { 420 psError( __FILE__, "psMemCheckLeaks should have found 1 leak, but found %d in %s.", nLeaks, __func__ );420 psError(PS_ERR_UNKNOWN,true, "psMemCheckLeaks should have found 1 leak, but found %d in %s.", nLeaks, __func__ ); 421 421 return 1; 422 422 } 423 423 424 424 if ( blks[ 0 ] ->lineno != lineMark ) { 425 psError( __FILE__, "psMemCheckLeaks found a leak other than the expected one in %s.", __func__ );425 psError(PS_ERR_UNKNOWN,true, "psMemCheckLeaks found a leak other than the expected one in %s.", __func__ ); 426 426 return 1; 427 427 } … … 448 448 449 449 if ( nLeaks != 2 ) { 450 psError( __FILE__, "psMemCheckLeaks should have found 1 leak, but found %d in %s.", nLeaks, __func__ );450 psError(PS_ERR_UNKNOWN,true, "psMemCheckLeaks should have found 1 leak, but found %d in %s.", nLeaks, __func__ ); 451 451 return 1; 452 452 } 453 453 454 454 if ( blks[ 0 ] ->lineno != lineMark ) { 455 psError( __FILE__, "psMemCheckLeaks found a leak other than the expected one in %s.", __func__ );455 psError(PS_ERR_UNKNOWN,true, "psMemCheckLeaks found a leak other than the expected one in %s.", __func__ ); 456 456 return 1; 457 457 } … … 499 499 500 500 if ( corruptions != 1 ) { 501 psError( __FILE__, "Expected one memory corruption but found %d in %s.",502 corruptions, __func__ );501 psError(PS_ERR_UNKNOWN,true, "Expected one memory corruption but found %d in %s.", 502 corruptions, __func__ ); 503 503 return 1; 504 504 } 505 505 506 506 if ( problemCallbackCalled != 1 ) { 507 psError( __FILE__, "The memProblemCallback was not invoked but should have been in %s",508 __func__ );507 psError(PS_ERR_UNKNOWN,true, "The memProblemCallback was not invoked but should have been in %s", 508 __func__ ); 509 509 return 1; 510 510 } … … 556 556 557 557 if (err->code != PS_ERR_MEMORY_DEREF_USAGE) { 558 psError Msg("psLibTest.sysUtils.tst_psMemory",PS_ERR_UNKNOWN,true,559 "Multiple psFree calls generated wrong error code (%d)",560 err->code);558 psError(PS_ERR_UNKNOWN,true, 559 "Multiple psFree calls generated wrong error code (%d)", 560 err->code); 561 561 psFree(err); 562 562 return 1;
Note:
See TracChangeset
for help on using the changeset viewer.
