Logo AND Algorithmique Numérique Distribuée

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