📄 runtests.in
字号:
#! /bin/sh## Run some of the tests. If any arguments are provided, pass them to the# test programs.## -mvhome is needed for the ANL SP, and is ignored by othersargs=@MPIRUNARGS@device=@DEVICE@top_srcdir=@top_srcdir@srcdir=@srcdir@MPICH_VERSION=@MPICH_VERSION@STOPFILE=$HOME/.stopmpichtestsmpirun=${MPIRUN:-"@MPIRUN@"}MAKE="@MAKE@"## Load basic procedures. ${top_srcdir}/runbase## Set mpirun to the name/path of the mpirun programFindMPIRUN#quiet=0runtests=1makeeach=0writesummaryfile=noMAKE="@MAKE@"for arg in "$@" ; do case $arg in -checkonly ) runtests=0 ;; -margs=*) margs=`echo $arg | sed 's/-margs=//'` args="$args $margs" ;; -summaryfile=*) writesummaryfile=yes summaryfile=`echo A$arg | sed 's/A-summaryfile=//'` ;; -small) makeeach=1 shift ;; -quiet) shift quiet=1 ;; -help|-u) echo "runtests [-checkonly] [-margs='...']" echo "run tests in this directory. If -checkonly set, just run" echo "the differences check (do NO rerun the test programs)." echo "If -margs is used, these options are passed to mpirun." echo "If -small is used, the examples are built, run, and deleted." exit 1 ;; *) if test -n "$arg" ; then echo "runtests: Unknown argument ($arg)" exit 1 fi ;; esacdone# If the programs are not available, run make.if [ ! -x sigchk -a $makeeach = 0 -a $runtests = 1 ] ; then $MAKE defaultfi#testfiles=""if [ $runtests = 1 ] ; thenRunTest timers 1 "*** Timer tests ***"RunTest init 2 "*** MPI_Initialized tests ***"RunTest baseattr 1 "*** Basic attributes ***"RunTest gtime 1 "*** WTIME_IS_GLOBAL ***"RunTest errhand 1 "*** Tests of error handling ***"RunTest errhand2 1 "*** Tests of error handling reference counting ***"RunTest sigchk 1 "*** Tests of signals used ***"RunTest getproc 1 "*** Test Get Processor Name ***"OutTimetestfiles="$testfiles cmdline.out"/bin/rm -f cmdline.outMakeExe cmdlineecho "*** Tests of command line handling ***"echo "*** Tests of command line handling ***" >> cmdline.out$mpirun $args -np 2 ./cmdline a "b c" "d'e" 'f"g" h' $* </dev/null l>> cmdline.out 2>&1echo "*** Tests of command line handling ***" >> cmdline.outCleanExe cmdlineif [ ! -s cmdline.stdo ] ; then cat >cmdline.stdo <<EOF*** Tests of command line handling *** No Errors*** Tests of command line handling ***EOFfi## If there was a Unix standard interface to ps, we could check for orphaned# processes...if ps -fwu $LOGNAME > /dev/null 2>&1 ; then # This is a better choice than ps aux because it restricts the list of # processes to those of the running user. The w is needed on some # systems to get a long output for the command PSPGM="ps -fwu $LOGNAME"elif ps -fu $LOGNAME > /dev/null 2>&1 ; then # This is a better choice than ps aux because it restricts the list of # processes to those of the running user. PSPGM="ps -fu $LOGNAME"else PSPGM="ps auxww"fiOutTimetestfiles="$testfiles aborttest.out"/bin/rm -f aborttest.out aborttest.p1 aborttest.p2MakeExe aborttestecho "*** Tests of MPI_Abort ***"echo "*** Tests of MPI_Abort ***" >> aborttest.out$PSPGM | grep $LOGNAME | grep -v grep | grep -v runtests > aborttest.p1$mpirun $args -np 2 ./aborttest $* < /dev/null > /dev/null 2>&1# allow some time for processes to exitsleep 5$PSPGM | grep $LOGNAME | grep -v grep | grep -v runtests > aborttest.p2# If there was a consistant format, we could process it ...ndiff="`cat aborttest.p1 | wc -l` - `cat aborttest.p2 | wc -l`"ndiff=`expr $ndiff`if test "$ndiff" = 0 ; then echo "All processes aborted" >> aborttest.out else echo "Suspicious processes remain" >> aborttest.out #echo "Processes before" >> aborttest.out #cat aborttest.p1 >> aborttest.out #echo "Processes after" >> aborttest.out #cat aborttest.p2 >> aborttest.out echo "Differences are" >> aborttest.out diff -b aborttest.p1 aborttest.p2 >> aborttest.out # Try to kill them $PSPGM | grep $LOGNAME | grep aborttest | awk '{ print "kill ", $2 }' | shfiecho "*** Tests of MPI_Abort ***" >> aborttest.outrm -f aborttest.p1 aborttest.p2CleanExe aborttestOutTime/bin/rm -f aborttest.p1 aborttest.p2echo "*** Tests of MPI_Abort (alt) ***"echo "*** Tests of MPI_Abort (alt) ***" >> aborttest.out$PSPGM | grep $LOGNAME > aborttest.p1$mpirun $args -np 2 ./aborttest -altmaster $* > /dev/null 2>&1sleep 5$PSPGM | grep $LOGNAME > aborttest.p2ndiff="`cat aborttest.p1 | wc -l` - `cat aborttest.p2 | wc -l`"ndiff=`expr $ndiff`if test "$ndiff" = 0 ; then echo "All processes aborted" >> aborttest.out else echo "Suspicious processes remain" >> aborttest.out #echo "Processes before" >> aborttest.out #cat aborttest.p1 >> aborttest.out #echo "Processes after" >> aborttest.out #cat aborttest.p2 >> aborttest.out echo "Differences are" >> aborttest.out diff -b aborttest.p1 aborttest.p2 >> aborttest.out # Try to kill them $PSPGM | grep $LOGNAME | grep aborttest | awk '{ print "kill ", $2 }' | shfiecho "*** Tests of MPI_Abort (alt) ***" >> aborttest.out/bin/rm -f aborttest.p1 aborttest.p2CleanExe aborttest## Run Fortran tests ONLY if Fortran availableif [ @HAS_FORTRAN@ = 1 ] ; then RunTest errstringsf 1 "*** Tests of Fortran error strings ***" RunTest getprocf 1 "*** Test MPI_Get_processor_name in Fortran ***" RunTest errhandf 1 "*** Tests of error handling in Fortran ***"fielse # Just run checks testfiles=*.out if test "$testfiles" eq "*.out" ; then echo "No output files remain from previous test!" exit 1 fifi#echo '*** Checking for differences from expected output ***'CheckAllOutput env.diffexit 0
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -