Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[SMPI] Renamed smpi/async_small_thres to smpi/async_small_thresh
[simgrid.git] / teshsuite / smpi / mpich3-test / runtests
index 88188fe..721da48 100755 (executable)
@@ -1,7 +1,7 @@
-#! /usr/bin/perl
+#! /usr/bin/env perl
 # -*- Mode: perl; -*-
 #
-# This script is the beginnings of a script to run a sequence of test 
+# This script is the beginnings of a script to run a sequence of test
 # programs.  See the MPICH document for a description of the test
 # strategy and requirements.
 #
@@ -66,7 +66,7 @@ $verbose = 1;            # Set to true to get more output
 $showProgress = 0;       # Set to true to get a "." with each run program.
 $newline = "\r\n";       # Set to \r\n for Windows-friendly, \n for Unix only
 $batchRun = 0;           # Set to true to batch the execution of the tests
-                         # (i.e., run them together, then test output, 
+                         # (i.e., run them together, then test output,
                          # rather than build/run/check for each test)
 $testCount = 0;          # Used with batchRun to count tests.
 $batrundir = ".";        # Set to the directory into which to run the examples
@@ -91,7 +91,7 @@ my $program_wrapper = '';
 # Get some arguments from the environment
 #   Currently, only the following are understood:
 #   VERBOSE
-#   RUNTESTS_VERBOSE  (an alias for VERBOSE in case you want to 
+#   RUNTESTS_VERBOSE  (an alias for VERBOSE in case you want to
 #                      reserve VERBOSE)
 #   RUNTESTS_SHOWPROGRESS
 #   MPITEST_STOPTEST
@@ -104,7 +104,7 @@ if ( defined($ENV{"VERBOSE"}) || defined($ENV{"V"}) || defined($ENV{"RUNTESTS_VE
     $verbose = 1;
 }
 if ( defined($ENV{"RUNTESTS_SHOWPROGRESS"} ) ) {
-    $showProgress = 1;       
+    $showProgress = 1;
 }
 if (defined($ENV{"MPITEST_STOPTEST"})) {
     $stopfile = $ENV{"MPITEST_STOPTEST"};
@@ -117,7 +117,7 @@ else {
 if (defined($ENV{"MPITEST_TIMEOUT"})) {
     $defaultTimeLimit = $ENV{"MPITEST_TIMEOUT"};
 }
+
 # Define this to leave the XML output file open to receive additional data
 if (defined($ENV{'NOXMLCLOSE'}) && $ENV{'NOXMLCLOSE'} eq 'YES') {
     $closeXMLOutput = 0;
@@ -145,16 +145,16 @@ if (defined($ENV{'MPITEST_BATCHDIR'})) {
 # Process arguments and override any defaults
 #---------------------------------------------------------------------------
 foreach $_ (@ARGV) {
-    if (/--?mpiexec=(.*)/) { 
-       # Use mpiexec as given - it may be in the path, and 
+    if (/--?mpiexec=(.*)/) {
+       # Use mpiexec as given - it may be in the path, and
        # we don't want to bother to try and find it.
-       $mpiexec = $1; 
+       $mpiexec = $1;
     }
     elsif (/--?np=(.*)/)   { $np_default = $1; }
     elsif (/--?maxnp=(.*)/) { $np_max = $1; }
     elsif (/--?tests=(.*)/) { $listfiles = $1; }
     elsif (/--?srcdir=(.*)/) { $srcdir = $1;
-       $mpiexec="$mpiexec  -platform ${srcdir}/../../../../examples/msg/small_platform_with_routers.xml -hostfile ${srcdir}/../hostfile --log=root.thr:critical --cfg=smpi/running_power:1e9"; }
+       $mpiexec="$mpiexec  -platform ${srcdir}/../../../../examples/platforms/small_platform_with_routers.xml -hostfile ${srcdir}/../../hostfile_coll --log=root.thr:critical --cfg=smpi/running_power:1e9  --cfg=smpi/async_small_thresh:65536"; }
     elsif (/--?verbose/) { $verbose = 1; }
     elsif (/--?showprogress/) { $showProgress = 1; }
     elsif (/--?debug/) { $debug = 1; }
@@ -238,21 +238,21 @@ if ($listfiles eq "") {
     if ($batchRun) {
        print STDERR "An implicit list of tests is not permitted in batch mode\n";
        exit(1);
-    } 
+    }
     else {
        &ProcessImplicitList;
     }
 }
-elsif (-d $listfiles) { 
+elsif (-d $listfiles) {
     print STDERR "Testing by directories not yet supported\n";
 }
 else {
     &RunList( $listfiles );
 }
 
-if ($xmloutput && $closeXMLOutput) { 
+if ($xmloutput && $closeXMLOutput) {
     print XMLOUT "</MPITESTRESULTS>$newline";
-    close XMLOUT; 
+    close XMLOUT;
 }
 
 if ($tapoutput) {
@@ -282,8 +282,8 @@ else {
 #\f
 # ---------------------------------------------------------------------------
 # Routines
-# 
-# Enter a new directory and process a list file.  
+#
+# Enter a new directory and process a list file.
 #  ProcessDir( directory-name, list-file-name )
 sub ProcessDir {
     my $dir = $_[0]; $dir =~ s/\/$//;
@@ -311,12 +311,12 @@ sub ProcessDir {
     $srcdir = $savesrcdir;
 }
 # ---------------------------------------------------------------------------
-# Run the programs listed in the file given as the argument. 
+# Run the programs listed in the file given as the argument.
 # This file describes the tests in the format
 #  programname number-of-processes [ key=value ... ]
 # If the second value is not given, the default value is used.
-# 
-sub RunList { 
+#
+sub RunList {
     my $LIST = "LIST$depth"; $depth++;
     my $listfile = $_[0];
     my $ResultTest = "";
@@ -327,7 +327,7 @@ sub RunList {
     if (! -s "$listfile" && -s "$srcdir/$curdir/$listfile" ) {
        $listfileSource = "$srcdir/$curdir/$listfile";
     }
-    open( $LIST, "<$listfileSource" ) || 
+    open( $LIST, "<$listfileSource" ) ||
        die "Could not open $listfileSource\n";
     while (<$LIST>) {
        # Check for stop file
@@ -345,7 +345,7 @@ sub RunList {
        # Some tests require that support routines are built first
        # This is specified with !<dir>:<target>
        if (/^\s*\!([^:]*):(.*)/) {
-           # Hack: just execute in a subshell.  This discards any 
+           # Hack: just execute in a subshell.  This discards any
            # output.
            `cd $1 && make $2`;
            next;
@@ -430,7 +430,7 @@ sub RunList {
 
        # If a minimum MPI version is specified, check against the
        # available MPI.  If the version is unknown, we ignore this
-       # test (thus, all tests will be run).  
+       # test (thus, all tests will be run).
        if ($mpiVersion ne "" && $MPIMajorVersion ne "unknown" &&
            $MPIMinorVersion ne "unknown") {
            my ($majorReq,$minorReq) = split(/\./,$mpiVersion);
@@ -467,7 +467,7 @@ sub RunList {
         }
 
        if (-d $programname) {
-           # If a directory, go into the that directory and 
+           # If a directory, go into the that directory and
            # look for a new list file
            &ProcessDir( $programname, $listfile );
        }
@@ -475,13 +475,13 @@ sub RunList {
            $total_run++;
            if (&BuildMPIProgram( $programname, $xfail ) == 0) {
                if ($batchRun == 1) {
-                   &AddMPIProgram( $programname, $np, $ResultTest, 
+                   &AddMPIProgram( $programname, $np, $ResultTest,
                                    $InitForRun, $timeLimit, $progArgs,
                                    $progEnv, $mpiexecArgs, $xfail );
                }
                else {
-                   &RunMPIProgram( $programname, $np, $ResultTest, 
-                                   $InitForRun, $timeLimit, $progArgs, 
+                   &RunMPIProgram( $programname, $np, $ResultTest,
+                                   $InitForRun, $timeLimit, $progArgs,
                                    $progEnv, $mpiexecArgs, $xfail );
                }
            }
@@ -518,10 +518,10 @@ sub ProcessImplicitList {
        if ($programname eq "configure") { next; } # Ignore configure script
        if ($programname eq "config.status") { next; } # Ignore configure helper
        if (-x $programname) { $found_exec++; }
-       if ($programname =~ /\.[cf]$/) { $found_src++; } 
+       if ($programname =~ /\.[cf]$/) { $found_src++; }
     }
     close PGMS;
-    
+
     if ($found_exec) {
        print "Found executables\n" if $debug;
        open (PGMS, "ls -1 |" ) || die "Cannot list programs\n";
@@ -543,7 +543,7 @@ sub ProcessImplicitList {
        }
        close PGMS;
     }
-    elsif ($found_src) { 
+    elsif ($found_src) {
        print "Found source files\n" if $debug;
        open (PGMS, "ls -1 *.c |" ) || die "Cannot list programs\n";
        while (<PGMS>) {
@@ -572,7 +572,7 @@ sub ProcessImplicitList {
        close PGMS;
     }
 }
-# Run the program.  
+# Run the program.
 # ToDo: Add a way to limit the time that any particular program may run.
 # The arguments are
 #    name of program, number of processes, name of routine to check results
@@ -595,7 +595,7 @@ sub RunMPIProgram {
        $timeout = $timeLimit;
     }
     $ENV{"MPIEXEC_TIMEOUT"} = $timeout;
-    
+
     # Run the optional setup routine. For example, the timeout tests could
     # be set to a shorter timeout.
     if ($InitForTest ne "") {
@@ -675,7 +675,7 @@ sub RunMPIProgram {
     if ($found_error) {
        &RunTestFailed( $programname, $np, $curdir, $inline, $xfail );
     }
-    else { 
+    else {
        &RunTestPassed( $programname, $np, $curdir, $xfail );
     }
     &RunPostMsg( $programname, $np, $curdir );
@@ -701,13 +701,13 @@ sub AddMPIProgram {
     # Set a default timeout on tests (3 minutes for now)
     my $timeout = $defaultTimeLimit;
     if (defined($timeLimit) && $timeLimit =~ /^\d+$/) {
-       # On some systems, there is no effective time limit on 
+       # On some systems, there is no effective time limit on
        # individual mpi program runs.  In that case, we may
        # want to treat these also as "run manually".
        $timeout = $timeLimit;
     }
     print BATOUT "export MPIEXEC_TIMEOUT=$timeout\n";
-    
+
     # Run the optional setup routine. For example, the timeout tests could
     # be set to a shorter timeout.
     if ($InitForTest ne "") {
@@ -715,8 +715,8 @@ sub AddMPIProgram {
     }
 
     # For non-MPICH versions of mpiexec, a timeout may require a different
-    # environment variable or command line option (e.g., for Cray aprun, 
-    # the option -t <sec> must be given, there is no environment variable 
+    # environment variable or command line option (e.g., for Cray aprun,
+    # the option -t <sec> must be given, there is no environment variable
     # to set the timeout.
     $extraArgs = "";
     if (defined($timeoutArgPattern) && $timeoutArgPattern ne "") {
@@ -730,11 +730,11 @@ sub AddMPIProgram {
     print STDOUT "." if $showProgress;
     # Save and restore the environment if necessary before running mpiexec.
     if ($progEnv ne "") {
-       # Need to fix: 
+       # Need to fix:
        # save_NAME_is_set=is old name set
        # save_NAME=oldValue
        # export NAME=newvalue
-       # (run) 
+       # (run)
        # export NAME=oldValue (if set!)
        print STDERR "Batch output does not permit changes to environment\n";
     }
@@ -749,7 +749,7 @@ sub AddMPIProgram {
     print BATOUT "echo \$? > runtests.$testCount.status\n";
 }
 
-# 
+#
 # Return value is 0 on success, non zero on failure
 sub BuildMPIProgram {
     my $programname = shift;
@@ -772,7 +772,7 @@ sub BuildMPIProgram {
            $rc = 1;
        }
        # Add a line to the summary file describing the failure
-       # This will ensure that failures to build will end up 
+       # This will ensure that failures to build will end up
        # in the summary file (which is otherwise written by the
        # RunMPIProgram step)
        &RunPreMsg( $programname, $np, $curdir );
@@ -784,10 +784,10 @@ sub BuildMPIProgram {
 
 sub CleanUpAfterRun {
     my $programname = $_[0];
-    
+
     # Check for that this program has exited.  If it is still running,
     # issue a warning and leave the application.  Of course, this
-    # check is complicated by the lack of a standard access to the 
+    # check is complicated by the lack of a standard access to the
     # running processes for this user in Unix.
     @stillRunning = &FindRunning( $programname );
 
@@ -810,7 +810,7 @@ sub CleanUpAfterRun {
     }
 }
 # ----------------------------------------------------------------------------
-sub FindRunning { 
+sub FindRunning {
     my $programname = $_[0];
     my @pids = ();
 
@@ -818,7 +818,7 @@ sub FindRunning {
     my $pidloc = 1;
     my $rc = open PSFD, "ps auxw -U $logname 2>&1 |";
 
-    if ($rc == 0) { 
+    if ($rc == 0) {
        $rc = open PSFD, "ps -fu $logname 2>&1 |";
     }
     if ($rc == 0) {
@@ -842,7 +842,7 @@ sub FindRunning {
 }
 # ----------------------------------------------------------------------------
 #
-# TestStatus is a special test that reports success *only* when the 
+# TestStatus is a special test that reports success *only* when the
 # status return is NONZERO
 sub TestStatus {
     my $MPIOUT = $_[0];
@@ -883,7 +883,7 @@ sub TestStatus {
     return ($found_error,$inline);
 }
 #
-# TestTimeout is a special test that reports success *only* when the 
+# TestTimeout is a special test that reports success *only* when the
 # status return is NONZERO and there are no processes left over.
 # This test currently checks only for the return status.
 sub TestTimeout {
@@ -904,7 +904,7 @@ sub TestTimeout {
        if (/job ending due to env var MPIEXEC_TIMEOUT/) { next; }
        # Allow 'APPLICATION TIMED OUT' (hydra)
        if (/\[mpiexec@.*\] APPLICATION TIMED OUT/) { last; }
-       # ANY output is an error (other than timeout) 
+       # ANY output is an error (other than timeout)
        if (! /^\s*$/) {
            print STDERR "Unexpected output in $programname: $_";
            if (!$found_error) {
@@ -931,13 +931,13 @@ sub TestTimeout {
     # Here should go a check of the processes
     # open( PFD, "ps -fu $LOGNAME | grep -v grep | grep $programname |" );
     # while (<PFD>) {
-    #     
+    #
     # }
     # close PFD;
     return ($found_error,$inline);
 }
 #
-# TestErrFatal is a special test that reports success *only* when the 
+# TestErrFatal is a special test that reports success *only* when the
 # status return is NONZERO; it ignores error messages
 sub TestErrFatal {
     my $MPIOUT = $_[0];