312 lines
10 KiB
Bash
Executable File
312 lines
10 KiB
Bash
Executable File
#!/bin/sh
|
|
#BHEADER***********************************************************************
|
|
# (c) 2000 The Regents of the University of California
|
|
#
|
|
# See the file COPYRIGHT_and_DISCLAIMER for a complete copyright
|
|
# notice, contact person, and disclaimer.
|
|
#
|
|
# $Revision$
|
|
#EHEADER***********************************************************************
|
|
|
|
#=============================================================================
|
|
# Create a few temporary variables, and assign default values to any
|
|
# unexported environment variables.
|
|
#=============================================================================
|
|
initialize_variables ()
|
|
{
|
|
OldMask=`umask`
|
|
umask 007
|
|
MAKE="make -i"
|
|
Hdr="autotest"
|
|
Skip=0
|
|
Build=1
|
|
Run=2
|
|
PurifytoFile="--with-purify-to-file"
|
|
#
|
|
# Assume that we are started from autotest and have done
|
|
# a "cd ${HYPRE_AUTOTEST_DIR}", however as long as we are
|
|
# above a "linear_solvers" directory we should be ok.
|
|
#
|
|
if test ! "${HYPRE_AUTOTEST_DIR}"
|
|
then
|
|
HYPRE_AUTOTEST_DIR=`pwd`
|
|
else # assume we're executing from autotest
|
|
if [ ! -d ${HYPRE_AUTOTEST_DIR} ]
|
|
then
|
|
if [ ! -d ./linear_solvers ]
|
|
then
|
|
echo "$0: no HYPRE_AUTOTEST_DIR environment variable"
|
|
exit 2
|
|
fi
|
|
fi
|
|
fi
|
|
if [ -d ${HYPRE_AUTOTEST_DIR}/linear_solvers/test ]
|
|
then
|
|
SRC=linear_solvers
|
|
fi
|
|
if [ -d ${HYPRE_AUTOTEST_DIR}/src/test ]
|
|
then
|
|
SRC=src
|
|
fi
|
|
StdBuildDir=${HYPRE_AUTOTEST_DIR}/${SRC}
|
|
StdTestDir=${HYPRE_AUTOTEST_DIR}/${SRC}/test
|
|
#
|
|
# Define HYPRE_ARCH
|
|
#
|
|
. $StdTestDir/hypre_arch.sh
|
|
if test ! "$HYPRE_MAIL"
|
|
then
|
|
HYPRE_MAIL=mailx
|
|
fi
|
|
#
|
|
# If NOT started by autotest (hence no HYPRE_*_EMAIL variable
|
|
# defined) default mail to UID only.
|
|
#
|
|
if test ! "${HYPRE_DEFAULT_EMAIL}"
|
|
then
|
|
if test ! "${USER}"
|
|
then
|
|
USER=`who am I|cut -f 1 -d \ `
|
|
fi
|
|
HYPRE_DEFAULT_EMAIL=${HYPRE_DEFAULT_EMAIL:=$USER}
|
|
HYPRE_CHECKOUT_EMAIL=${HYPRE_CHECKOUT_EMAIL:=$USER}
|
|
HYPRE_CONFIGURE_EMAIL=${HYPRE_CONFIGURE_EMAIL:=$USER}
|
|
HYPRE_STRUCT_EMAIL=${HYPRE_STRUCT_EMAIL:=$USER}
|
|
HYPRE_IJ_EMAIL=${HYPRE_IJ_EMAIL:=$USER}
|
|
HYPRE_FEI_EMAIL=${HYPRE_FEI_EMAIL:=$USER}
|
|
HYPRE_ALL_EMAIL=${HYPRE_ALL_EMAIL:=$USER}
|
|
fi
|
|
}
|
|
|
|
#=============================================================================
|
|
# Function for parsing of input arguments
|
|
#=============================================================================
|
|
|
|
parse_arguments () {
|
|
#
|
|
# The getopts follows posix.2, if sh is a posix shell as
|
|
# (as required by posix.2) then getopts is a built-in.
|
|
# If sh is a non posix.2 or a early Bourne shell (that
|
|
# probably implement the obsolute getopt) then
|
|
# getopts(1) will be used.
|
|
#
|
|
while getopts :a:b:cdfhmno:p:q:r:st:xy arg
|
|
do
|
|
argcur=$arg
|
|
case $arg in
|
|
a) confbuildtest $OPTARG " " "default" 1 1 1 1 1 1;;
|
|
b) confbuildtest $OPTARG " " "beta" 0 0 0 0 1 1;;
|
|
c) build $Build "all++" "all++" "test";;
|
|
d) build $Build " " "docs" "docs";;
|
|
f) build $Build "all77" "all77" "test";;
|
|
h) usage; exit 2;;
|
|
m) HYPRE_SEND_MAIL="yes"; MailOpt="-mail";;
|
|
+m) HYPRE_SEND_MAIL="no"; MailOpt="";;
|
|
n) confbuildtest $Build "--without-MPI" "no_mpi" 1 1 0 1 1 0;;
|
|
o) confbuildtest $OPTARG "--with-openmp" "openmp" 0 0 0 0 1 0;;
|
|
p) confbuildtest $OPTARG "--with-petac" "petac" 0 0 0 1 0 0;;
|
|
q) confbuildtest $OPTARG "--with-purify-to-file" \
|
|
"purify" 0 0 0 1 0 1;;
|
|
+q) confbuildtest $OPTARG "--with-purify" "purify" 0 0 0 1 0 1;;
|
|
r) HYPRE_RUN_MACHINE=$OPTARG;;
|
|
s) confbuildtest $Build "--with-strict-checking" \
|
|
"strict_checking" 1 1 1 1 1 0;;
|
|
t) confbuildtest $OPTARG "--with-pthreads" "pthreads" 1 0 0 0 0 0;;
|
|
x) build $Build "beta++" "beta++" "test";;
|
|
y) build $Build "beta77" "beta77" "test";;
|
|
:) echo "$0: \"$argcur\" requires a value"; exit 2;;
|
|
\?) echo "$0: INVALID option \"$argcur\" at $OPTIND"; exit 2;;
|
|
esac
|
|
done
|
|
shift `expr $OPTIND - 1`
|
|
#printf "Remaining arguments are: %s\n" "$*"
|
|
}
|
|
|
|
#=============================================================================
|
|
# Function for display of help/usage
|
|
#=============================================================================
|
|
usage () {
|
|
printf "Usage: %s [-cdfhmns] [-a opt] [-b opt]\n" $0
|
|
printf " [-o opt] [-p opt] [-r host] [-t opt]\n"
|
|
printf "\n"
|
|
printf "Hypre autotest (Note: all options are positional dependent\n"
|
|
printf "i.e., options are sequentially executed in left-to-right order).\n"
|
|
printf "\n"
|
|
printf "Options for the "opt" argument are "0", "1", or "2" where:\n"
|
|
printf " 0=skip (ignore this test),\n"
|
|
printf " 1=configure and make, and\n"
|
|
printf " 2=configure, make and run.\n"
|
|
printf "\n"
|
|
printf "-a opt All; the (default) configure, make, and execute. Also\n"
|
|
printf " performs make struct, IJ, fei, all, beta, nofei, and\n"
|
|
printf " fei++, followed by the test_drivers script (when opt=2).\n"
|
|
printf "-b opt Beta; perform the (default) configure, make beta, nofei,\n"
|
|
printf " fei++, followed by the test_drivers script (when opt=2).\n"
|
|
printf "-c C++; make all++ (no configure, or execute).\n"
|
|
printf "-d Docs; make the documentation directory.\n"
|
|
printf "-f F77; make all77 (no configure, or execute).\n"
|
|
printf "-h Help; display this help message.\n"
|
|
printf "-m Mail; mail errors to developers.\n"
|
|
printf "+m NoMail; Don\'t send any mail.\n"
|
|
printf "-n NoMPI; configure --without-MPI, make struct, IJ,\n"
|
|
printf " all, and beta (no execute option).\n"
|
|
printf "-o opt openMP; configure --with-openmp, make beta.\n"
|
|
printf "-p opt PETSc; perform configure --with-petsc, make all.\n"
|
|
printf "-q opt Purify; perform configure --with-purify-to-file. Output \n"
|
|
printf " is appended to a file called purify.log.\n"
|
|
printf "+q opt Purify; no file output option (interactive).\n"
|
|
printf "-r host Remote; remote exection is performed on "host".\n"
|
|
printf "-s Strict; configure --with-strict-checking,\n"
|
|
printf " followed by make struct, IJ, all, beta(no execute option).\n"
|
|
printf "-t opt Thread; perform configure --with-pthreads, make struct.\n"
|
|
printf "-x BetaC++; make beta++ (no configure, or execute).\n"
|
|
printf "-y BetaF77; make beta77 (no configure, or execute).\n"
|
|
}
|
|
|
|
#=============================================================================
|
|
# Function for mailing error messages
|
|
#=============================================================================
|
|
|
|
mail_errors () {
|
|
if [ "$HYPRE_SEND_MAIL" = "yes" ]
|
|
then
|
|
echo "Autotest mailing error messages"
|
|
cd $HYPRE_AUTOTEST_DIR
|
|
for i in *.err \
|
|
${SRC}/*.err \
|
|
${SRC}/test/*.err \
|
|
${SRC}/docs/*.err
|
|
do
|
|
if test -s "$i"
|
|
then
|
|
if test -r "${i}.email"
|
|
then
|
|
RECIPIENTS=`cat ${i}.email`
|
|
SUBJECT="Autotest error: ${i} ($HYPRE_ARCH)"
|
|
${HYPRE_MAIL} -s "$SUBJECT" $RECIPIENTS < $i
|
|
fi
|
|
fi
|
|
done
|
|
echo "Autotest mail sent"
|
|
fi
|
|
}
|
|
|
|
cleanup () {
|
|
umask $OldMask
|
|
echo "Autotest finished leaving $*"
|
|
}
|
|
#=============================================================================
|
|
# General purpose make function /w strict_checking error output redirection
|
|
#=============================================================================
|
|
|
|
makeit ()
|
|
{
|
|
MakeOpt=$1 MessageStr=$2
|
|
MailGroup=$3
|
|
if [ "$MessageStr" = "purify" ]
|
|
then # don't need extra purify status messages
|
|
$MAKE $MakeOpt 1> ${Hdr}.${MessageStr}.${MakeOpt}.log 2>&1
|
|
else
|
|
$MAKE $MakeOpt 1> ${Hdr}.${MessageStr}.${MakeOpt}.log \
|
|
2> ${Hdr}.${MessageStr}.${MakeOpt}.err
|
|
fi
|
|
echo "$MailGroup" > ${Hdr}.${MessageStr}.${MakeOpt}.err.email
|
|
}
|
|
#=============================================================================
|
|
# General purpose function for configure, make and execute
|
|
#=============================================================================
|
|
|
|
confbuildtest ()
|
|
{
|
|
BuildOpt=$1 ConfigOption=$2 MessageStr=$3
|
|
StructOpt=$4 IJOpt=$5 FeiOpt=$6
|
|
MakeOpt=$7 BetaOpt=$8 NoFeiOpt=$9
|
|
if [ ${BuildOpt} -ne $Skip ]
|
|
then
|
|
echo "Autotest starting configure and make of $MessageStr"
|
|
if [ ${BuildOpt} -eq $Build -o ${BuildOpt} -eq $Run ]
|
|
then
|
|
cd $StdBuildDir
|
|
./configure "$ConfigOption" 1> ${Hdr}.${MessageStr}.configure.log \
|
|
2> ${Hdr}.${MessageStr}.configure.err
|
|
echo "$HYPRE_CONFIGURE_EMAIL" > ${Hdr}.${MessageStr}.configure.err.email
|
|
|
|
$MAKE veryclean
|
|
|
|
if [ $StructOpt -ne $Skip ]
|
|
then
|
|
makeit "struct" $MessageStr "$HYPRE_STRUCT_EMAIL"
|
|
fi
|
|
|
|
if [ $IJOpt -ne $Skip ]
|
|
then
|
|
makeit "IJ" $MessageStr "$HYPRE_IJ_EMAIL"
|
|
fi
|
|
|
|
if [ $FeiOpt -ne $Skip ]
|
|
then
|
|
makeit "fei" $MessageStr "$HYPRE_FEI_EMAIL"
|
|
fi
|
|
|
|
if [ $MakeOpt -ne $Skip ]
|
|
then
|
|
makeit "all" $MessageStr "$HYPRE_ALL_EMAIL"
|
|
fi
|
|
|
|
if [ $BetaOpt -ne $Skip ]
|
|
then
|
|
makeit "beta" $MessageStr "$HYPRE_ALL_EMAIL"
|
|
fi
|
|
fi
|
|
if [ ${BuildOpt} -eq $Run ]
|
|
then
|
|
echo "Autotest starting execution of $MessageStr"
|
|
if [ $NoFeiOpt -ne $Skip ]
|
|
then
|
|
makeit "nofei" $MessageStr "$HYPRE_FEI_EMAIL"
|
|
cd ${HYPRE_AUTOTEST_DIR}/${SRC}/test
|
|
makeit "fei++" $MessageStr "$HYPRE_FEI_EMAIL"
|
|
fi
|
|
if test ! "${HYPRE_RUN_MACHINE}"
|
|
then
|
|
cd $HYPRE_AUTOTEST_DIR/${SRC}/test
|
|
./test_drivers.sh $MailOpt
|
|
else
|
|
ssh ${HYPRE_RUN_MACHINE} "\
|
|
(\
|
|
cd ${HYPRE_AUTOTEST_DIR}/${SRC}/test;\
|
|
. ./env.${HYPRE_ARCH};\
|
|
./test_drivers.sh $MailOpt\
|
|
)"
|
|
fi
|
|
fi
|
|
echo "Autotest finished $MessageStr"
|
|
fi
|
|
}
|
|
#=============================================================================
|
|
# General purpose make function
|
|
#=============================================================================
|
|
|
|
build ()
|
|
{
|
|
BuildOpt=$1 MakeOption=$2 MessageStr=$3 MakeDir=$4
|
|
if [ $BuildOpt -ne $Skip ]
|
|
then
|
|
echo "Autotest starting make of $MessageStr"
|
|
cd $StdBuildDir/$MakeDir
|
|
$MAKE $MakeOption 1> ${Hdr}.${MessageStr}.log \
|
|
2> ${Hdr}.${MessageStr}.err
|
|
echo "$HYPRE_ALL_EMAIL" > ${Hdr}.${MessageStr}.err.email
|
|
echo "Autotest finished $MessageStr"
|
|
fi
|
|
}
|
|
|
|
#==============================================================================
|
|
# This script is the implementation script used to regression test hypre.
|
|
#==============================================================================
|
|
|
|
initialize_variables
|
|
parse_arguments $*
|
|
mail_errors
|
|
cleanup
|