IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Apr 8, 2005, 2:04:58 PM (21 years ago)
Author:
desonia
Message:

moved around some files and modified FullUnitTest to use runTest.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/test/runTest

    r3682 r3690  
    2626#
    2727#  $Revison:  $  $Name: not supported by cvs2svn $
    28 #  $Date: 2005-04-07 20:27:41 $
     28#  $Date: 2005-04-09 00:04:57 $
    2929#
    3030#  Copyright 2004 Maui High Performance Computering Center, University of Hawaii
     
    4343    "resetStdout!" => \$resetStdout,
    4444    "verified=s"   => \$verifiedDir,
    45     "help!"        => \$help
     45    "help!"        => \$help,
     46    "quiet!"       => \$quiet,
     47    "printpassfail!"     => \$verbose
    4648);
    4749
    4850if ($help || $#ARGV < 0) {
    49     print
    50 "Usage: runTest [--reset] [--resetStderr] [--resetStdout] testfile(s)\n\n";
     51    print "Usage: runTest  [--help] [--verified=DIR] [--quiet] [--printpassfail] \\\n",
     52          "                [--reset] [--resetStderr] [--resetStdout] testfile(s)\n\n";
    5153    exit(0);
    5254}
     
    7577    # Check if a temp directory already exists in the current work directory
    7678    if ( !( -e "temp" ) ) {
    77 
    7879        # Create temp directory to store STDOUT, STDERR files during test run
    7980        `mkdir temp`;
    80 
    81         # Display message of new directory created
    82         print("Creating temp directory\n");
    8381    }
    8482
     
    8785
    8886        # Display message that verified subdirectory doesn't exist
    89         print("        Verified directory doesn't exist.\n");
     87        print STDERR "        Verified directory doesn't exist.\n";
    9088
    9189        # Exit script since the test cannot be run with verified files
     
    9593    # Check if the test driver file exists and is executable
    9694    if ( ( -e $testFile ) && ( -x $testFile ) ) {
    97 
    98         # Display message the test driver is being executed
    99         print("--- Executing test driver: $testFile\n");
    10095
    10196        # Invoke the test driver
     
    112107            # Display failure message with return value to user
    113108            if ( $? != 0 && ( $testFile !~ /^A/i ) ) {
    114                 print("Failed - Test Driver returned $?, expected 0.\n");
     109                print STDERR "Failed - Test Driver returned $?, expected 0.\n";
    115110            }
    116111            elsif ( $? == 0 && ( $testFile =~ /^A/i ) ) {
    117                 print("Failed - Test Driver returned $?, expected abort.\n");
     112                print STDERR "Failed - Test Driver returned $?, expected abort.\n";
    118113            }
    119114            $exitValue |= 64;
     
    148143            }
    149144            if (m/^---> TESTPOINT\s(\S+)/) {
    150                 print "\t$testfile- $1\n";
     145                print "\t$testfile- $1\n" if ($verbose || $1 eq "FAILED");
     146                if ($1 eq "FAILED") {
     147                    print $testoutput;
     148                }
    151149            }
    152150
     
    184182            s/v\d+.\d+.\d+/vX.X.X/g;
    185183
     184            if (m/\*\*\*\*\*\* TESTPOINT \*\*\*\*\*\*/) {
     185                $testoutput = $_;
     186            }
     187            $testoutput += $_;
     188
    186189            if (m/ TestPoint:\s*([^\*]+)/) {
    187190                $testfile = $1;
    188191            }
    189192            if (m/^---> TESTPOINT\s(\S+)/) {
    190                 print "\t$testfile- $1\n";
     193                print "\t$testfile- $1\n" if ($verbose || $1 eq "FAILED");
     194                if ($1 eq "FAILED") {
     195                    print $testoutput;
     196                }
    191197            }
    192198
     
    208214
    209215        # Compare STDOUT capture with verified file
    210         $exitValue |= &compareStream("$verifiedDir/$testFile.stdout");
     216        $exitValue = &compareStream("$verifiedDir/$testFile.stdout");
    211217
    212218        # Check exit value to determine if verified file doesn't exist
     
    233239        # Since test driver doesn't exist or is not executable then display
    234240        # message to user.
    235         print(
    236 "        Need to specify an executable test file within directory.\n"
    237         );
     241        print STDERR "\tNeed to specify an executable test file.\n";
    238242
    239243        # Exit value set to indicate test driver doesn't exist or not executable
     
    246250# of a failed test
    247251if ( ( $exitValue >> 3 ) != 0 ) {
    248     print("Test failed - return status = $exitValue\n\n");
     252    print STDERR "Test failed - return status = $exitValue\n\n";
    249253}
    250254else {
    251     print("Test successful\n\n");
     255    exit(0);
    252256}
    253257exit($exitValue);
     
    287291            || m/\|A\|/i )
    288292        {
     293            print STDERR "\tFailed - File $fileName contains error strings.\n";
    289294            if ( $fileName =~ m/out/ ) {
    290                 print(
    291                     "        Failed - File $fileName contains error strings.\n"
    292                 );
    293295                $returnVal = 64;
    294296            }
    295297            elsif ( $fileName =~ m/err/ ) {
    296                 print(
    297                     "        Failed - File $fileName contains error strings.\n"
    298                 );
    299298                $returnVal = 128;
    300299            }
     
    320319#
    321320#      Return:   0  -  Compare successful
     321#                2  -  STDOUT verified file doesn't exist
     322#                4  -  STDERR verified file doesn't exist
    322323#                8  -  STDOUT verified file doesn't compare
    323324#               16  -  STDERR verified file doesn't compare
     
    331332
    332333    # Check for existence of verified STD stream files
    333     if ( -e $streamFile ) {
     334    if ( !( -e $streamFile ) ) {
     335
     336        # Set exit value bit 1 to indicate proper failure
     337        if ( $streamFile =~ /out$/ ) {
     338            $returnVal |= 2;
     339        }
     340        elsif ( $streamFile =~ /err$/ ) {
     341            $returnVal |= 4;
     342        }
     343    }
     344    else {
    334345
    335346        # Verified STD stream file exists
     
    352363
    353364                # Display message of the failure of difference to user
    354                 print("        Failed - STDOUT difference\n$diffstdout\n");
     365                print STDERR "\tFailed - STDOUT differences\n";
    355366
    356367                # Exit value to indicate STDOUT did not compare
     
    360371
    361372                # Display message of the failure of difference to user
    362                 print("        Failed - STDERR difference\n$diffstdout\n");
     373                print STDERR "\tFailed - STDERR differences\n";
    363374
    364375                # Exit value to indicate STDERR did not compare
Note: See TracChangeset for help on using the changeset viewer.