#!/bin/sh # # $COPYRIGHT$ # # Script to actually run the tests # PRE_MPIRUN="$1" MPIRUN="$2" POST_MPIRUN="$3" REPORT_ERROR="$4" MODE="$5" BIN="$6" # # Subroutine to run check if a command is null, and if it isn't, do # some variable substitutions, and then run it. # run_command() { cmd="$1" echo="$2" # If the command isn't empty, do the variable substitution on it, # then evaluate the variables and ditch escapes, possibly echo it # to stdout, and then eval (execute) it. if test "$cmd" != ""; then foo="`echo \"$cmd\" | sed -e 's/%np/$np/g' | sed -e 's/%mode/$MODE/g' | sed -e 's/%cmd/$bin/g'`" bar="`eval echo $foo`" if test "$echo" = "1"; then echo "$bar" fi eval "$bar" st="$?" fi } # # Setup some stuff for below # TEST=this_is_exported_to_all_ranks LAM_MPI_TEST=this_is_exported_to_all_ranks export TEST LAM_MPI_TEST pwd="`pwd`" # # Iterate through each of the tests # for bin in $BIN; do # Decide how many nodes to run on if test "`echo $bin`" != ""; then case $bin in range) np=8 ;; cart) np=6 ;; sub) np=6 ;; graph) np=4 ;; mpil_spawn) np=3 ;; spawn) np=3 ;; spawn_appschema) np=3 ;; spawn_multiple) np=3 ;; *) np=2 ;; esac fi # Run all the commands; only echo the actual $MPIRUN command -- # the others can run silently bin="$pwd/$bin" run_command "$PRE_MPIRUN" 0 run_command "$MPIRUN" 1 if test "$st" != "0"; then f="`basename $bin`" # Special case the "abort" test -- it's *supposed* to return # an error if test "$f" != "abort" -a "$f" != "final"; then run_command "$REPORT_ERROR mpirun/$f/$MODE returned nonzero return status"; fi fi run_command "$POST_MPIRUN" 0 done exit 0