3 # Run some of the tests. If any arguments are provided, pass them to the
6 # -mvhome is needed for the ANL SP, and is ignored by others
10 STOPFILE=${MPITEST_STOPTEST:-"$HOME/.stopmpichtests"}
11 MAKE="make --no-print-directory"
14 # Set mpirun to the name/path of the mpirun program
22 MAKE="make --no-print-directory"
26 basedir=`echo $arg | sed 's/-basedir=//'`
29 srcdir=`echo $arg | sed 's/-srcdir=//'`
32 have_fortran=`echo $arg | sed 's/-fort=//'`
38 margs=`echo $arg | sed 's/-margs=//'`
43 summaryfile=`echo A$arg | sed 's/A-summaryfile=//'`
54 echo "runtests [-checkonly] [-margs='...']"
55 echo "run tests in this directory. If -checkonly set, just run"
56 echo "the differences check (do NO rerun the test programs)."
57 echo "If -margs is used, these options are passed to mpirun."
58 echo "If -small is used, the examples are built, run, and deleted."
62 if test -n "$arg" ; then
63 echo "runtests: Unknown argument ($arg)"
70 mpirun=" ${basedir}/bin/smpirun -platform ${srcdir}/../../../../examples/msg/small_platform_with_routers.xml -hostfile ${srcdir}/../../hostfile --log=root.thres:critical"
72 # Load basic procedures
73 . ${srcdir}/../runbase
75 # If the programs are not available, run make.
76 if [ ! -x timers -a $makeeach = 0 -a $runtests = 1 ] ; then
81 if [ $runtests = 1 ] ; then
83 #RunTest timers 1 "*** Timer tests ***"
85 RunTest init 2 "*** MPI_Initialized tests ***"
87 #RunTest baseattr 1 "*** Basic attributes ***"
89 RunTest gtime 1 "*** WTIME_IS_GLOBAL ***"
91 #RunTest errhand 1 "*** Tests of error handling ***"
93 #RunTest errhand2 1 "*** Tests of error handling reference counting ***"
95 # Do not run sigchk by default because it generates warnings that are not
96 # errors, and the basic test should be clean
97 if [ "$MPICH_TESTS_SIGCHK" = yes ] ; then
98 RunTest sigchk 1 "*** Tests of signals used ***"
101 RunTest getproc 1 "*** Test Get Processor Name ***"
104 #testfiles="$testfiles cmdline.out"
107 #echo "*** Tests of command line handling ***"
108 #echo "*** Tests of command line handling ***" >> cmdline.out
109 #$mpirun $args -np 2 ./cmdline a "b c" "d'e" 'f"g" h' $* </dev/null l>> cmdline.out 2>&1
110 #echo "*** Tests of command line handling ***" >> cmdline.out
112 #if [ ! -s cmdline.stdo ] ; then
113 # cat >cmdline.stdo <<EOF
114 #*** Tests of command line handling ***
116 #*** Tests of command line handling ***
121 # If there was a Unix standard interface to ps, we could check for orphaned
123 if ps -fwu $LOGNAME > /dev/null 2>&1 ; then
124 # This is a better choice than ps aux because it restricts the list of
125 # processes to those of the running user. The w is needed on some
126 # systems to get a long output for the command
127 PSPGM="ps -fwu $LOGNAME"
128 elif ps -fu $LOGNAME > /dev/null 2>&1 ; then
129 # This is a better choice than ps aux because it restricts the list of
130 # processes to those of the running user.
131 PSPGM="ps -fu $LOGNAME"
136 testfiles="$testfiles aborttest.out"
137 rm -f aborttest.out aborttest.p1 aborttest.p2 aborttest.out2
139 echo "*** Tests of MPI_Abort ***"
140 echo "*** Tests of MPI_Abort ***" >> aborttest.out
141 # We also remove lines that look like build lines in case this system
142 # is being used for other tests. This is incomplete, but
143 # it may help reduce false positives
144 $PSPGM | grep $LOGNAME | grep -v grep | grep -v runtests | \
145 grep -v 'make ' | grep -v ' /ld' | grep -v 'gcc' | \
146 grep -v 'collect2' > aborttest.p1
147 # Send the output of aborttest to a file in case there is a problem
148 $mpirun $args -np 2 ./aborttest $* < /dev/null >> aborttest.out2 2>&1
149 # allow some time for processes to exit
151 $PSPGM | grep $LOGNAME | grep -v grep | grep -v runtests | \
152 grep -v 'make ' | grep -v ' /ld' | grep -v 'gcc' | \
153 grep -v 'collect2' > aborttest.p2
154 # If there was a consistant format, we could process it ...
155 ndiff="`cat aborttest.p1 | wc -l` - `cat aborttest.p2 | wc -l`"
157 if test "$ndiff" = 0 ; then
158 echo "All processes aborted" >> aborttest.out
160 echo "Suspicious processes remain" >> aborttest.out
161 #echo "Processes before" >> aborttest.out
162 #cat aborttest.p1 >> aborttest.out
163 #echo "Processes after" >> aborttest.out
164 #cat aborttest.p2 >> aborttest.out
165 echo "Differences are" >> aborttest.out
166 diff -b aborttest.p1 aborttest.p2 >> aborttest.out
167 if [ -s aborttest.out2 ] ; then
168 echo "Output from mpirun was"
169 cat aborttest.out2 >> aborttest.out
172 $PSPGM | grep $LOGNAME | grep aborttest | awk '{ print "kill ", $2 }' | sh
174 echo "*** Tests of MPI_Abort ***" >> aborttest.out
175 rm -f aborttest.p1 aborttest.p2 aborttest.out2
178 rm -f aborttest.p1 aborttest.p2 aborttest.out2
179 echo "*** Tests of MPI_Abort (alt) ***"
180 echo "*** Tests of MPI_Abort (alt) ***" >> aborttest.out
181 $PSPGM | grep $LOGNAME | grep -v grep | grep -v runtests | \
182 grep -v 'make ' | grep -v ' /ld' | grep -v 'gcc' | \
183 grep -v 'collect2' > aborttest.p1
184 $mpirun $args -np 2 ./aborttest -altmaster $* >aborttest.out2 2>&1
186 $PSPGM | grep $LOGNAME | grep -v grep | grep -v runtests | \
187 grep -v 'make ' | grep -v ' /ld' | grep -v 'gcc' | \
188 grep -v 'collect2' > aborttest.p2
189 ndiff="`cat aborttest.p1 | wc -l` - `cat aborttest.p2 | wc -l`"
191 if test "$ndiff" = 0 ; then
192 echo "All processes aborted" >> aborttest.out
194 echo "Suspicious processes remain" >> aborttest.out
195 #echo "Processes before" >> aborttest.out
196 #cat aborttest.p1 >> aborttest.out
197 #echo "Processes after" >> aborttest.out
198 #cat aborttest.p2 >> aborttest.out
199 echo "Differences are" >> aborttest.out
200 diff -b aborttest.p1 aborttest.p2 >> aborttest.out
201 if [ -s aborttest.out2 ] ; then
202 echo "Output from mpirun was"
203 cat aborttest.out2 >> aborttest.out
206 $PSPGM | grep $LOGNAME | grep aborttest | awk '{ print "kill ", $2 }' | sh
208 echo "*** Tests of MPI_Abort (alt) ***" >> aborttest.out
209 rm -f aborttest.p1 aborttest.p2 aborttest.out2
213 # Run Fortran tests ONLY if Fortran available
214 if [ $have_fortran -eq "1" ] ; then
216 # RunTest errstringsf 1 "*** Tests of Fortran error strings ***"
218 RunTest getprocf 1 "*** Test MPI_Get_processor_name in Fortran ***"
220 # RunTest errhandf 1 "*** Tests of error handling in Fortran ***"
226 if test "$testfiles" eq "*.out" ; then
227 echo "No output files remain from previous test!"
233 echo '*** Checking for differences from expected output ***'
234 CheckAllOutput env.diff