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
21 MAKE="make --no-print-directory"
25 basedir=`echo $arg | sed 's/-basedir=//'`
28 srcdir=`echo $arg | sed 's/-srcdir=//'`
34 margs=`echo $arg | sed 's/-margs=//'`
39 summaryfile=`echo A$arg | sed 's/A-summaryfile=//'`
50 echo "runtests [-checkonly] [-margs='...']"
51 echo "run tests in this directory. If -checkonly set, just run"
52 echo "the differences check (do NO rerun the test programs)."
53 echo "If -margs is used, these options are passed to mpirun."
54 echo "If -small is used, the examples are built, run, and deleted."
58 if test -n "$arg" ; then
59 echo "runtests: Unknown argument ($arg)"
66 mpirun=" ${basedir}/bin/smpirun -platform ${srcdir}/../../../../examples/msg/small_platform_with_routers.xml -hostfile ${srcdir}/../../hostfile --log=root.thres:critical"
68 # Load basic procedures
69 . ${srcdir}/../runbase
71 # If the programs are not available, run make.
72 if [ ! -x timers -a $makeeach = 0 -a $runtests = 1 ] ; then
77 if [ $runtests = 1 ] ; then
78 #replaced sleep by smpi_sleep to avoid problems with real/simulation powers
79 #RunTest timers 1 "*** Timer tests ***"
81 RunTest init 2 "*** MPI_Initialized tests ***"
83 #RunTest baseattr 1 "*** Basic attributes ***"
85 RunTest gtime 1 "*** WTIME_IS_GLOBAL ***"
87 #RunTest errhand 1 "*** Tests of error handling ***"
89 #RunTest errhand2 1 "*** Tests of error handling reference counting ***"
91 # Do not run sigchk by default because it generates warnings that are not
92 # errors, and the basic test should be clean
93 if [ "$MPICH_TESTS_SIGCHK" = yes ] ; then
94 RunTest sigchk 1 "*** Tests of signals used ***"
97 RunTest getproc 1 "*** Test Get Processor Name ***"
100 #testfiles="$testfiles cmdline.out"
103 #echo "*** Tests of command line handling ***"
104 #echo "*** Tests of command line handling ***" >> cmdline.out
105 #$mpirun $args -np 2 ./cmdline a "b c" "d'e" 'f"g" h' $* </dev/null l>> cmdline.out 2>&1
106 #echo "*** Tests of command line handling ***" >> cmdline.out
108 #if [ ! -s cmdline.stdo ] ; then
109 # cat >cmdline.stdo <<EOF
110 #*** Tests of command line handling ***
112 #*** Tests of command line handling ***
117 # If there was a Unix standard interface to ps, we could check for orphaned
119 if ps -fwu $LOGNAME > /dev/null 2>&1 ; then
120 # This is a better choice than ps aux because it restricts the list of
121 # processes to those of the running user. The w is needed on some
122 # systems to get a long output for the command
123 PSPGM="ps -fwu $LOGNAME"
124 elif ps -fu $LOGNAME > /dev/null 2>&1 ; then
125 # This is a better choice than ps aux because it restricts the list of
126 # processes to those of the running user.
127 PSPGM="ps -fu $LOGNAME"
132 testfiles="$testfiles aborttest.out"
133 rm -f aborttest.out aborttest.p1 aborttest.p2 aborttest.out2
135 echo "*** Tests of MPI_Abort ***"
136 echo "*** Tests of MPI_Abort ***" >> aborttest.out
137 # We also remove lines that look like build lines in case this system
138 # is being used for other tests. This is incomplete, but
139 # it may help reduce false positives
140 $PSPGM | grep $LOGNAME | grep -v grep | grep -v runtests | \
141 grep -v 'make ' | grep -v ' /ld' | grep -v 'gcc' | \
142 grep -v 'collect2' > aborttest.p1
143 # Send the output of aborttest to a file in case there is a problem
144 $mpirun $args -np 2 ./aborttest $* < /dev/null >> aborttest.out2 2>&1
145 # allow some time for processes to exit
147 $PSPGM | grep $LOGNAME | grep -v grep | grep -v runtests | \
148 grep -v 'make ' | grep -v ' /ld' | grep -v 'gcc' | \
149 grep -v 'collect2' > aborttest.p2
150 # If there was a consistant format, we could process it ...
151 ndiff="`cat aborttest.p1 | wc -l` - `cat aborttest.p2 | wc -l`"
153 if test "$ndiff" = 0 ; then
154 echo "All processes aborted" >> aborttest.out
156 echo "Suspicious processes remain" >> aborttest.out
157 #echo "Processes before" >> aborttest.out
158 #cat aborttest.p1 >> aborttest.out
159 #echo "Processes after" >> aborttest.out
160 #cat aborttest.p2 >> aborttest.out
161 echo "Differences are" >> aborttest.out
162 diff -b aborttest.p1 aborttest.p2 >> aborttest.out
163 if [ -s aborttest.out2 ] ; then
164 echo "Output from mpirun was"
165 cat aborttest.out2 >> aborttest.out
168 $PSPGM | grep $LOGNAME | grep aborttest | awk '{ print "kill ", $2 }' | sh
170 echo "*** Tests of MPI_Abort ***" >> aborttest.out
171 rm -f aborttest.p1 aborttest.p2 aborttest.out2
174 rm -f aborttest.p1 aborttest.p2 aborttest.out2
175 echo "*** Tests of MPI_Abort (alt) ***"
176 echo "*** Tests of MPI_Abort (alt) ***" >> aborttest.out
177 $PSPGM | grep $LOGNAME | grep -v grep | grep -v runtests | \
178 grep -v 'make ' | grep -v ' /ld' | grep -v 'gcc' | \
179 grep -v 'collect2' > aborttest.p1
180 $mpirun $args -np 2 ./aborttest -altmaster $* >aborttest.out2 2>&1
182 $PSPGM | grep $LOGNAME | grep -v grep | grep -v runtests | \
183 grep -v 'make ' | grep -v ' /ld' | grep -v 'gcc' | \
184 grep -v 'collect2' > aborttest.p2
185 ndiff="`cat aborttest.p1 | wc -l` - `cat aborttest.p2 | wc -l`"
187 if test "$ndiff" = 0 ; then
188 echo "All processes aborted" >> aborttest.out
190 echo "Suspicious processes remain" >> aborttest.out
191 #echo "Processes before" >> aborttest.out
192 #cat aborttest.p1 >> aborttest.out
193 #echo "Processes after" >> aborttest.out
194 #cat aborttest.p2 >> aborttest.out
195 echo "Differences are" >> aborttest.out
196 diff -b aborttest.p1 aborttest.p2 >> aborttest.out
197 if [ -s aborttest.out2 ] ; then
198 echo "Output from mpirun was"
199 cat aborttest.out2 >> aborttest.out
202 $PSPGM | grep $LOGNAME | grep aborttest | awk '{ print "kill ", $2 }' | sh
204 echo "*** Tests of MPI_Abort (alt) ***" >> aborttest.out
205 rm -f aborttest.p1 aborttest.p2 aborttest.out2
209 # Run Fortran tests ONLY if Fortran available
212 RunTest errstringsf 1 "*** Tests of Fortran error strings ***"
214 RunTest getprocf 1 "*** Test MPI_Get_processor_name in Fortran ***"
216 RunTest errhandf 1 "*** Tests of error handling in Fortran ***"
222 if test "$testfiles" eq "*.out" ; then
223 echo "No output files remain from previous test!"
229 echo '*** Checking for differences from expected output ***'
230 CheckAllOutput env.diff