IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 3696


Ignore:
Timestamp:
Apr 12, 2005, 11:51:00 AM (21 years ago)
Author:
desonia
Message:

adjusted to match the latest SDRS for psLib (change of function names).

Location:
trunk/psModules
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/psModules/psmodule.kdevses

    r3675 r3696  
    66   <View0 line="24" Type="Source" />
    77  </Doc0>
    8   <Doc1 NumberOfViews="1" URL="file:///home/desonia/panstarrs/psModule/configure.ac" >
    9    <View0 line="10" Type="Source" />
     8  <Doc1 NumberOfViews="1" URL="file:///home/desonia/panstarrs/psModule/Makefile.am" >
     9   <View0 line="2" Type="Source" />
    1010  </Doc1>
    1111 </DocsAndViews>
  • trunk/psModules/src/pmObjects.c

    r3625 r3696  
    55 *  @author GLG, MHPCC
    66 *
    7  *  @version $Revision: 1.12 $ $Name: not supported by cvs2svn $
    8  *  @date $Date: 2005-04-01 20:47:40 $
     7 *  @version $Revision: 1.13 $ $Name: not supported by cvs2svn $
     8 *  @date $Date: 2005-04-12 21:51:00 $
    99 *
    1010 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    112112    }
    113113
    114     p_psMemSetDeallocator(tmp, (psFreeFcn) p_psModelFree);
     114    psMemSetDeallocator(tmp, (psFreeFcn) p_psModelFree);
    115115    return(tmp);
    116116}
     
    141141    tmp->moments = NULL;
    142142    tmp->models = NULL;
    143     p_psMemSetDeallocator(tmp, (psFreeFcn) p_psSourceFree);
     143    psMemSetDeallocator(tmp, (psFreeFcn) p_psSourceFree);
    144144
    145145    return(tmp);
  • trunk/psModules/test/FullUnitTest

    r3623 r3696  
    1919#  RETURN : integer number of tests which failed
    2020#
    21 #  $Revision: 1.2 $  $Name: not supported by cvs2svn $
    22 #  $Date: 2005-04-01 20:11:19 $
     21#  $Revision: 1.3 $  $Name: not supported by cvs2svn $
     22#  $Date: 2005-04-12 21:51:00 $
    2323#
    2424#  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
    2525#
    2626##############################################################################
     27
     28use FindBin qw($Bin);
     29
     30$runTest = "$Bin/runTest";
    2731
    2832# Provide functions for determining the pathname of current working directory
     
    311315            $totalTestDrivers++;
    312316
    313             # Perform subdirectory checks only the first time a test
    314             # file is found with the list of enteries
    315             if ( $initialTest == 0 ) {
    316                 $initialTest++;
    317 
    318                 # Check for a temp subdirectory already exists and if not
    319                 # then create one
    320                 &checkForTempDirectory();
    321 
    322                 # Check for the presence of verified directory
    323                 if ( &checkForVerifiedDirectory() ) {
    324 
    325     # Display message to user that verified directories do not
    326     # exist eventhough TST files have been found
    327     #                    print("Unable to execute test drivers in $base_dir\n");
    328                     print("No verified subdirectory present.\n") if ($verbose);
    329 
    330                # Increment test fail count
    331                #                   $testDriverFailCount++;
    332                # Save the file failed
    333                #                    push(@testsFailed, $pwd . "/" . $files[$j]);
    334                #                    return;
    335                 }
    336             }
    337 
    338317            # Display message to user of which test driver is being executed
    339318            print("--- Executing test driver $files[$j]\n") if ( !$silent );
    340319
    341320            # Execute the test driver
    342             system(
    343 "./$files[$j] 1> temp/$files[$j].stdout 2> temp/$files[$j].stderr"
    344             );
     321            if ($silent) {
     322                system("$runTest --quiet ./$files[$j]");
     323            } elsif ($verbose) {
     324                system("$runTest --printpassfail ./$files[$j]");
     325            } else {
     326                system("$runTest ./$files[$j]");
     327            }
    345328            $retVal = $?;
    346329
     
    357340
    358341            # Check result of test driver
    359             if (   ( ( $retVal != 0 ) && ( $files[$j] =~ /^TST/i ) )
    360                 || ( ( $retVal == 0 ) && ( $files[$j] =~ /^ATST/i ) ) )
     342            if ( $retVal != 0 )
    361343            {
    362344
     
    372354                push( @testsFailed, $pwd . "/" . $files[$j] );
    373355            }
    374             else {
    375 
    376                # Create filter versions of STDOUT and STDERR to replace variable
    377                # items such as date, time and host
    378                 &filterStdFiles( $files[$j] );
    379 
    380                 # Perform difference on STDOUT file collected
    381                 # with verified files
    382                 $exitValue = &compareStream("verified/$files[$j].stdout");
    383                 if ( $exitValue & 2 ) {
    384 
    385                     # STDOUT verified doesn't exist. Search STDOUT capture
    386                     # for strings indicating error or failure
    387                     $exitValue |= &errorStrSearch("$files[$j].stdout");
    388                 }
    389                 if ( ( $exitValue & 8 ) || ( $exitValue & 64 ) ) {
    390 
    391                     # Increment the total number of test failed
    392                     $testDriverFailCount++;
    393 
    394                     # Push test on failed list
    395                     print(
    396 "Test failed ($failPoints out of $totalPoints testpoints failed)\n"
    397                       )
    398                       if ( !$silent );
    399                     push( @testsFailed, $pwd . "/" . $files[$j] );
    400                 }
    401                 else {
    402 
    403                     # Perform difference on STDERR file collection with verified
    404                     $exitValue = &compareStream("verified/$files[$j].stderr");
    405                     if ( $exitValue & 4 ) {
    406 
    407                         # STDERR verified doesn't exist. Search STDERR capture
    408                         # for strings indicating error or failure
    409                         $exitValue |= &errorStrSearch("$files[$j].stderr");
    410                     }
    411                     if ( ( $exitValue & 16 ) || ( $exitValue & 128 ) ) {
    412 
    413                         # Increment the total number of tests failed
    414                         $testDriverFailCount++;
    415 
    416                         # Push test on failed list
    417                         print(
    418 "Test failed ($failPoints out of $totalPoints testpoints failed)\n"
    419                           )
    420                           if ( !$silent );
    421                         push( @testsFailed, $pwd . "/" . $files[$j] );
    422                     }
    423                     else {
    424                         print("Test successful ($totalPoints testpoints)\n")
    425                           if ( !$silent );
    426                     }
    427                 }
    428             }
    429356        }
    430357        $j++;
     
    432359}
    433360
    434 ################################################################################
    435 #
    436 #  SUBROUTINE: errorStrSearch
    437 #
    438 #      Description:  This subroutine will search the file specified in its
    439 #                    parameter for error strings and if they do exists
    440 #                    the appropriate value will be returned.
    441 #
    442 #      Parameter(s): fileName - input file to search for strings
    443 #
    444 #      Return:   0  -  No error strings found
    445 #               64  -  Error strings found in STDOUT
    446 #              128  -  Error strings found in STDERR
    447 #
    448 ###############################################################################
    449 
    450 sub errorStrSearch {
    451     local ($fileName)  = @_;
    452     local ($returnVal) = 0;
    453 
    454     # Open the captured file
    455     open( CAPT_FILE, "<temp/$fileName" );
    456 
    457     # Scan through all the lines of the file searching for error strings
    458     while (<CAPT_FILE>) {
    459         if (   m/FAIL/i
    460             || m/FAULT/i
    461             || m/ERROR/i
    462             || m/Not Found/i
    463             || m/SIGNAL/i
    464             || m/NO SUCH FILE/i
    465             || m/\|E\|/i
    466             || m/\|A\|/i )
    467         {
    468             print;
    469             if ( $fileName =~ m/out/ ) {
    470                 print(
    471                     "        Failed - File $fileName contains error strings.\n"
    472                 );
    473                 $returnVal = 64;
    474             }
    475             elsif ( $fileName =~ m/err/ ) {
    476                 print(
    477                     "        Failed - File $fileName contains error strings.\n"
    478                 );
    479                 $returnVal = 128;
    480             }
    481             last;
    482         }
    483     }
    484 
    485     # Close the capture file
    486     close(CAPT_FILE);
    487 
    488     # Return the return value
    489     return ($returnVal);
    490 }
    491 
    492 ################################################################################
    493 #
    494 #  SUBROUTINE: compareStream
    495 #
    496 #      Description:  This subroutine will compare the captured stream file with
    497 #                    a file in the verified directory if one exists.
    498 #
    499 #      Parameter(s): streamFile - input file to compare
    500 #
    501 #      Return:   0  -  Compare successful
    502 #                2  -  STDOUT verified file doesn't exist
    503 #                4  -  STDERR verified file doesn't exist
    504 #                8  -  STDOUT verified file doesn't compare
    505 #               16  -  STDERR verified file doesn't compare
    506 #
    507 ###############################################################################
    508 
    509 sub compareStream {
    510     local ($streamFile) = @_;
    511     local ($returnVal)  = 0;
    512     local ($tempFile)   = "";
    513 
    514     # Check for existence of verified STD stream files
    515     if ( !( -e $streamFile ) ) {
    516 
    517         # Display message to user that verified STDOUT file doesn't exist
    518         print("        File $streamFile doesn't exist.\n") if ($verbose);
    519 
    520         # Set exit value bit 1 to indicate proper failure
    521         if ( $streamFile =~ /out$/ ) {
    522             $returnVal |= 2;
    523         }
    524         elsif ( $streamFile =~ /err$/ ) {
    525             $returnVal |= 4;
    526         }
    527     }
    528     else {
    529 
    530         # Verified STD stream file exists
    531 
    532         # Create name of the temp file to compare
    533         $tempFile = $streamFile;
    534         $tempFile =~ s/verified/temp/;
    535         $tempFile = $tempFile . ".mod";
    536 
    537         # Perform difference on the STD stream files
    538         $diffstdout = `diff $streamFile $tempFile`;
    539 
    540         # Check the return value of the difference
    541         if ( $? != 0 ) {
    542 
    543             # Difference of STD stream files failed
    544 
    545             # Check for STDOUT in file name to convey appropirate return value
    546             if ( $streamFile =~ /out$/ ) {
    547 
    548                 # Display message of the failure of difference to user
    549                 print("        Failed - STDOUT difference\n$diffstdout\n");
    550 
    551                 # Exit value to indicate STDOUT did not compare
    552                 $returnVal |= 8;
    553             }
    554             elsif ( $streamFile =~ /err$/ ) {
    555 
    556                 # Display message of the failure of difference to user
    557                 print("        Failed - STDERR difference\n$diffstdout\n");
    558 
    559                 # Exit value to indicate STDERR did not compare
    560                 $returnVal |= 16;
    561             }
    562         }
    563     }
    564 
    565     # Return the result of the compare
    566     return ($returnVal);
    567 }
    568 
    569 ################################################################################
    570 #
    571 #  SUBROUTINE: checkForTempDirectory
    572 #
    573 #      Description:  This subroutine will check for the existence of a temp
    574 #                    directory to store STDOUT, STDERR files during test.  If
    575 #                    the subdirectory doesn't exist, it will be created.
    576 #
    577 #      Parameter(s):  None
    578 #
    579 #      Return: None
    580 #
    581 ################################################################################
    582 
    583 sub checkForTempDirectory {
    584 
    585     # Check if a temp directory already exists in the current work directory
    586     if ( !( -e "temp" ) ) {
    587 
    588         # Create temp directory to store STDOUT, STDERR files during test
    589         `mkdir temp`;
    590 
    591         # Display message of new directory created
    592         print("Creating temp directory\n") if ($verbose);
    593     }
    594 }
    595 
    596 ################################################################################
    597 #
    598 #  SUBROUTINE: checkForVerifiedDirectory
    599 #
    600 #      Description:  This subroutine will check for the existence of a verified
    601 #                    directory which stores verified STDOUT, STDERR files for
    602 #                    comparison during the test.
    603 #
    604 #      Parameter(s):  None
    605 #
    606 #      Return: 0 - subdirectory present
    607 #              1 - subdirectory not present
    608 #
    609 ################################################################################
    610 
    611 sub checkForVerifiedDirectory {
    612     $returnValue = 0;
    613 
    614     # Check if verified subdirectory exists in the current working directory
    615     if ( !( -e "verified" ) ) {
    616 
    617         # Set return value to 1
    618         $returnValue = 1;
    619     }
    620     return ($returnValue);
    621 }
    622 
    623 ################################################################################
    624 #
    625 #  SUBROUTINE: filterStdFiles
    626 #
    627 #      Description:  This subroutine will filter variable items in the STDOUT
    628 #                    and STDERR files captured.  Date, time and host names
    629 #                    are variable items in the log messages captured.
    630 #
    631 #      Parameter(s):  test file name
    632 #
    633 #      Return: None
    634 #
    635 ################################################################################
    636 
    637 sub filterStdFiles {
    638 
    639     local ($fileName) = @_;
    640 
    641     # Open the STDOUT file for reading
    642     open( OUTFILE, "< temp/$fileName.stdout" );
    643 
    644     # Open mod file to place filtered STDOUT
    645     open( MODFILE, "> temp/$fileName.stdout.mod" );
    646 
    647     # Replace the variable data, time and host information with constants
    648     $hostname = `hostname`;
    649     chop $hostname;
    650     while (<OUTFILE>) {
    651         s/\s+\d+:\d+:\d+\w/<TIME>/g;
    652         s/\d+:\d+:\d+/<DATE>/g;
    653         s/$hostname\s*/<HOST>/g;
    654         s/: Line \d+/: Line <LINENO>/g;
    655         s/\(.*\:\d+\)/\(FILE\:LINENO\)/g;
    656         s/\s+[\_\-\/\.\w]+\:\d+/ FILE\:LINENO/g;
    657         s/allocate \d+ bytes at/allocate <N> bytes at/g;
    658         s/v\d+.\d+.\d+/vX.X.X/g;
    659 
    660         # Filter lines with *** malloc.  This is an artifact of Mac testing of
    661         # memory functions
    662         if ( !m/\*\*\*\smalloc/ ) {
    663             print MODFILE ($_);
    664         }
    665     }
    666 
    667     # Close mod file
    668     close(MODFILE);
    669 
    670     # Close STDERR file
    671     close(OUTFILE);
    672 
    673     # Open the STDERR file for reading
    674     open( OUTFILE, "< temp/$fileName.stderr" );
    675 
    676     # Open mod file to place filtered STDERR
    677     open( MODFILE, "> temp/$fileName.stderr.mod" );
    678 
    679     # Replace the variable date, time and host information with constants
    680     while (<OUTFILE>) {
    681         s/\s+\d+:\d+:\d+\w/<TIME>/g;
    682         s/\d+:\d+:\d+/<DATE>/g;
    683         s/$hostname\s*/<HOST>/g;
    684         s/: Line \d+/: Line <LINENO>/g;
    685         s/\(.*\:\d+\)/\(FILE\:LINENO\)/g;
    686         s/\s+[\_\-\/\.\w]+\:\d+/ FILE\:LINENO/g;
    687         s/allocate \d+ bytes at/allocate <N> bytes at/g;
    688         s/v\d+.\d+.\d+/vX.X.X/g;
    689 
    690         # Filter lines with *** malloc.  This is an artifact of Mac testing of
    691         # memory functions
    692         if ( !m/\*\*\*\smalloc/ ) {
    693             print MODFILE ($_);
    694         }
    695     }
    696 
    697     # Close mod file
    698     close(MODFILE);
    699 
    700     # Close STDERR file
    701     close(OUTFILE);
    702 }
    703 
  • trunk/psModules/test/runTest

    r3630 r3696  
    2626#
    2727#  $Revison:  $  $Name: not supported by cvs2svn $
    28 #  $Date: 2005-04-01 21:52:22 $
     28#  $Date: 2005-04-12 21:51:00 $
    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] [--verified=DIR] 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;
     
    144139            s/v\d+.\d+.\d+/vX.X.X/g;
    145140
     141            if (m/TestPoint:\s*([^\*]+)/) {
     142                $testfile = $1;
     143            }
     144            if (m/^---> TESTPOINT\s(\S+)/) {
     145                print "\t$testfile- $1\n" if ($verbose || $1 eq "FAILED");
     146                if ($1 eq "FAILED") {
     147                    print $testoutput;
     148                }
     149            }
     150
    146151            # Filter lines with malloc.  This is an artifact of memory testing
    147152            # with the Mac testbed
     
    177182            s/v\d+.\d+.\d+/vX.X.X/g;
    178183
     184            if (m/\*\*\*\*\*\* TESTPOINT \*\*\*\*\*\*/) {
     185                $testoutput = $_;
     186            }
     187            $testoutput += $_;
     188
     189            if (m/ TestPoint:\s*([^\*]+)/) {
     190                $testfile = $1;
     191            }
     192            if (m/^---> TESTPOINT\s(\S+)/) {
     193                print "\t$testfile- $1\n" if ($verbose || $1 eq "FAILED");
     194                if ($1 eq "FAILED") {
     195                    print $testoutput;
     196                }
     197            }
     198
    179199            # Filter lines with malloc.  This is an artifact of memory testing
    180200            # with the Mac testbed
     201
    181202            if ( !m/\*\*\*\smalloc/ ) {
    182203                print MODFILE ($_);
     
    193214
    194215        # Compare STDOUT capture with verified file
    195         $exitValue |= &compareStream("$verifiedDir/$testFile.stdout");
     216        $exitValue = &compareStream("$verifiedDir/$testFile.stdout");
    196217
    197218        # Check exit value to determine if verified file doesn't exist
     
    218239        # Since test driver doesn't exist or is not executable then display
    219240        # message to user.
    220         print(
    221 "        Need to specify an executable test file within directory.\n"
    222         );
     241        print STDERR "\tNeed to specify an executable test file.\n";
    223242
    224243        # Exit value set to indicate test driver doesn't exist or not executable
     
    231250# of a failed test
    232251if ( ( $exitValue >> 3 ) != 0 ) {
    233     print("Test failed - return status = $exitValue\n\n");
     252    print STDERR "Test failed - return status = $exitValue\n\n";
    234253}
    235254else {
    236     print("Test successful\n\n");
     255    exit(0);
    237256}
    238257exit($exitValue);
     
    272291            || m/\|A\|/i )
    273292        {
     293            print STDERR "\tFailed - File $fileName contains error strings.\n";
    274294            if ( $fileName =~ m/out/ ) {
    275                 print(
    276                     "        Failed - File $fileName contains error strings.\n"
    277                 );
    278295                $returnVal = 64;
    279296            }
    280297            elsif ( $fileName =~ m/err/ ) {
    281                 print(
    282                     "        Failed - File $fileName contains error strings.\n"
    283                 );
    284298                $returnVal = 128;
    285299            }
     
    305319#
    306320#      Return:   0  -  Compare successful
     321#                2  -  STDOUT verified file doesn't exist
     322#                4  -  STDERR verified file doesn't exist
    307323#                8  -  STDOUT verified file doesn't compare
    308324#               16  -  STDERR verified file doesn't compare
     
    316332
    317333    # Check for existence of verified STD stream files
    318     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 {
    319345
    320346        # Verified STD stream file exists
     
    337363
    338364                # Display message of the failure of difference to user
    339                 print("        Failed - STDOUT difference\n$diffstdout\n");
     365                print STDERR "\tFailed - STDOUT differences\n";
    340366
    341367                # Exit value to indicate STDOUT did not compare
     
    345371
    346372                # Display message of the failure of difference to user
    347                 print("        Failed - STDERR difference\n$diffstdout\n");
     373                print STDERR "\tFailed - STDERR differences\n";
    348374
    349375                # Exit value to indicate STDERR did not compare
Note: See TracChangeset for help on using the changeset viewer.