Logo AND Algorithmique Numérique Distribuée

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