IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Nov 3, 2004, 3:05:00 PM (22 years ago)
Author:
desonia
Message:

changed the psError signature to match SDRS. Also made misc. cleanups as
I was combing the files.

Location:
trunk/psLib/test/sysUtils
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/test/sysUtils/tst_psError.c

    r2204 r2273  
    1313 *  @author  Eric Van Alst, MHPCC
    1414 *
    15  *  @version $Revision: 1.14 $  $Name: not supported by cvs2svn $
    16  *  @date  $Date: 2004-10-27 00:57:33 $
     15 *  @version $Revision: 1.15 $  $Name: not supported by cvs2svn $
     16 *  @date  $Date: 2004-11-04 01:05:00 $
    1717 *
    1818 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    9999
    100100    // Generate three error messages to have messages on error stack
    101     if (psErrorMsg("test4A", code, true, "Error code = %d", code) !=  code) {
     101    if (psError(code, true, "Error code = %d", code) !=  code) {
    102102        psLogMsg("tst_psError04", PS_LOG_ERROR, "Failed return value verify.");
    103103        return 31;
    104104    }
    105     if (psErrorMsg("test4A", (code+1), false, "Error code = %d", (code+1)) != (code+1)) {
     105    if (psError((code+1), false, "Error code = %d", (code+1)) != (code+1)) {
    106106        psLogMsg("tst_psError04", PS_LOG_ERROR, "Failed return value verify.");
    107107        return 32;
    108108    }
    109     if (psErrorMsg("test4A", (code+2), false, "Error code = %d", (code+2)) != (code+2)) {
     109    if (psError((code+2), false, "Error code = %d", (code+2)) != (code+2)) {
    110110        psLogMsg("tst_psError04", PS_LOG_ERROR, "Failed return value verify.");
    111111        return 33;
     
    165165
    166166    // Generate three error messages
    167     if (psErrorMsg("test3A", code, true, "Error code = %d", code) !=  code) {
     167    if (psError(code, true, "Error code = %d", code) !=  code) {
    168168        psLogMsg("tst_psError03", PS_LOG_ERROR, "Failed return value verify.");
    169169        return 23;
    170170    }
    171     if (psErrorMsg("test3A", (code+1), false, "Error code = %d", (code+1)) != (code+1)) {
     171    if (psError((code+1), false, "Error code = %d", (code+1)) != (code+1)) {
    172172        psLogMsg("tst_psError03", PS_LOG_ERROR, "Failed return value verify.");
    173173        return 24;
    174174    }
    175     if (psErrorMsg("test3A", (code+2), false, "Error code = %d", (code+2)) != (code+2)) {
     175    if (psError((code+2), false, "Error code = %d", (code+2)) != (code+2)) {
    176176        psLogMsg("tst_psError03", PS_LOG_ERROR, "Failed return value verify.");
    177177        return 25;
     
    219219
    220220    // Generate error message and verify return value
    221     if (psErrorMsg("test2A", code, true, "Error code = %d", code) != code ) {
     221    if (psError(code, true, "Error code = %d", code) != code ) {
    222222        psLogMsg("tst_psError02", PS_LOG_ERROR, "Failed return value verify.");
    223223        return 10;
     
    233233
    234234    // Verify the return value of psErrorMsg is the psErrorCode passed
    235     if ( psErrorMsg("test1A", code, true, "Error code = %d", code) != code) {
     235    if ( psError(code, true, "Error code = %d", code) != code) {
    236236        psLogMsg("tst_psError01", PS_LOG_ERROR, "Failed return value verify.");
    237237        return 1;
     
    240240
    241241    // test1B empty string in for name argument
    242     if ( psErrorMsg("", code+1, true, "Error code = %d", code+1) != code+1) {
     242    if ( psError(code+1, true, "Error code = %d", code+1) != code+1) {
    243243        psLogMsg("tst_psError01", PS_LOG_ERROR, "Failed return with empty string.");
    244244        return 2;
     
    246246    psErrorStackPrint(stderr,"ERROR STACK PRINT Test1B");
    247247
    248     // test1C null pointer in  for name argument
    249     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 
    255248    // test1D undefined code
    256     if ( psErrorMsg("test1D", -1, true, "Error code = %d", -1) != -1) {
     249    if ( psError(-1, true, "Error code = %d", -1) != -1) {
    257250        psLogMsg("test_psError01", PS_LOG_ERROR, "Failed return with undefined code.");
    258251        return 4;
     
    261254
    262255    // test1E set psErrorMsg argument to false
    263     if( psErrorMsg("test1E", code, false, "Error code = %d", code) != code) {
     256    if( psError(code, false, "Error code = %d", code) != code) {
    264257        psLogMsg("test_psError01", PS_LOG_ERROR, "Failed return with false new arg.");
    265258        return 5;
     
    268261
    269262    // test1F psErrorMsg with a error code less then PS_ERR_BASE(256)
    270     if( psErrorMsg("test1F", 9, true, "Errno code = %d", 9) != 9) {
     263    if( psError(9, true, "Errno code = %d", 9) != 9) {
    271264        psLogMsg("test_psError01", PS_LOG_ERROR, "Failed return with errno code.");
    272265        return 6;
     
    287280
    288281    // Test point #1 Multiple type values placed in the error string
    289     psError(__func__,
     282    psError(PS_ERR_UNKNOWN, true,
    290283            "ALL TYPES intval = %d longval = %ld floatval = %f charval = %c strval = %s",
    291284            intval,longval,floatval,charval,stringval);
    292285
    293286    // Test point #2 String values in error message
    294     psError(PS_STRING(__LINE__),"NO VALUES");
     287    psError(PS_ERR_UNKNOWN, true, "NO VALUES");
    295288
    296289    // Test point #3 Empty strings in error message
    297     psError("","");
     290    psError(PS_ERR_UNKNOWN, true, "");
    298291
    299292    return 0;
  • trunk/psLib/test/sysUtils/tst_psMemory.c

    r2204 r2273  
    66*  @author Robert DeSonia, MHPCC
    77*
    8 *  @version $Revision: 1.26 $ $Name: not supported by cvs2svn $
    9 *  @date $Date: 2004-10-27 00:57:33 $
     8*  @version $Revision: 1.27 $ $Name: not supported by cvs2svn $
     9*  @date $Date: 2004-11-04 01:05:00 $
    1010*
    1111*  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    9999    mem = ( psS32* ) psAlloc( size * sizeof( psS32 ) );
    100100    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__ );
    102102        return 1;
    103103    }
     
    130130    ref = psMemGetRefCounter( mem );
    131131    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 );
    133133        return 1;
    134134    }
     
    140140    ref = psMemGetRefCounter( mem );
    141141    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 );
    143143        return 1;
    144144    }
     
    149149    ref = psMemGetRefCounter( mem );
    150150    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 );
    152152        return 1;
    153153    }
     
    159159    ref = psMemGetRefCounter( mem );
    160160    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 );
    162162        return 1;
    163163    }
     
    197197
    198198    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__ );
    200200        return 1;
    201201    }
     
    232232
    233233    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__ );
    235235        return 1;
    236236    }
     
    273273    for ( psS32 i = 0;i < initialSize;i++ ) {
    274274        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__ );
    277277            break;
    278278        }
     
    290290    for ( psS32 i = 0;i < initialSize / 2;i++ ) {
    291291        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__ );
    294294            break;
    295295        }
     
    333333
    334334    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__ );
    337337        return 1;
    338338    }
     
    352352
    353353    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__ );
    356356        return 1;
    357357    }
     
    388388
    389389    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__ );
    391391        return 1;
    392392    }
    393393
    394394    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__ );
    397397        return 1;
    398398    }
     
    418418
    419419    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__ );
    421421        return 1;
    422422    }
    423423
    424424    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__ );
    426426        return 1;
    427427    }
     
    448448
    449449    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__ );
    451451        return 1;
    452452    }
    453453
    454454    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__ );
    456456        return 1;
    457457    }
     
    499499
    500500    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__ );
    503503        return 1;
    504504    }
    505505
    506506    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__ );
    509509        return 1;
    510510    }
     
    556556
    557557    if (err->code != PS_ERR_MEMORY_DEREF_USAGE) {
    558         psErrorMsg("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);
    561561        psFree(err);
    562562        return 1;
Note: See TracChangeset for help on using the changeset viewer.