Index: trunk/psLib/test/runTest
===================================================================
--- trunk/psLib/test/runTest	(revision 1198)
+++ trunk/psLib/test/runTest	(revision 1212)
@@ -30,5 +30,5 @@
 #
 #  $Revison:  $  $Name: not supported by cvs2svn $
-#  $Date: 2004-07-08 19:34:18 $
+#  $Date: 2004-07-13 01:37:58 $
 #
 #  Copyright 2004 Maui High Performance Computering Center, University of Hawaii
@@ -36,4 +36,23 @@
 ################################################################################
 
+# Provides functions for handling long command line options
+use Getopt::Long;
+
+# Assign variables based on the presence of command line options to the script
+GetOptions("reset!"=>\$reset,
+           "resetStderr!"=>\$resetStderr,
+           "resetStdout!"=>\$resetStdout,
+           "help!"=>\$help);
+
+if ($help) {
+    print "Usage: runTest [--reset] [--resetStderr] [--resetStdout] testfile(s)\n\n";
+    exit(0);
+}
+
+if ($reset) {
+    $resetStderr = 1;
+    $resetStdout = 1;
+}
+    
 # Initialize exit value
 $exitValue = 0;
@@ -55,123 +74,132 @@
 $ENV{'DYLD_LIBRARY_PATH'} = "$ENV{'PSLIB_ROOT'}/lib:$ENV{'DYLD_LIBRARY_PATH'}";
 
-# Get test driver name from arguement list
-$testFile = $ARGV[0];
-
-# Check if a temp directory already exists in the current work directory
-if ( !( -e "temp" )) {
-   # Create temp directory to store STDOUT, STDERR files during test run
-   `mkdir temp`;
-   # Display message of new directory created
-   print("Creating temp directory\n");
-}
-
-# Check if a verified directory exists in the current work directory
-if ( !( -e "verified" )) {
-    # Display message that verified subdirectory doesn't exist
-    print("        Verified directory doesn't exist.\n");
-    # Exit script since the test cannot be run with verified files
-    $exitValue = 1;
-}
-
-# Check if the test driver file exists and is executable
-if ( (-e $testFile) && (-x $testFile) ) {
-
-    # Display message the test driver is being executed
-    print("--- Executing test driver: $testFile\n");
-
-    # Invoke the test driver
-    system("./$testFile 1> temp/$testFile.stdout 2> temp/$testFile.stderr");
-
-    # Check the return value of the test driver.  A value other than 0
-    # indicates failure of the test driver unless the test driver is name
-    # with a leading 'a' which indicates the test driver is expecting an
-    # abort condition to terminate the driver.
-    if ( ( $? != 0  && ( $testFile !~ /^A/i)) || 
-         ( $? == 0  && ( $testFile =~ /^A/i)) ) {
-
-        # Display failure message with return value to user
-        if ( $? != 0 && ( $testFile !~ /^A/i) ) {
-            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");
+# Loop through the arguements passed to the script
+foreach (@ARGV) {
+    chomp;
+    $testFile = $_;
+
+    # Check if a temp directory already exists in the current work directory
+    if ( !( -e "temp" )) {
+    # Create temp directory to store STDOUT, STDERR files during test run
+    `mkdir temp`;
+    # Display message of new directory created
+    print("Creating temp directory\n");
+    }
+    
+    # Check if a verified directory exists in the current work directory
+    if ( !( -e "verified" )) {
+        # Display message that verified subdirectory doesn't exist
+        print("        Verified directory doesn't exist.\n");
+        # Exit script since the test cannot be run with verified files
+        $exitValue = 1;
+    }
+    
+    # Check if the test driver file exists and is executable
+    if ( (-e $testFile) && (-x $testFile) ) {
+    
+        # Display message the test driver is being executed
+        print("--- Executing test driver: $testFile\n");
+    
+        # Invoke the test driver
+        system("./$testFile 1> temp/$testFile.stdout 2> temp/$testFile.stderr");
+        
+        # Check the return value of the test driver.  A value other than 0
+        # indicates failure of the test driver unless the test driver is name
+        # with a leading 'a' which indicates the test driver is expecting an
+        # abort condition to terminate the driver.
+        if ( ( $? != 0  && ( $testFile !~ /^A/i)) || 
+            ( $? == 0  && ( $testFile =~ /^A/i)) ) {
+    
+            # Display failure message with return value to user
+            if ( $? != 0 && ( $testFile !~ /^A/i) ) {
+                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");
+            }
+            $exitValue |= 256;
+        } else {
+    
+            # Test driver succeeded.
+    
+            # 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");
+            open(MODFILE2, "> verified/$testFile.stdout") if $resetStdout;
+            # Replace the variable date, time and host information with constants
+            $hostname = `hostname`;
+            chop $hostname;
+            while( <OUTFILE> ) {
+                s/\d+:\d+:\d+/ <DATE> /;
+                s/\s+\d+:\d+:\d+\w/ <TIME> /;
+                s/$hostname/<HOST>/;
+                # Filter lines with malloc.  This is an artifact of memory testing
+                # with the Mac testbed
+                if ( ! m/\*\*\*\smalloc/ ) {
+                print MODFILE ($_);
+                print MODFILE2 ($_) if $resetStdout;
+                }
+            }
+            # Close mod file
+            close(MODFILE);
+            close(MODFILE2) if $resetStdout;
+            # 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");
+            open(MODFILE2, "> verified/$testFile.stderr") if $resetStderr;
+            # 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/$hostname/<HOST>/;
+                # Filter lines with malloc.  This is an artifact of memory testing
+                # with the Mac testbed
+                if ( ! m/\*\*\*\smalloc/ ) {
+                print MODFILE ($_);
+                print MODFILE2 ($_) if $resetStderr;
+                }
+            }
+            # Close mod file
+            close(MODFILE);
+            close(MODFILE2) if $resetStderr;
+            # 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");
+            }
         }
-        $exitValue |= 256;
     } else {
-  
-        # Test driver succeeded.
-  
-        # 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
-        $hostname = `hostname`;
-        chop $hostname;
-        while( <OUTFILE> ) {
-            s/\d+:\d+:\d+/ <DATE> /;
-            s/\s+\d+:\d+:\d+\w/ <TIME> /;
-            s/$hostname/<HOST>/;
-            # Filter lines with malloc.  This is an artifact of memory testing
-            # with the Mac testbed
-            if ( ! m/\*\*\*\smalloc/ ) {
-               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/$hostname/<HOST>/;
-            # Filter lines with malloc.  This is an artifact of memory testing
-            # with the Mac testbed
-            if ( ! m/\*\*\*\smalloc/ ) {
-               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");
-        }
-    }
-} else {
-    # 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");
-    
-    # Exit value set to indicate test driver doesn't exist or not executable
-    $exitValue |= 32;
+        # 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");
+        
+        # Exit value set to indicate test driver doesn't exist or not executable
+        $exitValue |= 32;
+    }
 }
 
