-#! /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.
#
use File::Path;
# Global variables
-$MPIMajorVersion = "1";
+$MPIMajorVersion = "3";
$MPIMinorVersion = "1";
$mpiexec = "smpirun"; # Name of mpiexec program (including path, if necessary)
+$platformfile = "../../../../examples/platforms/small_platform_with_routers.xml";
+$hostfile = "../../hostfile_mpich";
$testIsStrict = "true";
$MPIhasMPIX = "no";
$np_arg = "-np"; # Name of argument to specify the number of processes
$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
$execarg="";
+$wrapparg="";
+
+$enabled_privatization = 1; # disable tests that need SMPI privatization to run
# TAP (Test Anything Protocol) output
my $tapoutput = 0;
my $tapfile = '';
# Build flags
$remove_this_pgm = 0;
-$clean_pgms = 1;
+$clean_pgms = 0;
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
$verbose = 1;
}
if ( defined($ENV{"RUNTESTS_SHOWPROGRESS"} ) ) {
- $showProgress = 1;
+ $showProgress = 1;
}
if (defined($ENV{"MPITEST_STOPTEST"})) {
$stopfile = $ENV{"MPITEST_STOPTEST"};
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;
# 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 (/--?platformfile=(.*)/) { $platformfile = $1; }
+ elsif (/--?hostfile=(.*)/) { $hostfile = $1; }
elsif (/--?srcdir=(.*)/) { $srcdir = $1;
- $mpiexec="$mpiexec -platform ${srcdir}/../small_platform_with_routers.xml -hostfile ${srcdir}/../hostfile --log=root.thr:critical --cfg=smpi/running_power:1e9"; }
+ $mpiexec="$mpiexec -platform ${srcdir}/$platformfile -hostfile ${srcdir}/$hostfile --log=root.thr:critical --cfg=smpi/host-speed:1e9 --cfg=smpi/async-small-thresh:65536"; }
elsif (/--?verbose/) { $verbose = 1; }
elsif (/--?showprogress/) { $showProgress = 1; }
elsif (/--?debug/) { $debug = 1; }
elsif (/--?batchdir=(.*)/) { $batrundir = $1; }
elsif (/--?timeoutarg=(.*)/) { $timeoutArgPattern = $1; }
elsif (/--?execarg=(.*)/) { $execarg = "$execarg $1"; }
+ elsif (/--?privatization=(.*)/) {
+print STDERR "privatization called\n";
+$enabled_privatization = $1; }
+ elsif (/--?wrapper=(.*)/) {
+ $wrapparg = "-wrapper \"$1\"" if $1 ne "";
+ }
elsif (/--?xmlfile=(.*)/) {
$xmlfile = $1;
if (! ($xmlfile =~ /^\//)) {
# we do not know at this point how many tests will be run, so do
# not print a test plan line like "1..450" until the very end
}
- else {
- print STDERR "Unrecognized argument $_\n";
- print STDERR "runtests [-tests=testfile] [-np=nprocesses] \
- [-maxnp=max-nprocesses] [-srcdir=location-of-tests] \
- [-xmlfile=filename ] [-noxmlclose] \
- [-verbose] [-showprogress] [-debug] [-batch]\n";
- exit(1);
- }
}
# Perform any post argument processing
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) {
else {
if ($err_count) {
print "$err_count tests failed out of $total_run\n";
+ print "Failing tests : $failed_tests\n";
if ($xmloutput) {
print "Details in $xmlfullfile\n";
}
print "TAP formatted results in $tapfullfile\n";
}
}
+exit ($err_count > 0);
#\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/\/$//;
$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 = "";
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
# 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;
my $requiresMPIX = "";
my $progEnv = "";
my $mpiVersion = "";
+ my $needs_privatization = 0;
my $xfail = "";
if ($#args >= 1) { $np = $args[1]; }
# Process the key=value arguments
elsif ($key eq "mpiversion") {
$mpiVersion = $value;
}
+ elsif ($key eq "needs_privatization") {
+ $needs_privatization = $value;
+ }
elsif ($key eq "strict") {
$requiresStrict = $value
}
# skip empty lines
if ($programname eq "") { next; }
+ # if privatization is disabled, and if the test needs it, ignore it
+ if ($needs_privatization == 1 &&
+ $enabled_privatization != 1) {
+ SkippedTest($programname, $np, $workdir, "requires SMPI privatization");
+ next;
+ }
+
if ($np eq "") { $np = $np_default; }
if ($np_max > 0 && $np > $np_max) { $np = $np_max; }
# 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);
}
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 );
}
$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 );
}
}
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";
}
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>) {
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
$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 "") {
&$InitForTest();
}
print STDOUT "Env includes $progEnv\n" if $verbose;
- print STDOUT "$mpiexec $mpiexecArgs $np_arg $np $program_wrapper ./$programname $progArgs\n" if $verbose;
+ print STDOUT "$mpiexec $wrapparg $mpiexecArgs $np_arg $np $program_wrapper ./$programname $progArgs\n" if $verbose;
print STDOUT "." if $showProgress;
# Save and restore the environment if necessary before running mpiexec.
if ($progEnv ne "") {
}
}
}
- open ( MPIOUT, "$mpiexec $np_arg $np $mpiexecArgs $program_wrapper ./$programname $progArgs 2>&1 |" ) ||
+ open ( MPIOUT, "$mpiexec $wrapparg $np_arg $np $mpiexecArgs $program_wrapper ./$programname $progArgs 2>&1 |" ) ||
die "Could not run ./$programname\n";
if ($progEnv ne "") {
%ENV = %saveEnv;
}
else {
if ($verbose) {
- $inline = "$mpiexec $np_arg $np $program_wrapper ./$programname\n";
+ $inline = "$mpiexec $wrapparg $np_arg $np $program_wrapper ./$programname\n";
}
else {
$inline = "";
# Skip FORTRAN STOP
if (/FORTRAN STOP/) { next; }
$inline .= $_;
+ if (m{^==[0-9]+== ?WARNING: ASan doesn't fully support} ||
+ m{^==[0-9]+== ?WARNING: ASan is ignoring requested __asan_handle_no_return: stack top:} ||
+ m{^False positive error reports may follow$} ||
+ m{^For details see http://code.google.com/p/address-sanitizer/issues/detail\?id=189$} ||
+ m{^For details see https://github.com/google/sanitizers/issues/189$}) {
+ next;
+ }
if (/^\s*No [Ee]rrors\s*$/ && $found_noerror == 0) {
$found_noerror = 1;
}
print STDERR "Unexpected output in $programname: $_";
if (!$found_error) {
$found_error = 1;
+ $failed_tests .= $programname;
+ $failed_tests .= " ";
$err_count ++;
}
}
print STDERR "Program $programname exited without No Errors\n";
if (!$found_error) {
$found_error = 1;
+ $failed_tests .= $programname;
+ $failed_tests .= " ";
$err_count ++;
}
}
if ($signal_num != 0) {
print STDERR "Program $programname exited with signal $signal_num\n";
}
+ $failed_tests .= $programname;
+ $failed_tests .= " ";
$found_error = 1;
$err_count ++;
}
if ($found_error) {
&RunTestFailed( $programname, $np, $curdir, $inline, $xfail );
}
- else {
+ else {
&RunTestPassed( $programname, $np, $curdir, $xfail );
}
&RunPostMsg( $programname, $np, $curdir );
if ($ResultTest ne "") {
# This test really needs to be run manually, with this test
- # Eventually, we can update this to include handleing in checktests.
+ # Eventually, we can update this to include handling in checktests.
print STDERR "Run $curdir/$programname with $np processes and use $ResultTest to check the results\n";
return;
}
# 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 "") {
}
# 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 "") {
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";
}
print BATOUT "echo \$? > runtests.$testCount.status\n";
}
-#
+#
# Return value is 0 on success, non zero on failure
sub BuildMPIProgram {
my $programname = shift;
+ if (! -x $programname) {
+ die "Could not find $programname. Aborting.\n";
+ }
+ return 0;
+ # THE FOLLOWING IS DISABLED.
my $xfail = shift;
my $rc = 0;
if ($verbose) { print STDERR "making $programname\n"; }
$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 );
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 );
}
}
# ----------------------------------------------------------------------------
-sub FindRunning {
+sub FindRunning {
my $programname = $_[0];
my @pids = ();
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) {
}
# ----------------------------------------------------------------------------
#
-# 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];
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 {
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) {
# 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];