IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jun 14, 2004, 2:13:57 PM (22 years ago)
Author:
desonia
Message:

Changed testpoint header so that testpoints can be easily counted

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/test/FullUnitTest

    r937 r1034  
    1919#  RETURN : integer number of tests which failed
    2020#
    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 $
    2323#
    2424#  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    3737GetOptions("verbose!"=>\$verbose,
    3838           "recursive!"=>\$recursive,
    39            "silent!"=>\$silent);
     39           "silent!"=>\$silent,
     40           "clean!"=>\$clean);
    4041
    4142# Check if both silent and verbose options are set and if so stop the script
     
    5051    # Set the environment variable
    5152    $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;
    5554}
    5655
     
    6362# total makes and tests performed
    6463$makeFailCount = 0;
    65 $testFailCount = 0;
    66 $totalTests = 0;
     64$testpointFailCount = 0;
     65$testDriverFailCount = 0;
     66$totalTestpoints = 0;
     67$totalTestDrivers = 0;
    6768$totalMakes = 0;
    6869
     
    9899    # Display message to user that all directories under the current will be
    99100    # tested
    100     print("Recursively testing current directory tree.\n");
     101    print("Recursively testing current directory tree.\n") if $verbose;
    101102    # Invoke subroutine to go to recursively test each directory in tree
    102103    &worm($ENV{"PWD"});
     
    104105
    105106# Check if there were any failures during make or testing
    106 if ($makeFailCount>0 || $testFailCount>0) {
     107if ($makeFailCount>0 || $testDriverFailCount>0) {
    107108    # Display summary of failures
    108109    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");
    110111    print("\nMakes that failed:\n  ".join("\n  ",@makesFailed) . "\n") if $makeFailCount;
    111     print("\nTests that failed:\n  ".join("\n  ",@testsFailed) . "\n") if $testFailCount;
     112    print("\nTests that failed:\n  ".join("\n  ",@testsFailed) . "\n") if $testDriverFailCount;
    112113} else {
    113114    # Display message of all makes and tests pass to user if silent option
    114115    # not specified
    115     print("\nAll $totalTests Tests Passed.\n") if (! $silent);
     116    print("\nAll $totalTestDrivers Test Drivers Passed with $totalTestpoints Testpoints.\n") if (! $silent);
    116117}
    117118
    118119# Exit with the number of tests that failed
    119 exit($testFailCount);
     120exit($testDriverFailCount);
    120121
    121122
     
    191192    # Display message to user in which directory testing is taken place only
    192193    # if the silent command option was not specified
    193     print("---- Testing: $pwd ----\n") if ( ! $silent);
     194    print("---- Entering $pwd ----\n") if ( ! $silent);
    194195
    195196    # Check for the existence of a file name Makefile in current directory
     
    199200        $totalMakes++;
    200201
    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        }
    206209
    207210        # Execute the make and save results
     
    265268
    266269            # Increment total number of test drivers executed
    267             $totalTests++;
     270            $totalTestDrivers++;
    268271
    269272            # Perform subdirectory checks only the first time a test
     
    282285                    # exist eventhough TST files have been found
    283286#                    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);
    285288                    # Increment test fail count
    286  #                   $testFailCount++;
     289 #                   $testDriverFailCount++;
    287290                    # Save the file failed
    288291#                    push(@testsFailed, $pwd . "/" . $files[$j]);
     
    295298            # Execute the test driver
    296299            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;
    297308            # 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 ) ) ) {
    300311                # 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");
    302314                # Increment the total number of test failed
    303                 $testFailCount++;
     315                $testDriverFailCount++;
    304316                # Push the current working directory on the list of failed
    305317                push(@testsFailed, $pwd . "/" . $files[$j]);
     
    318330                if ( ($exitValue & 8) || ($exitValue & 64) ) {
    319331                    # Increment the total number of test failed
    320                     $testFailCount++;
     332                    $testDriverFailCount++;
    321333                    # Push test on failed list
     334                    print("Test failed ($failPoints out of $totalPoints testpoints failed)\n") if ( ! $silent);
    322335                    push(@testsFailed, $pwd . "/" . $files[$j]);
    323336                } else {
     
    331344                    if ( ($exitValue & 16) || ($exitValue & 128) ) {
    332345                        # Increment the total number of tests failed
    333                         $testFailCount++;
     346                        $testDriverFailCount++;
    334347                        # Push test on failed list
     348                        print("Test failed ($failPoints out of $totalPoints testpoints failed)\n") if ( ! $silent);
    335349                        push(@testsFailed, $pwd . "/" . $files[$j]);
    336350                    } else {
    337                        print("Test successful\n") if ( ! $silent);
     351                       print("Test successful ($totalPoints testpoints)\n") if ( ! $silent);
    338352                    }
    339353                }
     
    414428
    415429        # 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);
    417431
    418432        # Set exit value bit 1 to indicate proper failure
Note: See TracChangeset for help on using the changeset viewer.