IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Nov 3, 2004, 4:02:10 PM (22 years ago)
Author:
desonia
Message:

fixed problems with psError and associate parameter checking macros.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psModules/src/psTest.c

    r2126 r2275  
    2828#define HEADER_BOTTOM "\\**********************************************************************************/\n\n"
    2929
    30 bool p_runTestSuite( FILE *fp, const char* testPointFile, const char* packageName,
    31                      testDescription tests[], int argc, char * const argv[] )
    32 {
    33     bool success = true;
    34     bool runAll = true;
    35     bool useFork = true;
    36     bool found;
    37     int c;
    38     int n;
     30psBool p_runTestSuite( FILE *fp, const char* testPointFile, const char* packageName,
     31                       testDescription tests[], psS32 argc, char * const argv[] )
     32{
     33    psBool success = true;
     34    psBool runAll = true;
     35    psBool useFork = true;
     36    psBool found;
     37    psS32 c;
     38    psS32 n;
    3939    extern char *optarg;
    4040
     
    6262                printf( "Testpoints:\n" );
    6363                runAll = false;
    64                 for ( int index = 0; tests[ index ].fcn != NULL; index++ ) {
     64                for ( psS32 index = 0; tests[ index ].fcn != NULL; index++ ) {
    6565                    printf( "    %6d - %s \n", tests[ index ].testPointNumber,
    6666                            tests[ index ].testPointName );
     
    7070            case 't':
    7171                runAll = false;
    72                 for ( int index = 0; tests[ index ].fcn != NULL; index++ ) {
     72                for ( psS32 index = 0; tests[ index ].fcn != NULL; index++ ) {
    7373                    if ( strcmp( optarg, tests[ index ].testPointName ) == 0 ) {
    7474                        success = p_runTest( fp,
     
    8585                runAll = false;
    8686                if ( sscanf( optarg, "%i", &n ) != 1 ) {
    87                     psError( __func__, "Failed to parse the testpoint number (%s).",
    88                              optarg );
     87                    psError(PS_ERR_UNKNOWN, true, "Failed to parse the testpoint number (%s).",
     88                            optarg );
    8989                    break;
    9090                }
    9191                found = false;
    92                 for ( int index = 0; tests[ index ].fcn != NULL; index++ ) {
     92                for ( psS32 index = 0; tests[ index ].fcn != NULL; index++ ) {
    9393                    if ( n == tests[ index ].testPointNumber ) {
    9494                        found = true;
     
    103103                }
    104104                if ( ! found ) {
    105                     psError( __func__, "The specified testpoint number (%d) doesn't exist in this test driver.",
    106                              n );
     105                    psError(PS_ERR_UNKNOWN, true, "The specified testpoint number (%d) doesn't exist in this test driver.",
     106                            n );
    107107                    break;
    108108                }
    109109                break;
    110110            case '?':
    111                 psError( __func__, "Option %s is not recognized and is ignored.", optarg );
     111                psError(PS_ERR_UNKNOWN, true, "Option %s is not recognized and is ignored.", optarg );
    112112                break;
    113113            }
     
    116116
    117117    if ( runAll ) {
    118         for ( int index = 0; tests[ index ].fcn != NULL; index++ ) {
     118        for ( psS32 index = 0; tests[ index ].fcn != NULL; index++ ) {
    119119            if ( ! tests[ index ].isDuplicateEntry ) {
    120120                success = p_runTest( fp,
     
    130130
    131131    if ( ! success ) {
    132         psError( testPointFile, "One or more tests failed" );
     132        psError( PS_ERR_UNKNOWN, true,
     133                 "One or more tests failed" );
    133134    }
    134135
     
    136137}
    137138
    138 bool p_runTest( FILE *fp, const char* testPointFile, const char* packageName, const char* testPointName,
    139                 testFcn fcn, int expectedReturn, bool useFork )
    140 {
    141     int childReturn = 0;
     139psBool p_runTest( FILE *fp, const char* testPointFile, const char* packageName, const char* testPointName,
     140                  testFcn fcn, psS32 expectedReturn, psBool useFork )
     141{
     142    psS32 childReturn = 0;
    142143    pid_t child;
    143144
     
    147148        child = fork();
    148149        if ( child == 0 ) {                   // I am the child process, run the test
    149             int currentId = psMemGetId();
    150             int retVal = fcn();
     150            psS32 currentId = psMemGetId();
     151            psS32 retVal = fcn();
    151152            if ( retVal == 0 ) { // only bother checking memory if test executed to end.
    152153                if ( psMemCheckLeaks( currentId, NULL, stderr ) != 0 ) {
    153                     psError( __func__, "Memory Leaks Detected" );
     154                    psError(PS_ERR_UNKNOWN, true, "Memory Leaks Detected" );
    154155                    retVal = 64;
    155156                }
     
    171172        }
    172173    } else {
    173         int currentId = psMemGetId();
     174        psS32 currentId = psMemGetId();
    174175        childReturn = fcn();
    175176        if ( childReturn == 0 ) { // only bother checking memory if test executed to end.
    176177            if ( psMemCheckLeaks( currentId, NULL, stderr ) != 0 ) {
    177                 psError( __func__, "Memory Leaks Detected" );
     178                psError(PS_ERR_UNKNOWN, true, "Memory Leaks Detected" );
    178179                childReturn = 64;
    179180            }
     
    215216                                const char* testPointName,
    216217                                const char* expectedError,
    217                                 int exitValue )
     218                                psS32 exitValue )
    218219{
    219220    char TP[ 80 ];
     
    235236                    const char* packageName,
    236237                    const char* testPointName,
    237                     bool success )
     238                    psBool success )
    238239{
    239240    if ( success ) {
Note: See TracChangeset for help on using the changeset viewer.