Changeset 3623 for trunk/psModules/test/runTest
- Timestamp:
- Apr 1, 2005, 10:11:19 AM (21 years ago)
- File:
-
- 1 edited
-
trunk/psModules/test/runTest (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psModules/test/runTest
r2140 r3623 18 18 # 0 Test run successfull and all tests passed 19 19 # 1 Verified directory did not exist 20 # 2 Verified STDOUT file did not exist21 # 4 Verified STDERR file did not exist22 20 # 8 STDOUT files did not compare 23 21 # 16 STDERR files did not compare 24 22 # 32 Test driver doesn't exist or is not executable 25 # 64 STDOUT captured contains error strings 26 # 128 STDERR captured contains error strings 27 # 256 Test driver did not return zero 23 # 64 Test driver did not return zero 28 24 # 29 25 # SYNOSIS: runTest testDriverName 30 26 # 31 27 # $Revison: $ $Name: not supported by cvs2svn $ 32 # $Date: 200 4-10-14 23:58:56$28 # $Date: 2005-04-01 20:11:19 $ 33 29 # 34 30 # Copyright 2004 Maui High Performance Computering Center, University of Hawaii … … 36 32 ################################################################################ 37 33 38 # Provides functions for handling longcommand line options34 # Provides functions for handling psS64 command line options 39 35 use Getopt::Long; 36 37 $verifiedDir = "verified"; 40 38 41 39 # Assign variables based on the presence of command line options to the script … … 44 42 "resetStderr!" => \$resetStderr, 45 43 "resetStdout!" => \$resetStdout, 44 "verified=s" => \$verifiedDir, 46 45 "help!" => \$help 47 46 ); 48 47 49 if ($help ) {48 if ($help || $#ARGV < 0) { 50 49 print 51 50 "Usage: runTest [--reset] [--resetStderr] [--resetStdout] testfile(s)\n\n"; … … 62 61 63 62 # Set up the PSLIB_ROOT environment variable if the user doesn't have it set 64 if ( !$ENV{'PSLIB_ROOT'} ) { 65 66 # Use the directory directly above test 67 $PSLIB_ROOT = `cd ..;pwd`; 68 69 # Remove newline for the end of path returned 70 chomp($PSLIB_ROOT); 71 72 # Set the environment variable 73 $ENV{'PSLIB_ROOT'} = $PSLIB_ROOT; 74 75 # Display message that PSLIB_ROOT not found and set to 76 print("PSLIB_ROOT not found: set to $PSLIB_ROOT\n"); 77 } 78 79 # Add PSLIB_ROOT/lib to LD_LIBRARY_PATH and DYLD_LIBRARY_PATH environment vars 80 $ENV{'LD_LIBRARY_PATH'} = "$ENV{'PSLIB_ROOT'}/lib:$ENV{'LD_LIBRARY_PATH'}"; 81 $ENV{'DYLD_LIBRARY_PATH'} = "$ENV{'PSLIB_ROOT'}/lib:$ENV{'DYLD_LIBRARY_PATH'}"; 63 if ( $ENV{'PSLIB_ROOT'} ) { 64 65 # Add PSLIB_ROOT/lib to LD_LIBRARY_PATH and DYLD_LIBRARY_PATH environment vars 66 $ENV{'LD_LIBRARY_PATH'} = "$ENV{'PSLIB_ROOT'}/src/.libs:$ENV{'LD_LIBRARY_PATH'}"; 67 $ENV{'DYLD_LIBRARY_PATH'} = "$ENV{'PSLIB_ROOT'}/src/.libs:$ENV{'DYLD_LIBRARY_PATH'}"; 68 } 82 69 83 70 # Loop through the arguements passed to the script … … 97 84 98 85 # Check if a verified directory exists in the current work directory 99 if ( !( -e "verified") ) {86 if ( !( -e $verifiedDir ) ) { 100 87 101 88 # Display message that verified subdirectory doesn't exist … … 125 112 # Display failure message with return value to user 126 113 if ( $? != 0 && ( $testFile !~ /^A/i ) ) { 127 print( 128 " Failed - Test Driver expected 0 return value (Return value $?)\n" 129 ); 114 print("Failed - Test Driver returned $?, expected 0.\n"); 130 115 } 131 116 elsif ( $? == 0 && ( $testFile =~ /^A/i ) ) { 132 print( 133 " Failed - Test Driver expected abort (Return value $?)\n" 134 );135 }136 $exitValue |= 256; 137 }138 else { 139 140 # Test driver succeeded. 141 142 # Create filtered version of stdout and stderr143 144 # Open the STDOUT file for reading145 open( OUTFILE, "< temp/$testFile.stdout" );146 147 # Open mod file to place filtered STDOUT 148 open( MODFILE, "> temp/$testFile.stdout.mod" );149 open( MODFILE2, "> verified/$testFile.stdout" ) if $resetStdout;150 151 # Replace the variable date, time and host information with constants152 $hostname = `hostname`;153 chop $hostname;154 while (<OUTFILE>) {155 s/\s+\d+:\d+:\d+\w/<TIME>/g;156 s/\d+:\d+:\d+/<DATE>/g;157 s/$hostname\s*/<HOST>/g;158 s/: Line \d+/: Line <LINENO>/g;159 s/\:\d+/\:<LINENO>/g;160 s/allocate \d+ bytes at/allocate <N> bytes at/g; 161 162 # Filter lines with malloc. This is an artifact of memory testing163 # with the Mac testbed164 if ( !m/\*\*\*\smalloc/ ) {165 print MODFILE ($_);166 print MODFILE2 ($_) if $resetStdout;167 }168 } 169 170 # Close mod file171 close(MODFILE);172 close(MODFILE2) if $resetStdout; 173 174 # Close STDERR file175 close(OUTFILE); 176 177 # Open the STDERR file for reading178 open( OUTFILE, "< temp/$testFile.stderr" ); 179 180 # Open mod file to place filtered STDERR181 open( MODFILE, "> temp/$testFile.stderr.mod" );182 open( MODFILE2, "> verified/$testFile.stderr" ) if $resetStderr; 183 184 # Replace the variable date, time and host information with constants185 while (<OUTFILE>) {186 s/\s+\d+:\d+:\d+\w/<TIME>/g;187 s/\d+:\d+:\d+/<DATE>/g;188 s/$hostname\s*/<HOST>/g;189 s/: Line \d+/: Line <LINENO>/g;190 s/\:\d+/\:<LINENO>/g;191 s/allocate \d+ bytes at/allocate <N> bytes at/g;192 193 # Filter lines with malloc. This is an artifact of memory testing 194 # with the Mac testbed195 if ( !m/\*\*\*\smalloc/ ) {196 print MODFILE ($_);197 print MODFILE2 ($_) if $resetStderr;198 }199 } 200 201 # Close mod file 202 close(MODFILE);203 close(MODFILE2) if $resetStderr;204 205 # Close STDERR file 206 close(OUTFILE);207 208 # Compare STDOUT capture with verified file 209 $exitValue |= &compareStream("verified/$testFile.stdout");210 211 # Check exit value to determine if verified file doesn't exist 212 if ( $exitValue & 2 ) {213 214 # STDOUT verified doesn't exist. Search STDOUT capture 215 # for strings indicating error or failure216 $exitValue |= &errorStrSearch("$testFile.stdout");217 }218 219 # Compare STDERR capture with verified file 220 $exitValue |= &compareStream("verified/$testFile.stderr");221 222 # Check exit value to determine if verified file doesn't exist 223 if ( $exitValue & 4 ) {224 225 # STDERR verified doesn't exist. Search STDERR capture 226 # for strings indicating error or failure227 $exitValue |= &errorStrSearch("$testFile.stderr");228 }229 } 230 }117 print("Failed - Test Driver returned $?, expected abort.\n"); 118 } 119 $exitValue |= 64; 120 } 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 129 # Open mod file to place filtered STDOUT 130 open( MODFILE, "> temp/$testFile.stdout.mod" ); 131 open( MODFILE2, "> $verifiedDir/$testFile.stdout" ) if $resetStdout; 132 133 # Replace the variable date, time and host information with constants 134 $hostname = `hostname`; 135 chop $hostname; 136 while (<OUTFILE>) { 137 s/\s+\d+:\d+:\d+\w/<TIME>/g; 138 s/\d+:\d+:\d+/<DATE>/g; 139 s/$hostname\s*/<HOST>/g; 140 s/: Line \d+/: Line <LINENO>/g; 141 s/\(.*\:\d+\)/\(FILE\:LINENO\)/g; 142 s/\s+[\_\-\/\.\w]+\:\d+/ FILE\:LINENO/g; 143 s/allocate \d+ bytes at/allocate <N> bytes at/g; 144 s/v\d+.\d+.\d+/vX.X.X/g; 145 146 # Filter lines with malloc. This is an artifact of memory testing 147 # with the Mac testbed 148 if ( !m/\*\*\*\smalloc/ ) { 149 print MODFILE ($_); 150 print MODFILE2 ($_) if $resetStdout; 151 } 152 } 153 154 # Close mod file 155 close(MODFILE); 156 close(MODFILE2) if $resetStdout; 157 158 # Close STDERR file 159 close(OUTFILE); 160 161 # Open the STDERR file for reading 162 open( OUTFILE, "< temp/$testFile.stderr" ); 163 164 # Open mod file to place filtered STDERR 165 open( MODFILE, "> temp/$testFile.stderr.mod" ); 166 open( MODFILE2, "> $verifiedDir/$testFile.stderr" ) if $resetStderr; 167 168 # Replace the variable date, time and host information with constants 169 while (<OUTFILE>) { 170 s/\s+\d+:\d+:\d+\w/<TIME>/g; 171 s/\d+:\d+:\d+/<DATE>/g; 172 s/$hostname\s*/<HOST>/g; 173 s/: Line \d+/: Line <LINENO>/g; 174 s/\(.*\:\d+\)/\(FILE\:LINENO\)/g; 175 s/\s+[\_\-\/\.\w]+\:\d+/ FILE\:LINENO/g; 176 s/allocate \d+ bytes at/allocate <N> bytes at/g; 177 s/v\d+.\d+.\d+/vX.X.X/g; 178 179 # Filter lines with malloc. This is an artifact of memory testing 180 # with the Mac testbed 181 if ( !m/\*\*\*\smalloc/ ) { 182 print MODFILE ($_); 183 print MODFILE2 ($_) if $resetStderr; 184 } 185 } 186 187 # Close mod file 188 close(MODFILE); 189 close(MODFILE2) if $resetStderr; 190 191 # Close STDERR file 192 close(OUTFILE); 193 194 # Compare STDOUT capture with verified file 195 $exitValue |= &compareStream("$verifiedDir/$testFile.stdout"); 196 197 # Check exit value to determine if verified file doesn't exist 198 if ( $exitValue & 2 ) { 199 200 # STDOUT verified doesn't exist. Search STDOUT capture 201 # for strings indicating error or failure 202 $exitValue |= &errorStrSearch("$testFile.stdout"); 203 } 204 205 # Compare STDERR capture with verified file 206 $exitValue |= &compareStream("$verifiedDir/$testFile.stderr"); 207 208 # Check exit value to determine if verified file doesn't exist 209 if ( $exitValue & 4 ) { 210 211 # STDERR verified doesn't exist. Search STDERR capture 212 # for strings indicating error or failure 213 $exitValue |= &errorStrSearch("$testFile.stderr"); 214 } 215 } 231 216 else { 232 217 … … 320 305 # 321 306 # Return: 0 - Compare successful 322 # 2 - STDOUT verified file doesn't exist323 # 4 - STDERR verified file doesn't exist324 307 # 8 - STDOUT verified file doesn't compare 325 308 # 16 - STDERR verified file doesn't compare … … 333 316 334 317 # Check for existence of verified STD stream files 335 if ( !( -e $streamFile ) ) { 336 337 # Display message to user that verified STDOUT file doesn't exist 338 print(" File $streamFile doesn't exist.\n"); 339 340 # Set exit value bit 1 to indicate proper failure 341 if ( $streamFile =~ /out$/ ) { 342 $returnVal |= 2; 343 } 344 elsif ( $streamFile =~ /err$/ ) { 345 $returnVal |= 4; 346 } 347 } 348 else { 318 if ( -e $streamFile ) { 349 319 350 320 # Verified STD stream file exists … … 352 322 # Create name of the temp file to compare 353 323 $tempFile = $streamFile; 354 $tempFile =~ s/ verified/temp/;324 $tempFile =~ s/$verifiedDir/temp/; 355 325 $tempFile = $tempFile . ".mod"; 356 326
Note:
See TracChangeset
for help on using the changeset viewer.
