Logo AND Algorithmique Numérique Distribuée

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