Index: /trunk/psLib/test/FullUnitTest
===================================================================
--- /trunk/psLib/test/FullUnitTest	(revision 584)
+++ /trunk/psLib/test/FullUnitTest	(revision 585)
@@ -19,6 +19,6 @@
 #  RETURN : integer number of tests which failed
 #
-#  $Revision: 1.1 $  $Name: not supported by cvs2svn $
-#  $Date: 2004-04-27 01:47:20 $
+#  $Revision: 1.2 $  $Name: not supported by cvs2svn $
+#  $Date: 2004-05-06 00:45:10 $
 #
 #  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -131,4 +131,6 @@
 #     Parameter(s):  base directory to start testing
 #
+#     Return:  None
+#
 ################################################################################
 
@@ -175,4 +177,6 @@
 #
 #      Parameter(s):  base directory where make and test drivers are located
+#
+#      Return:  None
 #
 ################################################################################
@@ -243,4 +247,5 @@
     local(@files,$j);
     local($pwd);
+    local($exitValue) = 0;
 
     # Set variable to pwd to current test directory
@@ -276,11 +281,11 @@
                     # Display message to user that verified directories do not 
                     # exist eventhough TST files have been found
-                    print("Unable to execute test drivers in $base_dir\n");
+#                    print("Unable to execute test drivers in $base_dir\n");
                     print("No verified subdirectory present.\n");
                     # Increment test fail count
-                    $testFailCount++;
+ #                   $testFailCount++;
                     # Save the file failed
-                    push(@testsFailed, $pwd . "/" . $files[$j]);
-                    return;
+#                    push(@testsFailed, $pwd . "/" . $files[$j]);
+#                    return;
                 }
             }
@@ -305,8 +310,11 @@
                 # Perform difference on STDOUT file collected
                 # with verified files
-                $diffstdout = `diff verified/$files[$j].stdout temp/$files[$j].stdout.mod`;
-                if ( $? != 0 ) {
-                    # Display test output didn't compare
-                    print("STDOUT did not compare for $files[$j].\n$diffstdout\n");
+                $exitValue = &compareStream("verified/$files[$j].stdout");
+                if ( $exitValue & 2 ) {
+                    # STDOUT verified doesn't exist. Search STDOUT capture
+                    # for strings indicating error or failure
+                    $exitValue |= &errorStrSearch("$files[$j].stdout");
+                }
+                if ( ($exitValue & 8) || ($exitValue & 64) ) {
                     # Increment the total number of test failed
                     $testFailCount++;
@@ -315,8 +323,14 @@
                 } else {
                     # Perform difference on STDERR file collection with verified
-                    $diffstderr = `diff verified/$files[$j].stderr temp/$files[$j].stderr.mod`;
-                    if ( $? != 0 ) {
-                        print("STDERR did not compare for $files[$j].\n$diffstderr\n");
+                    $exitValue = &compareStream("verified/$files[$j].stderr");
+                    if ( $exitValue & 4 ) {
+                        # STDERR verified doesn't exist. Search STDERR capture
+                        # for strings indicating error or failure
+                        $exitValue |= &errorStrSearch("$files[$j].stderr");
+                    }
+                    if ( ($exitValue & 16) || ($exitValue & 128) ) {
+                        # Increment the total number of tests failed
                         $testFailCount++;
+                        # Push test on failed list
                         push(@testsFailed, $pwd . "/" . $files[$j]);
                     } else {
@@ -332,4 +346,121 @@
 ################################################################################
 #
+#  SUBROUTINE: errorStrSearch
+#
+#      Description:  This subroutine will search the file specified in its
+#                    parameter for error strings and if they do exists
+#                    the appropriate value will be returned.
+#
+#      Parameter(s): fileName - input file to search for strings
+#
+#      Return:   0  -  No error strings found
+#               64  -  Error strings found in STDOUT
+#              128  -  Error strings found in STDERR
+#
+###############################################################################
+
+sub errorStrSearch {
+    local($fileName) = @_;
+    local($returnVal) = 0;
+
+    # Open the captured file
+    open(CAPT_FILE, "<temp/$fileName");
+
+    # Scan through all the lines of the file searching for error strings
+    while ( <CAPT_FILE> ) {
+        if ( m/FAIL/i || m/FAULT/i || m/ERROR/i || m/Not Found/i
+                      || m/SIGNAL/i || m/NO SUCH FILE/i || m/|E|/i
+                      || m/|A|/i ) {
+            if ( $fileName =~ m/out/ ) {
+                print("        Failed - File $fileName contains error strings.\n");
+                $returnVal = 64;
+            } elsif ( $fileName =~ m/err/ ) {
+                print("        Failed - File $fileName contains error strings.\n");
+                $returnVal = 128;
+            }
+            last;
+        }
+    }
+    # Close the capture file
+    close(CAPT_FILE);
+    # Return the return value
+    return($returnVal);
+}
+
+################################################################################
+#
+#  SUBROUTINE: compareStream
+#
+#      Description:  This subroutine will compare the captured stream file with
+#                    a file in the verified directory if one exists.
+#
+#      Parameter(s): streamFile - input file to compare
+#
+#      Return:   0  -  Compare successful
+#                2  -  STDOUT verified file doesn't exist
+#                4  -  STDERR verified file doesn't exist
+#                8  -  STDOUT verified file doesn't compare
+#               16  -  STDERR verified file doesn't compare
+#
+###############################################################################
+
+sub compareStream {
+    local($streamFile) = @_;
+    local($returnVal) = 0;
+    local($tempFile) = "";
+
+    # Check for existence of verified STD stream files
+    if ( !( -e $streamFile) ) {
+
+        # Display message to user that verified STDOUT file doesn't exist
+        print("        File $streamFile doesn't exist.\n");
+
+        # Set exit value bit 1 to indicate proper failure
+        if ( $streamFile =~ /out$/ ) {
+            $returnVal |= 2;
+        } elsif ( $streamFile =~ /err$/ ) {
+            $returnVal |= 4;
+        }
+    } else {
+
+        # Verified STD stream file exists
+
+        # Create name of the temp file to compare
+        $tempFile = $streamFile;
+        $tempFile =~ s/verified/temp/;
+        $tempFile = $tempFile . ".mod";
+
+        # Perform difference on the STD stream files
+        $diffstdout = `diff $streamFile $tempFile`;
+
+        # Check the return value of the difference
+        if ( $? != 0 ) {
+
+            # Difference of STD stream files failed
+
+            # Check for STDOUT in file name to convey appropirate return value
+            if ( $streamFile =~ /out$/ ) {
+               # Display message of the failure of difference to user
+               print("        Failed - STDOUT difference\n$diffstdout\n");
+
+               # Exit value to indicate STDOUT did not compare
+               $returnVal |= 8;
+            } elsif ( $streamFile =~ /err$/ ) {
+               # Display message of the failure of difference to user
+               print("        Failed - STDERR difference\n$diffstdout\n");
+
+               # Exit value to indicate STDERR did not compare
+               $returnVal |= 16;
+            }
+        }
+    }
+
+    # Return the result of the compare
+    return($returnVal);
+}
+
+
+################################################################################
+#
 #  SUBROUTINE: checkForTempDirectory
 #
@@ -406,5 +537,5 @@
        s/\d+:\d+:\d+/ <DATE> /;
        s/\s+\d+:\d+:\d+\w/ <TIME> /;
-       s/\|\S+\|/<HOST>| /;
+       s/\|[\w\.]+\|/<HOST> |/;
        print MODFILE ($_);
    }
@@ -422,5 +553,5 @@
        s/\d+:\d+:\d+/ <DATE> /;
        s/\s+\d+:\d+:\d+\w/ <TIME> /;
-       s/\|\S+\|/<HOST>| /;
+       s/\|[\w\.]+\|/<HOST> |/;
        print MODFILE ($_);
    }
@@ -431,58 +562,2 @@
 }
 
-
-
-
-
-    # Check for the existence of a file named UnitTest in current directory
-#    if (-e "UnitTest") {
-
-        # Open the UnitTest file
-#        open(TESTFILE,"<UnitTest");
-
-        # Loop through the UnitTest file contents line by line
-#        while(<TESTFILE>) {
-
-            # Set variable line and remove any newline characters
-#            $line = $_;
-#            chomp($line);
-
-            # Check if line doesn't have comment character '#' or is empty
-#            if ( ! ($line =~ m/^#/) && $line) {
-
-                # Increment total number of tests drivers executed
-#               $totalTests++;
-
-                # Display line of the test driver being executed
-                # if silent option not set
-#                print("Testing: '$line'\n") if ( ! $silent);
-
-                # Execute the test driver and save results
-#                $_ = join("\n:: ", split("\n","\n" . `$line`));
-
-                # Check the output of test driver execution for a return
-                # value != 0 or any of the following phrases: FAILED
-                # FAULT, ERROR, Not found, SIGNAL
-#                if (($? != 0) || m/FAILED/i || m/FAULT/i || m/ERROR/i
-#                              || m/Not Found/i || m/SIGNAL/i ) {
-
-                    # Dispaly failed output of test driver
-#                    print("$_\n") if ( ! $silent);
-                    # Display the test driver failed
-#                    print("\nTest for '$line' Failed (Return value $?).\n");
-                    # Increment number of tests failed
-#                    $testFailCount++;
-                    # Push the current working directory ont the list of
-                    # failed test drivers list
-#                    push(@testsFailed, $pwd . ":" . $line);
-#                } else {
-                    # Display results of successful test if verbose
-#                    printf("$_\n") if ($verbose);
-                    # Display success if silent not set
-#                    printf("Test successful.\n") if ( ! $silent);
-#                }
-#            }
-#        }
-#    }
-#}
-
Index: /trunk/psLib/test/runTest
===================================================================
--- /trunk/psLib/test/runTest	(revision 584)
+++ /trunk/psLib/test/runTest	(revision 585)
@@ -6,8 +6,11 @@
 #  deemed a failure.  STDOUT and STDERR files will be place in a subdirectory
 #  named temp and the files will be compared with verified STDOUT, STDERR files
-#  in a subdirectory named verified.
+#  in a subdirectory named verified.  If there are no STDOUT, STDERR files in 
+#  the verified directory, the captured STDOUT, STDERR files will be scanned
+#  for words which indicate a failure.
 #
 #  Assumptions:  A verified subdirectory with STDOUT, STDERR files exists for 
-#                the test driver specified in the arguements.
+#                the test driver specified in the arguements if an exact
+#                match of the streams STDOUT, STDERR is necessary.
 #
 #  Return values:
@@ -20,9 +23,12 @@
 #                16    STDERR files did not compare
 #                32    Test driver doesn't exist or is not executable
-#            
+#                64    STDOUT captured contains error strings
+#               128    STDERR captured contains error strings
+#               256    Test driver did not return zero
+#
 #  SYNOSIS:  runTest testDriverName
 #
 #  $Revison:  $  $Name: not supported by cvs2svn $
-#  $Date: 2004-04-27 01:47:20 $
+#  $Date: 2004-05-06 00:45:10 $
 #
 #  Copyright 2004 Maui High Performance Computering Center, University of Hawaii
@@ -63,7 +69,7 @@
 if ( !( -e "verified" )) {
     # Display message that verified subdirectory doesn't exist
-    print("Verified directory doesn't exist.  Need verified STDOUT, STDERR files.\n");
+    print("        Verified directory doesn't exist.\n");
     # Exit script since the test cannot be run with verified files
-    exit(1);
+    $exitValue = 1;
 }
 
@@ -86,104 +92,67 @@
         # Display failure message with return value to user
         if ( $? != 0 && ( $testFile !~ /^A/i) ) {
-            print("Failed - Test Driver expected 0 return value (Return value $?)\n");
+            print("        Failed - Test Driver expected 0 return value (Return value $?)\n");
         } elsif ( $? == 0 && ( $testFile =~ /^A/i) ) {
-            print("Failed - Test Driver expected abort (Return value $?)\n");
-        }
+            print("        Failed - Test Driver expected abort (Return value $?)\n");
+        }
+        $exitValue |= 256;
     } else {
   
         # Test driver succeeded.
-        
-        # Check for existence of verified STDOUT files
-        if ( !( -e "verified/$testFile.stdout") ) {
-            
-            # Display message to user that verified STDOUT file doesn't exist
-            print("Verified file $testFile.stdout doesn't exist.  Test stopped.\n");
-            
-            # Set exit value bit 1 to indicate proper failure
-            $exitValue |= 2;
-        } else {
-
-            # Verified STDOUT file exists
-            
-            # Open the STDOUT file for reading
-            open(OUTFILE, "< temp/$testFile.stdout");
-            # Open mod file to place filtered STDOUT
-            open(MODFILE, ">temp/$testFile.stdout.mod");
-            # Replace the variable date, time and host information with constants
-            while( <OUTFILE> ) {
-                s/\d+:\d+:\d+/ <DATE> /;
-                s/\s+\d+:\d+:\d+\w/ <TIME> /;
-                s/\|\S+\|/<HOST>| /;
-                print MODFILE ($_);
-            }
-            # Close mod file
-            close(MODFILE);
-            # Close STDERR file
-            close(OUTFILE);
-
-            # Open the STDERR file for reading 
-            open(OUTFILE, "< temp/$testFile.stderr");
-            # Open mod file to place filtered STDERR
-            open(MODFILE, "> temp/$testFile.stderr.mod");
-            # Replace the variable date, time and host information with constants
-            while( <OUTFILE> ) {
-                s/\d+:\d+:\d+/ <DATE> /;
-                s/\s+\d+:\d+:\d+\w/ <TIME> /;
-                s/\|\S+\|/<HOST>| /;
-                print MODFILE ($_);
-            }
-            # Close mod file
-            close(MODFILE);
-            # Close STDERR file
-            close(OUTFILE);
-
-            # Perform difference on the STDOUT files
-            $diffstdout = `diff verified/$testFile.stdout temp/$testFile.stdout.mod`;
-
-            # Check the return value of the difference
-            if ( $? != 0 ) {
-   
-                # Difference of STDOUT files failed
-
-                # Display message of the failure of difference to user
-                print("Failed - STDOUT difference\n$diffstdout\n");
   
-                # Exit value to indicate STDOUT did not compare
-                $exitValue |= 8;
-            } else {
-
-                # STDOUT file compared successfully
-                
-                # Check for the existence of verified STDERR file
-                if ( !( -e "verified/$testFile.stderr") ) {
-
-                    # Display message to user that STDOUT file doesn't exist
-                    print("Verified file $testFile.stderr doesn't exist.  Test stopped.\n");
-
-                    $exitValue |= 4;
-                } else {
-
-                    # Perform difference on the STDERR files
-                    $diffstderr = `diff verified/$testFile.stderr temp/$testFile.stderr.mod`;
-
-                    # Check the return value of the difference
-                    if ( $? != 0 ) {
-
-                        # Difference of STDERR files failed
-
-                        # Display message of the failure of difference to user
-                        print("Failed - STDERR difference\n$diffstderr\n");
-
-                        # Exit value set to indicate STDERR did not compare
-                        $exitValue |= 16;
-                    } else {
-
-                        # Test driver passed, STDOUT, STDERR files compared
-                    
-                        # Display message test was successful
-                        print("Test successful\n");
-                    }
-                }
-            } 
+        # Create filtered version of stdout and stderr
+      
+        # Open the STDOUT file for reading
+        open(OUTFILE, "< temp/$testFile.stdout");
+        # Open mod file to place filtered STDOUT
+        open(MODFILE, ">temp/$testFile.stdout.mod");
+        # Replace the variable date, time and host information with constants
+        while( <OUTFILE> ) {
+            s/\d+:\d+:\d+/ <DATE> /;
+            s/\s+\d+:\d+:\d+\w/ <TIME> /;
+            s/\|[\w\.]+\|/<HOST> |/;
+            print MODFILE ($_);
+        }
+        # Close mod file
+        close(MODFILE);
+        # Close STDERR file
+        close(OUTFILE);
+
+        # Open the STDERR file for reading 
+        open(OUTFILE, "< temp/$testFile.stderr");
+        # Open mod file to place filtered STDERR
+        open(MODFILE, "> temp/$testFile.stderr.mod");
+        # Replace the variable date, time and host information with constants
+        while( <OUTFILE> ) {
+            s/\d+:\d+:\d+/ <DATE> /;
+            s/\s+\d+:\d+:\d+\w/ <TIME> /;
+            s/\|[\w\.]+\|/<HOST> |/;
+            print MODFILE ($_);
+        }
+        # Close mod file
+        close(MODFILE);
+        # Close STDERR file
+        close(OUTFILE);
+
+        # Compare STDOUT capture with verified file
+        $exitValue |= &compareStream("verified/$testFile.stdout");
+
+        # Check exit value to determine if verified file doesn't exist
+        if ( $exitValue & 2 ) {
+
+            # STDOUT verified doesn't exist.  Search STDOUT capture
+            # for strings indicating error or failure
+            $exitValue |= &errorStrSearch("$testFile.stdout");
+        }
+
+        # Compare STDERR capture with verified file
+        $exitValue |= &compareStream("verified/$testFile.stderr");
+
+        # Check exit value to determine if verified file doesn't exist
+        if ( $exitValue & 4 ) {
+
+            # STDERR verified doesn't exist.  Search STDERR capture
+            # for strings indicating error or failure
+            $exitValue |= &errorStrSearch("$testFile.stderr");
         }
     }
@@ -191,5 +160,5 @@
     # Since test driver doesn't exist or is not executable then display 
     # message to user.
-    print("Need to specify an executable test file within directory.\n");
+    print("        Need to specify an executable test file within directory.\n");
     
     # Exit value set to indicate test driver doesn't exist or not executable
@@ -197,5 +166,128 @@
 }
 
-# Exit for the script with exit vale
+# Exit for the script with exit value
+# Ignore the first three bit flags in exitValue since there are not indicators
+# of a failed test
+if ( ($exitValue >> 3) != 0 ) {
+    print("Test failed - return status = $exitValue\n\n");
+} else {
+    print("Test successful\n\n");
+}
 exit($exitValue);
 
+################################################################################
+#
+#  SUBROUTINE: errorStrSearch
+#
+#      Description:  This subroutine will search the file specified in its
+#                    parameter for error strings and if they do exists
+#                    the appropriate value will be returned.
+#
+#      Parameter(s): fileName - input file to search for strings
+#
+#      Return:   0  -  No error strings found
+#               64  -  Error strings found in STDOUT
+#              128  -  Error strings found in STDERR
+#
+###############################################################################
+
+sub errorStrSearch {
+    local($fileName) = @_;
+    local($returnVal) = 0;
+
+    # Open the captured file
+    open(CAPT_FILE, "<temp/$fileName");
+
+    # Scan through all the lines of the file searching for error strings
+    while ( <CAPT_FILE> ) {
+        if ( m/FAIL/i || m/FAULT/i || m/ERROR/i || m/Not Found/i
+                      || m/SIGNAL/i || m/NO SUCH FILE/i || m/|E|/i
+                      || m/|A|/i ) {
+            if ( $fileName =~ m/out/ ) {
+                print("        Failed - File $fileName contains error strings.\n");
+                $returnVal = 64;
+            } elsif ( $fileName =~ m/err/ ) {
+                print("        Failed - File $fileName contains error strings.\n");
+                $returnVal = 128;
+            }
+            last;
+        }
+    }
+    # Close the capture file
+    close(CAPT_FILE);
+    # Return the return value
+    return($returnVal);
+}
+
+################################################################################
+#
+#  SUBROUTINE: compareStream
+#
+#      Description:  This subroutine will compare the captured stream file with
+#                    a file in the verified directory if one exists.
+#
+#      Parameter(s): streamFile - input file to compare
+#
+#      Return:   0  -  Compare successful
+#                2  -  STDOUT verified file doesn't exist
+#                4  -  STDERR verified file doesn't exist
+#                8  -  STDOUT verified file doesn't compare
+#               16  -  STDERR verified file doesn't compare
+#
+###############################################################################
+
+sub compareStream {
+    local($streamFile) = @_;
+    local($returnVal) = 0;
+    local($tempFile) = "";
+
+    # Check for existence of verified STD stream files
+    if ( !( -e $streamFile) ) {
+            
+        # Display message to user that verified STDOUT file doesn't exist
+        print("        File $streamFile doesn't exist.\n");
+            
+        # Set exit value bit 1 to indicate proper failure
+        if ( $streamFile =~ /out$/ ) {
+            $returnVal |= 2;
+        } elsif ( $streamFile =~ /err$/ ) {
+            $returnVal |= 4;
+        }
+    } else {
+
+        # Verified STD stream file exists
+
+        # Create name of the temp file to compare
+        $tempFile = $streamFile; 
+        $tempFile =~ s/verified/temp/;
+        $tempFile = $tempFile . ".mod";
+   
+        # Perform difference on the STD stream files
+        $diffstdout = `diff $streamFile $tempFile`;
+
+        # Check the return value of the difference
+        if ( $? != 0 ) {
+   
+            # Difference of STD stream files failed
+
+            # Check for STDOUT in file name to convey appropirate return value
+            if ( $streamFile =~ /out$/ ) {
+               # Display message of the failure of difference to user
+               print("        Failed - STDOUT difference\n$diffstdout\n");
+  
+               # Exit value to indicate STDOUT did not compare
+               $returnVal |= 8;
+            } elsif ( $streamFile =~ /err$/ ) {
+               # Display message of the failure of difference to user
+               print("        Failed - STDERR difference\n$diffsdout\n");
+
+               # Exit value to indicate STDERR did not compare
+               $returnVal |= 16;
+            }
+        }
+    }
+    
+    # Return the result of the compare
+    return($returnVal);
+}
+
