Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Kill context test since contextes cannot be used without simix anymore
[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 xbt_TESTS=" \
34             xbt/log_usage@EXEEXT@;        \
35             xbt/graphxml_usage@EXEEXT@ @srcdir@/xbt/graph.xml;    \
36             xbt/heap_bench@EXEEXT@;"
37
38 surf_TESTS="surf/lmm_usage@EXEEXT@;                                        \
39             surf/maxmin_bench@EXEEXT@;                                        \
40             surf/trace_usage@EXEEXT@ --cfg=path:@srcdir@/surf/;              \
41             surf/surf_usage@EXEEXT@  --cfg=path:@srcdir@/surf/ platform.xml; \
42             surf/surf_usage2@EXEEXT@ --cfg=path:@srcdir@/surf/ platform.xml;"
43
44 simdag_TESTS="simdag/sd_test --cfg=path:@srcdir@/simdag @srcdir@/simdag/small_platform_variable.xml; \
45               simdag/sd_test @top_srcdir@/examples/msg/small_platform.xml; \
46               simdag/sd_test @top_srcdir@/examples/msg/msg_platform.xml; "
47
48
49 ##
50 ## Loop on all tests to run them
51 ##
52
53 # we split tests on ';' so that they can contain spaces (test=accumulator)
54 test=""
55
56 for testpart in $xbt_TESTS $surf_TESTS $simdag_TESTS
57 do
58   test="$test $testpart"
59   if echo $test | grep  ';' >/dev/null ; then
60     # end of test declaration found.
61   
62     # we must have a space after the ;
63     if echo $test | egrep ';[^ ]' ; then
64       echo "$0.in broken: you should add a space after each ';'"
65       exit 1
66     fi
67     
68     # Cleanup test declaration, run it.
69     test=`echo $test | sed 's/;//'`
70     
71     if [ ".$1" = .windump ] ; then
72       test=`echo $test | sed 's|/home.*testsuite/|//10.0.2.4/qemu/testsuite/|'`
73       test=`echo $test | sed 's|/|\\\\|g'`
74       echo "\\\\10.0.2.4\\qemu\\testsuite\\$test"
75       echo "@if errorlevel 1 echo ERRORERRORERRORERRORERRORERRORERRORERRORERRORERRORERRORERROR"
76       test=""
77     else
78       tests_nb=`expr $tests_nb + 1`
79       echo "#### Test $test"
80       if [ x@EXEEXT@ = x ] ; then
81         :
82       else
83         # overwrites "valgrind" as a value, but should be exclusive.
84         exenv=wine  
85       fi
86       exenvsave=$exenv  
87       if [ "x$test" = "xxbt/dict_crash@EXEEXT@" ] ; then 
88         if echo $exenv | grep valgrind >/dev/null ; then
89           exenv=
90         fi
91         $exenv ./$test --log="root.thres=info" 2>&1
92         retval=$?
93       else 
94         if [ x@EXEEXT@ != x ] && [ x$exenv = xwine ] ; then 
95           if echo ${test} | grep @EXEEXT@ >/dev/null ; then : ; else
96             exenv=""
97           fi
98         fi
99         $exenv ./$test --log="root.thres=info" 2>&1
100         retval=$?
101       fi
102       exenv=$exenvsave
103       if [ $retval != 0 ] ; then if [ $retval != 77 ]; then
104         echo "## failed" # . Rerun $test with full details."
105 #      if [ "x$test" = "xdict_crash" ] ; then
106 #      $exenv ./$test --log="root.thres=debug" 2>&1
107 #    else 
108 #      $exenv ./$test --log="root.thres=debug" 2>&1
109 #    fi
110         failed_nb=`expr $failed_nb + 1`
111         echo "  $test (returned $retval)" >> test.failed
112       else # retval == 77
113         echo "## Ignored since it returned 77"
114         ignored_nb=`expr $ignored_nb + 1`
115         echo "  $test" >> test.ignored
116       fi else
117         echo "## Success"
118         success_nb=`expr $success_nb + 1`
119         echo "  $test" >> test.success
120       fi
121       test=""
122     fi # end of ';' found in test declaration => run it
123   fi # end of run it only if not in windump mode
124 done
125
126 ###
127 ### Display summary
128 ###
129 if [ ".$1" = .windump ] ; then
130   echo pause
131   exit 0
132 fi
133
134 echo
135 echo "#### Summary"
136 echo "$success_nb tests of $tests_nb successfull:"
137 cat test.success
138
139 if [ $ignored_nb != 0 ] ; then
140   echo "$failed_nb tests of $tests_nb ignored:"
141   cat test.ignored
142   echo "  (they returned 77, meaning that they are not applicable)"
143 fi
144 if [ $failed_nb != 0 ] ; then
145   echo "$failed_nb tests of $tests_nb failed: "
146   cat test.failed
147   echo "Rerun the tests using the following command: script -c 'make check' simgrid.tests.log"
148   echo " and send the following informations to simgrid-devel@lists.gforge.inria.fr:"
149   echo "   - the file simgrid.tests.log produced by this command."
150   echo "   - a short description of the target platform (arch, OS, distrib, compiler)."
151   echo "   - the config.log produced by the compilation."
152 fi
153
154 rm -f test.success test.failed test.ignored
155 exit $failed_nb