Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Remove Makefile.am from autotools.
[simgrid.git] / testsuite / run_tests.in
1 #! @BASH@
2
3 ##
4 ## Cleanups of previous executions
5 ##
6 failed_nb=0
7 success_nb=0
8 ignored_nb=0
9 tests_nb=0
10
11 rm -f test.failed test.success test.ignored
12
13 # Work around a libtool issue on solaris, making sure that it works even on sh older than tcsh
14 LD_LIBRARY_PATH=@top_srcdir@/src/.libs
15 if export LD_LIBRARY_PATH ; then 
16   :
17 else
18   setenv LD_LIBRARY_PATH @top_srcdir@/src/.libs
19 fi
20
21 ##
22 ## Args parsing (simplistic for now)
23 ##
24 if [ xvalgrind = "x$1" ] ; then
25   exenv="libtool --mode=execute valgrind --show-reachable=yes"
26 else
27   exenv=
28 fi
29
30 ##
31 ## Tests defintions
32 ##
33
34 ##########################################################################
35 ## UPDATE buildtools/Cmake/CTestList.txt WHEN YOU CHANGE SOMETHING HERE ##
36 ##########################################################################
37
38 xbt_TESTS=" \
39             xbt/log_usage@EXEEXT@;        \
40             xbt/graphxml_usage@EXEEXT@ @srcdir@/xbt/graph.xml;    \
41             xbt/heap_bench@EXEEXT@;"
42
43 surf_TESTS="surf/lmm_usage@EXEEXT@;                                        \
44             surf/maxmin_bench@EXEEXT@;                                        \
45             surf/trace_usage@EXEEXT@ --cfg=path:@srcdir@/surf/;              \
46             surf/surf_usage@EXEEXT@  --cfg=path:@srcdir@/surf/ platform.xml; \
47             surf/surf_usage2@EXEEXT@ --cfg=path:@srcdir@/surf/ platform.xml;"
48
49 simdag_TESTS="simdag/sd_test --cfg=path:@srcdir@/simdag @srcdir@/simdag/small_platform_variable.xml; \
50               simdag/sd_test @top_srcdir@/examples/msg/small_platform.xml; \
51               simdag/sd_test @top_srcdir@/examples/msg/msg_platform.xml; "
52
53
54 ##
55 ## Loop on all tests to run them
56 ##
57
58 # we split tests on ';' so that they can contain spaces (test=accumulator)
59 test=""
60
61 for testpart in $xbt_TESTS $surf_TESTS $simdag_TESTS
62 do
63   test="$test $testpart"
64   if echo $test | grep  ';' >/dev/null ; then
65     # end of test declaration found.
66   
67     # we must have a space after the ;
68     if echo $test | egrep ';[^ ]' ; then
69       echo "$0.in broken: you should add a space after each ';'"
70       exit 1
71     fi
72     
73     # Cleanup test declaration, run it.
74     test=`echo $test | sed 's/;//'`
75     
76     if [ ".$1" = .windump ] ; then
77       test=`echo $test | sed 's|/home.*testsuite/|//10.0.2.4/qemu/testsuite/|'`
78       test=`echo $test | sed 's|/|\\\\|g'`
79       echo "\\\\10.0.2.4\\qemu\\testsuite\\$test"
80       echo "@if errorlevel 1 echo ERRORERRORERRORERRORERRORERRORERRORERRORERRORERRORERRORERROR"
81       test=""
82     else
83       tests_nb=`expr $tests_nb + 1`
84       echo "#### Test $test"
85       if [ x@EXEEXT@ = x ] ; then
86         :
87       else
88         # overwrites "valgrind" as a value, but should be exclusive.
89         exenv=wine  
90       fi
91       exenvsave=$exenv  
92       if [ "x$test" = "xxbt/dict_crash@EXEEXT@" ] ; then 
93         if echo $exenv | grep valgrind >/dev/null ; then
94           exenv=
95         fi
96         $exenv ./$test --log="root.thres=info" 2>&1
97         retval=$?
98       else 
99         if [ x@EXEEXT@ != x ] && [ x$exenv = xwine ] ; then 
100           if echo ${test} | grep @EXEEXT@ >/dev/null ; then : ; else
101             exenv=""
102           fi
103         fi
104         $exenv ./$test --log="root.thres=info" 2>&1
105         retval=$?
106       fi
107       exenv=$exenvsave
108       if [ $retval != 0 ] ; then if [ $retval != 77 ]; then
109         echo "## failed" # . Rerun $test with full details."
110 #      if [ "x$test" = "xdict_crash" ] ; then
111 #      $exenv ./$test --log="root.thres=debug" 2>&1
112 #    else 
113 #      $exenv ./$test --log="root.thres=debug" 2>&1
114 #    fi
115         failed_nb=`expr $failed_nb + 1`
116         echo "  $test (returned $retval)" >> test.failed
117       else # retval == 77
118         echo "## Ignored since it returned 77"
119         ignored_nb=`expr $ignored_nb + 1`
120         echo "  $test" >> test.ignored
121       fi else
122         echo "## Success"
123         success_nb=`expr $success_nb + 1`
124         echo "  $test" >> test.success
125       fi
126       test=""
127     fi # end of ';' found in test declaration => run it
128   fi # end of run it only if not in windump mode
129 done
130
131 ###
132 ### Display summary
133 ###
134 if [ ".$1" = .windump ] ; then
135   echo pause
136   exit 0
137 fi
138
139 echo
140 echo "#### Summary"
141 echo "$success_nb tests of $tests_nb successfull:"
142 cat test.success
143
144 if [ $ignored_nb != 0 ] ; then
145   echo "$failed_nb tests of $tests_nb ignored:"
146   cat test.ignored
147   echo "  (they returned 77, meaning that they are not applicable)"
148 fi
149 if [ $failed_nb != 0 ] ; then
150   echo "$failed_nb tests of $tests_nb failed: "
151   cat test.failed
152   echo "Rerun the tests using the following command: script -c 'make check' simgrid.tests.log"
153   echo " and send the following informations to simgrid-devel@lists.gforge.inria.fr:"
154   echo "   - the file simgrid.tests.log produced by this command."
155   echo "   - a short description of the target platform (arch, OS, distrib, compiler)."
156   echo "   - the config.log produced by the compilation."
157 fi
158
159 rm -f test.success test.failed test.ignored
160 exit $failed_nb