Changeset 2275 for trunk/psModules/src/psTest.c
- Timestamp:
- Nov 3, 2004, 4:02:10 PM (22 years ago)
- File:
-
- 1 edited
-
trunk/psModules/src/psTest.c (modified) (12 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psModules/src/psTest.c
r2126 r2275 28 28 #define HEADER_BOTTOM "\\**********************************************************************************/\n\n" 29 29 30 bool p_runTestSuite( FILE *fp, const char* testPointFile, const char* packageName,31 testDescription tests[], intargc, char * const argv[] )32 { 33 bool success = true;34 bool runAll = true;35 bool useFork = true;36 bool found;37 intc;38 intn;30 psBool 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; 39 39 extern char *optarg; 40 40 … … 62 62 printf( "Testpoints:\n" ); 63 63 runAll = false; 64 for ( intindex = 0; tests[ index ].fcn != NULL; index++ ) {64 for ( psS32 index = 0; tests[ index ].fcn != NULL; index++ ) { 65 65 printf( " %6d - %s \n", tests[ index ].testPointNumber, 66 66 tests[ index ].testPointName ); … … 70 70 case 't': 71 71 runAll = false; 72 for ( intindex = 0; tests[ index ].fcn != NULL; index++ ) {72 for ( psS32 index = 0; tests[ index ].fcn != NULL; index++ ) { 73 73 if ( strcmp( optarg, tests[ index ].testPointName ) == 0 ) { 74 74 success = p_runTest( fp, … … 85 85 runAll = false; 86 86 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 ); 89 89 break; 90 90 } 91 91 found = false; 92 for ( intindex = 0; tests[ index ].fcn != NULL; index++ ) {92 for ( psS32 index = 0; tests[ index ].fcn != NULL; index++ ) { 93 93 if ( n == tests[ index ].testPointNumber ) { 94 94 found = true; … … 103 103 } 104 104 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 ); 107 107 break; 108 108 } 109 109 break; 110 110 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 ); 112 112 break; 113 113 } … … 116 116 117 117 if ( runAll ) { 118 for ( intindex = 0; tests[ index ].fcn != NULL; index++ ) {118 for ( psS32 index = 0; tests[ index ].fcn != NULL; index++ ) { 119 119 if ( ! tests[ index ].isDuplicateEntry ) { 120 120 success = p_runTest( fp, … … 130 130 131 131 if ( ! success ) { 132 psError( testPointFile, "One or more tests failed" ); 132 psError( PS_ERR_UNKNOWN, true, 133 "One or more tests failed" ); 133 134 } 134 135 … … 136 137 } 137 138 138 bool p_runTest( FILE *fp, const char* testPointFile, const char* packageName, const char* testPointName,139 testFcn fcn, int expectedReturn, bool useFork )140 { 141 intchildReturn = 0;139 psBool 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; 142 143 pid_t child; 143 144 … … 147 148 child = fork(); 148 149 if ( child == 0 ) { // I am the child process, run the test 149 intcurrentId = psMemGetId();150 intretVal = fcn();150 psS32 currentId = psMemGetId(); 151 psS32 retVal = fcn(); 151 152 if ( retVal == 0 ) { // only bother checking memory if test executed to end. 152 153 if ( psMemCheckLeaks( currentId, NULL, stderr ) != 0 ) { 153 psError( __func__, "Memory Leaks Detected" );154 psError(PS_ERR_UNKNOWN, true, "Memory Leaks Detected" ); 154 155 retVal = 64; 155 156 } … … 171 172 } 172 173 } else { 173 intcurrentId = psMemGetId();174 psS32 currentId = psMemGetId(); 174 175 childReturn = fcn(); 175 176 if ( childReturn == 0 ) { // only bother checking memory if test executed to end. 176 177 if ( psMemCheckLeaks( currentId, NULL, stderr ) != 0 ) { 177 psError( __func__, "Memory Leaks Detected" );178 psError(PS_ERR_UNKNOWN, true, "Memory Leaks Detected" ); 178 179 childReturn = 64; 179 180 } … … 215 216 const char* testPointName, 216 217 const char* expectedError, 217 intexitValue )218 psS32 exitValue ) 218 219 { 219 220 char TP[ 80 ]; … … 235 236 const char* packageName, 236 237 const char* testPointName, 237 bool success )238 psBool success ) 238 239 { 239 240 if ( success ) {
Note:
See TracChangeset
for help on using the changeset viewer.
