Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Let the hack to make solaris happy work even when bash is not installed, and when...
[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=" xbt/ex_test@EXEEXT@;          \
34             xbt/log_usage@EXEEXT@;        \
35             xbt/dynar_int@EXEEXT@;        \
36               xbt/dynar_double@EXEEXT@;   \
37               xbt/dynar_string@EXEEXT@;   \
38             xbt/dict_usage@EXEEXT@;       \
39               xbt/dict_crash@EXEEXT@;     \
40               xbt/multidict_crash@EXEEXT@; \
41             xbt/config_usage@EXEEXT@;     \
42             xbt/heap_bench@EXEEXT@;"
43            
44 surf_TESTS="surf/maxmin_usage@EXEEXT@;                                        \
45             surf/maxmin_bench@EXEEXT@;                                        \
46             surf/trace_usage@EXEEXT@ --surf-path=@srcdir@/surf/;              \
47             surf/surf_usage@EXEEXT@  --surf-path=@srcdir@/surf/ platform.xml; \
48             surf/surf_usage2@EXEEXT@ --surf-path=@srcdir@/surf/ platform.xml;"
49
50 gras_TESTS="gras/trp_tcp_usage;      gras/trp_file_usage;                        \
51             gras/datadesc_usage@EXEEXT@;                                         \
52             gras/datadesc_usage@EXEEXT@ --read @srcdir@/gras/datadesc.little32;  \
53             gras/datadesc_usage@EXEEXT@ --read @srcdir@/gras/datadesc.little32_4;\
54             gras/datadesc_usage@EXEEXT@ --read @srcdir@/gras/datadesc.little64;  \
55             gras/datadesc_usage@EXEEXT@ --read @srcdir@/gras/datadesc.big32;     \
56             gras/datadesc_usage@EXEEXT@ --read @srcdir@/gras/datadesc.big32_8_4; \
57             gras/datadesc_usage@EXEEXT@ --read @srcdir@/gras/datadesc.big32_2;"     
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
72 do
73   test="$test $testpart"
74   if echo $test | grep ';' ; 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     tests_nb=`expr $tests_nb + 1`
87     echo "#### Test $test"
88     if [ x@EXEEXT@ = x ] ; then
89       :
90     else
91       # overwrites "valgrind" as a value, but should be exclusive.
92       exenv=wine  
93     fi
94     exenvsave=$exenv    
95     if [ "x$test" = "xxbt/dict_crash@EXEEXT@" ] ; then 
96       if echo $exenv | grep valgrind >/dev/null ; then
97         exenv=
98       fi
99       $exenv ./$test --xbt-log="root.thres=info" 2>&1
100       retval=$?
101     else 
102       if [ x@EXEEXT@ != x ] && [ x$exenv = xwine ] ; then 
103         if echo ${test} | grep @EXEEXT@ >/dev/null ; then : ; else
104           exenv=""
105         fi
106       fi
107       $exenv ./$test --xbt-log="root.thres=info" 2>&1
108       retval=$?
109     fi
110     exenv=$exenvsave
111     if [ $retval != 0 ] ; then if [ $retval != 77 ]; then
112       echo "## failed" # . Rerun $test with full details."
113 #      if [ "x$test" = "xdict_crash" ] ; then
114 #      $exenv ./$test --xbt-log="root.thres=debug" 2>&1
115 #    else 
116 #      $exenv ./$test --xbt-log="root.thres=debug" 2>&1
117 #    fi
118       failed_nb=`expr $failed_nb + 1`
119       echo "  $test (returned $retval)" >> test.failed
120     else # retval == 77
121       echo "## Ignored since it returned 77"
122       ignored_nb=`expr $ignored_nb + 1`
123       echo "  $test" >> test.ignored
124     fi else
125       echo "## Success"
126       success_nb=`expr $success_nb + 1`
127       echo "  $test" >> test.success
128     fi
129     test=""
130   fi # end of ';' found in test declaration => run it
131 done
132
133 ###
134 ### Display summary
135 ###
136
137 echo
138 echo "#### Summary"
139 echo "$success_nb tests of $tests_nb successfull:"
140 cat test.success
141
142 if [ $ignored_nb != 0 ] ; then
143   echo "$failed_nb tests of $tests_nb ignored:"
144   cat test.ignored
145   echo "  (they returned 77, meaning that they are not applicable)"
146 fi
147 if [ $failed_nb != 0 ] ; then
148   echo "$failed_nb tests of $tests_nb failed: "
149   cat test.failed
150   echo "Rerun the tests using the following command: script -c 'make test' simgrid.tests.log"
151   echo " and send the following informations to simgrid-devel@lists.gforge.inria.fr:"
152   echo "   - the file simgrid.tests.log produced by this command."
153   echo "   - a short description of the target platform (arch, OS, distrib, compiler)."
154   echo "   - the config.log produced by the compilation."
155 fi
156
157 rm -f test.success test.failed test.ignored
158 exit $failed_nb