Changeset 1034 for trunk/psLib/test/FullUnitTest
- Timestamp:
- Jun 14, 2004, 2:13:57 PM (22 years ago)
- File:
-
- 1 edited
-
trunk/psLib/test/FullUnitTest (modified) (14 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/test/FullUnitTest
r937 r1034 19 19 # RETURN : integer number of tests which failed 20 20 # 21 # $Revision: 1. 5$ $Name: not supported by cvs2svn $22 # $Date: 2004-06- 08 23:50:56$21 # $Revision: 1.6 $ $Name: not supported by cvs2svn $ 22 # $Date: 2004-06-15 00:13:57 $ 23 23 # 24 24 # Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 37 37 GetOptions("verbose!"=>\$verbose, 38 38 "recursive!"=>\$recursive, 39 "silent!"=>\$silent); 39 "silent!"=>\$silent, 40 "clean!"=>\$clean); 40 41 41 42 # Check if both silent and verbose options are set and if so stop the script … … 50 51 # Set the environment variable 51 52 $ENV{'PSLIB_ROOT'} = $PSLIB_ROOT; 52 if ($verbose) { 53 print("PSLIB_ROOT not found: set to $PSLIB_ROOT.\n"); 54 } 53 print("PSLIB_ROOT not found: set to $PSLIB_ROOT.\n") if $verbose; 55 54 } 56 55 … … 63 62 # total makes and tests performed 64 63 $makeFailCount = 0; 65 $testFailCount = 0; 66 $totalTests = 0; 64 $testpointFailCount = 0; 65 $testDriverFailCount = 0; 66 $totalTestpoints = 0; 67 $totalTestDrivers = 0; 67 68 $totalMakes = 0; 68 69 … … 98 99 # Display message to user that all directories under the current will be 99 100 # tested 100 print("Recursively testing current directory tree.\n") ;101 print("Recursively testing current directory tree.\n") if $verbose; 101 102 # Invoke subroutine to go to recursively test each directory in tree 102 103 &worm($ENV{"PWD"}); … … 104 105 105 106 # Check if there were any failures during make or testing 106 if ($makeFailCount>0 || $test FailCount>0) {107 if ($makeFailCount>0 || $testDriverFailCount>0) { 107 108 # Display summary of failures 108 109 print("\nMake Failures = $makeFailCount out of $totalMakes"); 109 print("\nTest Failures = $testFailCount out of $totalTests\n");110 print("\nTest Driver Failures = $testDriverFailCount out of $totalTestDrivers\n"); 110 111 print("\nMakes that failed:\n ".join("\n ",@makesFailed) . "\n") if $makeFailCount; 111 print("\nTests that failed:\n ".join("\n ",@testsFailed) . "\n") if $test FailCount;112 print("\nTests that failed:\n ".join("\n ",@testsFailed) . "\n") if $testDriverFailCount; 112 113 } else { 113 114 # Display message of all makes and tests pass to user if silent option 114 115 # not specified 115 print("\nAll $totalTest s Tests Passed.\n") if (! $silent);116 print("\nAll $totalTestDrivers Test Drivers Passed with $totalTestpoints Testpoints.\n") if (! $silent); 116 117 } 117 118 118 119 # Exit with the number of tests that failed 119 exit($test FailCount);120 exit($testDriverFailCount); 120 121 121 122 … … 191 192 # Display message to user in which directory testing is taken place only 192 193 # if the silent command option was not specified 193 print("---- Testing:$pwd ----\n") if ( ! $silent);194 print("---- Entering $pwd ----\n") if ( ! $silent); 194 195 195 196 # Check for the existence of a file name Makefile in current directory … … 199 200 $totalMakes++; 200 201 201 # Execute the make clean 202 `make clean`; 203 204 # Execute the make distclean 205 `make distclean`; 202 if ($clean) { 203 # Execute the make clean 204 `make clean`; 205 206 # Execute the make distclean 207 `make distclean`; 208 } 206 209 207 210 # Execute the make and save results … … 265 268 266 269 # Increment total number of test drivers executed 267 $totalTest s++;270 $totalTestDrivers++; 268 271 269 272 # Perform subdirectory checks only the first time a test … … 282 285 # exist eventhough TST files have been found 283 286 # print("Unable to execute test drivers in $base_dir\n"); 284 print("No verified subdirectory present.\n") ;287 print("No verified subdirectory present.\n") if ($verbose); 285 288 # Increment test fail count 286 # $test FailCount++;289 # $testDriverFailCount++; 287 290 # Save the file failed 288 291 # push(@testsFailed, $pwd . "/" . $files[$j]); … … 295 298 # Execute the test driver 296 299 system("./$files[$j] 1> temp/$files[$j].stdout 2> temp/$files[$j].stderr"); 300 $retVal = $?; 301 # Count testpoints 302 $totalPoints = `grep -c '***** TESTPOINT *****' temp/$files[$j].stdout`; 303 $totalPoints += `grep -c '***** TESTPOINT *****' temp/$files[$j].stderr`; 304 $failPoints = `grep "> TESTPOINT FAILED" temp/$files[$j].stdout | wc -l`; 305 $failPoints += `grep "> TESTPOINT FAILED" temp/$files[$j].stderr | wc -l`; 306 $testpointFailCount += $failPoints; 307 $totalTestpoints += $totalPoints; 297 308 # Check result of test driver 298 if ( ( ($ ?!= 0) && ($files[$j] =~ /^TST/i) ) ||299 ( ($ ?== 0) && ($files[$j] =~ /^ATST/i ) ) ) {309 if ( ( ($retVal != 0) && ($files[$j] =~ /^TST/i) ) || 310 ( ($retVal == 0) && ($files[$j] =~ /^ATST/i ) ) ) { 300 311 # Display test driver failed 301 print("Test driver: $files[$j] Failed (Return value $?).\n"); 312 $failPoints++; 313 print("Test driver: $files[$j] Failed (Return value $retVal).\n"); 302 314 # Increment the total number of test failed 303 $test FailCount++;315 $testDriverFailCount++; 304 316 # Push the current working directory on the list of failed 305 317 push(@testsFailed, $pwd . "/" . $files[$j]); … … 318 330 if ( ($exitValue & 8) || ($exitValue & 64) ) { 319 331 # Increment the total number of test failed 320 $test FailCount++;332 $testDriverFailCount++; 321 333 # Push test on failed list 334 print("Test failed ($failPoints out of $totalPoints testpoints failed)\n") if ( ! $silent); 322 335 push(@testsFailed, $pwd . "/" . $files[$j]); 323 336 } else { … … 331 344 if ( ($exitValue & 16) || ($exitValue & 128) ) { 332 345 # Increment the total number of tests failed 333 $test FailCount++;346 $testDriverFailCount++; 334 347 # Push test on failed list 348 print("Test failed ($failPoints out of $totalPoints testpoints failed)\n") if ( ! $silent); 335 349 push(@testsFailed, $pwd . "/" . $files[$j]); 336 350 } else { 337 print("Test successful \n") if ( ! $silent);351 print("Test successful ($totalPoints testpoints)\n") if ( ! $silent); 338 352 } 339 353 } … … 414 428 415 429 # Display message to user that verified STDOUT file doesn't exist 416 print(" File $streamFile doesn't exist.\n") ;430 print(" File $streamFile doesn't exist.\n") if ($verbose); 417 431 418 432 # Set exit value bit 1 to indicate proper failure
Note:
See TracChangeset
for help on using the changeset viewer.
