Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
first commit to add the mpich-test suite to smpi tesh suite. Obviously all tests...
[simgrid.git] / teshsuite / smpi / mpich-test / env / runtests
1 #! /bin/sh
2 #
3 # Run some of the tests.  If any arguments are provided, pass them to the
4 # test programs.
5 #
6 # -mvhome is needed for the ANL SP, and is ignored by others
7
8 device=
9 MPICH_VERSION=
10 STOPFILE=${MPITEST_STOPTEST:-"$HOME/.stopmpichtests"}
11 MAKE="make --no-print-directory"
12
13 #
14 # Set mpirun to the name/path of the mpirun program
15 #FindMPIRUN
16 #
17 quiet=0
18 runtests=1
19 makeeach=0
20 writesummaryfile=no
21 MAKE="make --no-print-directory"
22 for arg in "$@" ; do
23     case $arg in 
24     -basedir=* )
25         basedir=`echo $arg | sed 's/-basedir=//'`
26         ;; 
27     -srcdir=* )
28         srcdir=`echo $arg | sed 's/-srcdir=//'`
29         ;; 
30         -checkonly )
31         runtests=0
32         ;;
33         -margs=*)
34         margs=`echo $arg | sed 's/-margs=//'`
35         args="$args $margs"
36         ;;
37         -summaryfile=*)
38         writesummaryfile=yes
39         summaryfile=`echo A$arg | sed 's/A-summaryfile=//'`
40         ;;
41         -small)
42         makeeach=1
43         shift
44         ;;
45         -quiet)
46         shift
47         quiet=1
48         ;;
49         -help|-u)
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."
55         exit 1
56         ;;
57         *)
58         if test -n "$arg" ; then
59             echo "runtests: Unknown argument ($arg)"
60             exit 1
61         fi
62         ;;
63     esac
64 done
65
66 mpirun=" ${basedir}/bin/smpirun -platform ${srcdir}/../../../../examples/msg/small_platform_with_routers.xml -hostfile ${srcdir}/../../hostfile  --log=root.thres:critical"
67 #
68 # Load basic procedures
69 . ${srcdir}/../runbase
70
71 # If the programs are not available, run make.
72 if [ ! -x timers -a $makeeach = 0 -a $runtests = 1 ] ; then
73     $MAKE
74 fi
75 #
76 testfiles=""
77 if [ $runtests = 1 ] ; then
78 #replaced sleep by smpi_sleep to avoid problems with real/simulation powers
79 #RunTest timers 1 "*** Timer tests ***"
80
81 RunTest init 2 "*** MPI_Initialized tests ***"
82 # uses MPI_Attr_get
83 #RunTest baseattr 1 "*** Basic attributes ***"
84
85 RunTest gtime 1 "*** WTIME_IS_GLOBAL ***"
86 #uses errhandlers
87 #RunTest errhand 1 "*** Tests of error handling ***"
88
89 #RunTest errhand2 1 "*** Tests of error handling reference counting ***"
90
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 ***"
95 fi
96
97 RunTest getproc 1 "*** Test Get Processor Name ***"
98
99 #OutTime
100 #testfiles="$testfiles cmdline.out"
101 #rm -f cmdline.out
102 #MakeExe cmdline
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
107 #CleanExe cmdline
108 #if [ ! -s cmdline.stdo ] ; then
109 #    cat >cmdline.stdo <<EOF
110 #*** Tests of command line handling ***
111 # No Errors
112 #*** Tests of command line handling ***
113 #EOF
114 #fi
115
116 #
117 # If there was a Unix standard interface to ps, we could check for orphaned
118 # processes...
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"
128 else
129    PSPGM="ps auxww"
130 fi
131 OutTime
132 testfiles="$testfiles aborttest.out"
133 rm -f aborttest.out aborttest.p1 aborttest.p2 aborttest.out2
134 MakeExe aborttest
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
146 sleep 5
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`"
152 ndiff=`expr $ndiff`
153 if test "$ndiff" = 0 ; then
154     echo "All processes aborted" >> aborttest.out    
155 else
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
166     fi
167     # Try to kill them
168     $PSPGM | grep $LOGNAME | grep aborttest | awk '{ print "kill ", $2 }' | sh
169 fi
170 echo "*** Tests of MPI_Abort ***" >> aborttest.out
171 rm -f aborttest.p1 aborttest.p2 aborttest.out2
172
173 OutTime
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
181 sleep 5
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`"
186 ndiff=`expr $ndiff`
187 if test "$ndiff" = 0 ; then
188     echo "All processes aborted" >> aborttest.out    
189 else
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
200     fi
201     # Try to kill them
202     $PSPGM | grep $LOGNAME | grep aborttest | awk '{ print "kill ", $2 }' | sh
203 fi
204 echo "*** Tests of MPI_Abort (alt) ***" >> aborttest.out
205 rm -f aborttest.p1 aborttest.p2 aborttest.out2
206 CleanExe aborttest
207
208 #
209 # Run Fortran tests ONLY if Fortran available
210 if [ 0 = 1 ] ; then 
211
212     RunTest errstringsf 1 "*** Tests of Fortran error strings ***"
213
214     RunTest getprocf 1 "*** Test MPI_Get_processor_name in Fortran ***"
215
216     RunTest errhandf 1 "*** Tests of error handling in Fortran ***"
217 fi
218
219 else
220     # Just run checks
221     testfiles=*.out
222     if test "$testfiles" eq "*.out" ; then
223         echo "No output files remain from previous test!"
224         exit 1
225     fi
226 fi
227
228 #
229 echo '*** Checking for differences from expected output ***'
230 CheckAllOutput env.diff
231 exit 0