IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jul 12, 2004, 3:37:59 PM (22 years ago)
Author:
desonia
Message:

removed the dependency creation stuff, as George hated it ALOT!

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/test/runTest

    r1198 r1212  
    3030#
    3131#  $Revison:  $  $Name: not supported by cvs2svn $
    32 #  $Date: 2004-07-08 19:34:18 $
     32#  $Date: 2004-07-13 01:37:58 $
    3333#
    3434#  Copyright 2004 Maui High Performance Computering Center, University of Hawaii
     
    3636################################################################################
    3737
     38# Provides functions for handling long command line options
     39use Getopt::Long;
     40
     41# Assign variables based on the presence of command line options to the script
     42GetOptions("reset!"=>\$reset,
     43           "resetStderr!"=>\$resetStderr,
     44           "resetStdout!"=>\$resetStdout,
     45           "help!"=>\$help);
     46
     47if ($help) {
     48    print "Usage: runTest [--reset] [--resetStderr] [--resetStdout] testfile(s)\n\n";
     49    exit(0);
     50}
     51
     52if ($reset) {
     53    $resetStderr = 1;
     54    $resetStdout = 1;
     55}
     56   
    3857# Initialize exit value
    3958$exitValue = 0;
     
    5574$ENV{'DYLD_LIBRARY_PATH'} = "$ENV{'PSLIB_ROOT'}/lib:$ENV{'DYLD_LIBRARY_PATH'}";
    5675
    57 # Get test driver name from arguement list
    58 $testFile = $ARGV[0];
    59 
    60 # Check if a temp directory already exists in the current work directory
    61 if ( !( -e "temp" )) {
    62    # Create temp directory to store STDOUT, STDERR files during test run
    63    `mkdir temp`;
    64    # Display message of new directory created
    65    print("Creating temp directory\n");
    66 }
    67 
    68 # Check if a verified directory exists in the current work directory
    69 if ( !( -e "verified" )) {
    70     # Display message that verified subdirectory doesn't exist
    71     print("        Verified directory doesn't exist.\n");
    72     # Exit script since the test cannot be run with verified files
    73     $exitValue = 1;
    74 }
    75 
    76 # Check if the test driver file exists and is executable
    77 if ( (-e $testFile) && (-x $testFile) ) {
    78 
    79     # Display message the test driver is being executed
    80     print("--- Executing test driver: $testFile\n");
    81 
    82     # Invoke the test driver
    83     system("./$testFile 1> temp/$testFile.stdout 2> temp/$testFile.stderr");
    84 
    85     # Check the return value of the test driver.  A value other than 0
    86     # indicates failure of the test driver unless the test driver is name
    87     # with a leading 'a' which indicates the test driver is expecting an
    88     # abort condition to terminate the driver.
    89     if ( ( $? != 0  && ( $testFile !~ /^A/i)) ||
    90          ( $? == 0  && ( $testFile =~ /^A/i)) ) {
    91 
    92         # Display failure message with return value to user
    93         if ( $? != 0 && ( $testFile !~ /^A/i) ) {
    94             print("        Failed - Test Driver expected 0 return value (Return value $?)\n");
    95         } elsif ( $? == 0 && ( $testFile =~ /^A/i) ) {
    96             print("        Failed - Test Driver expected abort (Return value $?)\n");
     76# Loop through the arguements passed to the script
     77foreach (@ARGV) {
     78    chomp;
     79    $testFile = $_;
     80
     81    # Check if a temp directory already exists in the current work directory
     82    if ( !( -e "temp" )) {
     83    # Create temp directory to store STDOUT, STDERR files during test run
     84    `mkdir temp`;
     85    # Display message of new directory created
     86    print("Creating temp directory\n");
     87    }
     88   
     89    # Check if a verified directory exists in the current work directory
     90    if ( !( -e "verified" )) {
     91        # Display message that verified subdirectory doesn't exist
     92        print("        Verified directory doesn't exist.\n");
     93        # Exit script since the test cannot be run with verified files
     94        $exitValue = 1;
     95    }
     96   
     97    # Check if the test driver file exists and is executable
     98    if ( (-e $testFile) && (-x $testFile) ) {
     99   
     100        # Display message the test driver is being executed
     101        print("--- Executing test driver: $testFile\n");
     102   
     103        # Invoke the test driver
     104        system("./$testFile 1> temp/$testFile.stdout 2> temp/$testFile.stderr");
     105       
     106        # Check the return value of the test driver.  A value other than 0
     107        # indicates failure of the test driver unless the test driver is name
     108        # with a leading 'a' which indicates the test driver is expecting an
     109        # abort condition to terminate the driver.
     110        if ( ( $? != 0  && ( $testFile !~ /^A/i)) ||
     111            ( $? == 0  && ( $testFile =~ /^A/i)) ) {
     112   
     113            # Display failure message with return value to user
     114            if ( $? != 0 && ( $testFile !~ /^A/i) ) {
     115                print("        Failed - Test Driver expected 0 return value (Return value $?)\n");
     116            } elsif ( $? == 0 && ( $testFile =~ /^A/i) ) {
     117                print("        Failed - Test Driver expected abort (Return value $?)\n");
     118            }
     119            $exitValue |= 256;
     120        } else {
     121   
     122            # Test driver succeeded.
     123   
     124            # Create filtered version of stdout and stderr
     125               
     126            # Open the STDOUT file for reading       
     127            open(OUTFILE, "< temp/$testFile.stdout");
     128            # Open mod file to place filtered STDOUT
     129            open(MODFILE, "> temp/$testFile.stdout.mod");
     130            open(MODFILE2, "> verified/$testFile.stdout") if $resetStdout;
     131            # Replace the variable date, time and host information with constants
     132            $hostname = `hostname`;
     133            chop $hostname;
     134            while( <OUTFILE> ) {
     135                s/\d+:\d+:\d+/ <DATE> /;
     136                s/\s+\d+:\d+:\d+\w/ <TIME> /;
     137                s/$hostname/<HOST>/;
     138                # Filter lines with malloc.  This is an artifact of memory testing
     139                # with the Mac testbed
     140                if ( ! m/\*\*\*\smalloc/ ) {
     141                print MODFILE ($_);
     142                print MODFILE2 ($_) if $resetStdout;
     143                }
     144            }
     145            # Close mod file
     146            close(MODFILE);
     147            close(MODFILE2) if $resetStdout;
     148            # Close STDERR file
     149            close(OUTFILE);
     150   
     151            # Open the STDERR file for reading
     152            open(OUTFILE, "< temp/$testFile.stderr");
     153            # Open mod file to place filtered STDERR
     154            open(MODFILE, "> temp/$testFile.stderr.mod");
     155            open(MODFILE2, "> verified/$testFile.stderr") if $resetStderr;
     156            # Replace the variable date, time and host information with constants
     157            while( <OUTFILE> ) {
     158                s/\d+:\d+:\d+/ <DATE> /;
     159                s/\s+\d+:\d+:\d+\w/ <TIME> /;
     160                s/$hostname/<HOST>/;
     161                # Filter lines with malloc.  This is an artifact of memory testing
     162                # with the Mac testbed
     163                if ( ! m/\*\*\*\smalloc/ ) {
     164                print MODFILE ($_);
     165                print MODFILE2 ($_) if $resetStderr;
     166                }
     167            }
     168            # Close mod file
     169            close(MODFILE);
     170            close(MODFILE2) if $resetStderr;
     171            # Close STDERR file
     172            close(OUTFILE);
     173   
     174            # Compare STDOUT capture with verified file
     175            $exitValue |= &compareStream("verified/$testFile.stdout");
     176   
     177            # Check exit value to determine if verified file doesn't exist
     178            if ( $exitValue & 2 ) {
     179   
     180                # STDOUT verified doesn't exist.  Search STDOUT capture
     181                # for strings indicating error or failure
     182                $exitValue |= &errorStrSearch("$testFile.stdout");
     183            }
     184   
     185            # Compare STDERR capture with verified file
     186            $exitValue |= &compareStream("verified/$testFile.stderr");
     187   
     188            # Check exit value to determine if verified file doesn't exist
     189            if ( $exitValue & 4 ) {
     190   
     191                # STDERR verified doesn't exist.  Search STDERR capture
     192                # for strings indicating error or failure
     193                $exitValue |= &errorStrSearch("$testFile.stderr");
     194            }
    97195        }
    98         $exitValue |= 256;
    99196    } else {
    100  
    101         # Test driver succeeded.
    102  
    103         # Create filtered version of stdout and stderr
    104      
    105         # Open the STDOUT file for reading
    106         open(OUTFILE, "< temp/$testFile.stdout");
    107         # Open mod file to place filtered STDOUT
    108         open(MODFILE, ">temp/$testFile.stdout.mod");
    109         # Replace the variable date, time and host information with constants
    110         $hostname = `hostname`;
    111         chop $hostname;
    112         while( <OUTFILE> ) {
    113             s/\d+:\d+:\d+/ <DATE> /;
    114             s/\s+\d+:\d+:\d+\w/ <TIME> /;
    115             s/$hostname/<HOST>/;
    116             # Filter lines with malloc.  This is an artifact of memory testing
    117             # with the Mac testbed
    118             if ( ! m/\*\*\*\smalloc/ ) {
    119                print MODFILE ($_);
    120             }
    121         }
    122         # Close mod file
    123         close(MODFILE);
    124         # Close STDERR file
    125         close(OUTFILE);
    126 
    127         # Open the STDERR file for reading
    128         open(OUTFILE, "< temp/$testFile.stderr");
    129         # Open mod file to place filtered STDERR
    130         open(MODFILE, "> temp/$testFile.stderr.mod");
    131         # Replace the variable date, time and host information with constants
    132         while( <OUTFILE> ) {
    133             s/\d+:\d+:\d+/ <DATE> /;
    134             s/\s+\d+:\d+:\d+\w/ <TIME> /;
    135             s/$hostname/<HOST>/;
    136             # Filter lines with malloc.  This is an artifact of memory testing
    137             # with the Mac testbed
    138             if ( ! m/\*\*\*\smalloc/ ) {
    139                print MODFILE ($_);
    140             }
    141         }
    142         # Close mod file
    143         close(MODFILE);
    144         # Close STDERR file
    145         close(OUTFILE);
    146 
    147         # Compare STDOUT capture with verified file
    148         $exitValue |= &compareStream("verified/$testFile.stdout");
    149 
    150         # Check exit value to determine if verified file doesn't exist
    151         if ( $exitValue & 2 ) {
    152 
    153             # STDOUT verified doesn't exist.  Search STDOUT capture
    154             # for strings indicating error or failure
    155             $exitValue |= &errorStrSearch("$testFile.stdout");
    156         }
    157 
    158         # Compare STDERR capture with verified file
    159         $exitValue |= &compareStream("verified/$testFile.stderr");
    160 
    161         # Check exit value to determine if verified file doesn't exist
    162         if ( $exitValue & 4 ) {
    163 
    164             # STDERR verified doesn't exist.  Search STDERR capture
    165             # for strings indicating error or failure
    166             $exitValue |= &errorStrSearch("$testFile.stderr");
    167         }
    168     }
    169 } else {
    170     # Since test driver doesn't exist or is not executable then display
    171     # message to user.
    172     print("        Need to specify an executable test file within directory.\n");
    173    
    174     # Exit value set to indicate test driver doesn't exist or not executable
    175     $exitValue |= 32;
     197        # Since test driver doesn't exist or is not executable then display
     198        # message to user.
     199        print("        Need to specify an executable test file within directory.\n");
     200       
     201        # Exit value set to indicate test driver doesn't exist or not executable
     202        $exitValue |= 32;
     203    }
    176204}
    177205
Note: See TracChangeset for help on using the changeset viewer.