Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Try harder to get make remote on VPATH (but doesn't work because dist creates the...
[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
14 export LD_LIBRARY_PATH=@top_srcdir@/src/.libs
15
16 ##
17 ## Args parsing (simplistic for now)
18 ##
19 if [ xvalgrind = "x$1" ] ; then
20   valgrind="libtool --mode=execute valgrind --show-reachable=yes"
21 else
22   valgrind=
23 fi
24
25 ##
26 ## Tests defintions
27 ##
28 xbt_TESTS=" xbt/log_usage@EXEEXT@;        \
29             xbt/dynar_int@EXEEXT@;        \
30               xbt/dynar_double@EXEEXT@;   \
31               xbt/dynar_string@EXEEXT@;   \
32             xbt/dict_usage@EXEEXT@;       \
33               xbt/dict_crash@EXEEXT@;     \
34             xbt/config_usage@EXEEXT@;     \
35             xbt/heap_bench@EXEEXT@;"
36            
37 surf_TESTS="surf/maxmin_usage@EXEEXT@;                                        \
38             surf/maxmin_bench@EXEEXT@;                                        \
39             surf/trace_usage@EXEEXT@ --surf-path=@srcdir@/surf/;              \
40             surf/surf_usage@EXEEXT@  --surf-path=@srcdir@/surf/ platform.xml; \
41             surf/surf_usage2@EXEEXT@ --surf-path=@srcdir@/surf/ platform.xml;"
42
43 msg_TESTS=" msg/msg_test@EXEEXT@ --surf-path=@top_srcdir@/examples/msg/;"
44
45 gras_TESTS="gras/trp_tcp_usage;      gras/trp_file_usage;                        \
46             gras/datadesc_usage@EXEEXT@;                                         \
47             gras/datadesc_usage@EXEEXT@ --read @srcdir@/gras/datadesc.little32;  \
48             gras/datadesc_usage@EXEEXT@ --read @srcdir@/gras/datadesc.little32_4;\
49             gras/datadesc_usage@EXEEXT@ --read @srcdir@/gras/datadesc.little64;  \
50             gras/datadesc_usage@EXEEXT@ --read @srcdir@/gras/datadesc.big32;     \
51             gras/datadesc_usage@EXEEXT@ --read @srcdir@/gras/datadesc.big32_8_4; \
52             gras/datadesc_usage@EXEEXT@ --read @srcdir@/gras/datadesc.big32_4;   \
53             gras/datadesc_usage@EXEEXT@ --read @srcdir@/gras/datadesc.big32_2;   \
54             gras/datadesc_usage@EXEEXT@ --read @srcdir@/gras/datadesc.big64;"    \
55             
56 ##
57 ## Loop on all tests to run them
58 ##
59
60 # we split tests on ';' so that they can contain spaces (test=accumulator)
61 test=""
62
63 for testpart in $xbt_TESTS $msg_TESTS $gras_TESTS $surf_TESTS
64 do
65   test="$test $testpart"
66   if echo $test | grep ';' ; then
67     # end of test declaration found.
68   
69     # we must have a space after the ;
70     if echo $test | egrep ';[^ ]' ; then
71       echo "$0.in broken: you should add a space after each ';'"
72       exit 1
73     fi
74     
75     # Cleanup test declaration, run it.
76     test=`echo $test | sed 's/;//'`
77     
78     tests_nb=`expr $tests_nb + 1`
79     echo "#### Test $test"
80     if [ x@EXEEXT@ = x ] ; then 
81       wine=
82     else
83       wine=wine
84     fi
85     if [ "x$test" = "xdict_crash@EXEEXT@" ] ; then
86       $wine ./$test --xbt-log="root.thres=info" 2>&1
87       retval=$?
88     else 
89       winesave=$wine
90       if [ x@EXEEXT@ != x ] ; then 
91         if echo ${test} | grep @EXEEXT@ >/dev/null ; then : ; else
92 #         echo "This is not a win32 binary, don't use wine"
93           wine=""
94         fi
95       fi
96         # if the user defines valgrind while cross-compiling, too bad
97         $wine $valgrind ./$test --xbt-log="root.thres=info" 2>&1
98         retval=$?
99       wine=$winesave
100     fi
101     if [ $retval != 0 ] ; then if [ $retval != 77 ]; then
102       echo "## failed" # . Rerun $test with full details."
103 #      if [ "x$test" = "xdict_crash" ] ; then
104 #      $wine ./$test --xbt-log="root.thres=debug" 2>&1
105 #    else 
106 #      $wine $valgrind ./$test --xbt-log="root.thres=debug" 2>&1
107 #    fi
108       failed_nb=`expr $failed_nb + 1`
109       echo "  $test (returned $retval)" >> test.failed
110     else # retval == 77
111       echo "## Ignored since it returned 77"
112       ignored_nb=`expr $ignored_nb + 1`
113       echo "  $test" >> test.ignored
114     fi else
115       echo "## Success"
116       success_nb=`expr $success_nb + 1`
117       echo "  $test" >> test.success
118     fi
119     test=""
120   fi # end of ';' found in test declaration => run it
121 done
122
123 ###
124 ### Display summary
125 ###
126
127 echo
128 echo "#### Summary"
129 echo "$success_nb tests of $tests_nb successfull:"
130 cat test.success
131
132 if [ $ignored_nb != 0 ] ; then
133   echo "$failed_nb tests of $tests_nb ignored:"
134   cat test.ignored
135   echo "  (they returned 77, meaning that they are not applicable)"
136 fi
137 if [ $failed_nb != 0 ] ; then
138   echo "$failed_nb tests of $tests_nb failed: "
139   cat test.failed
140   echo "Rerun the tests using the following command: script -c 'make test' simgrid.tests.log"
141   echo " and send the following informations to simgrid2-users@listes.ens-lyon.fr:"
142   echo "   - the file simgrid.tests.log produced by this command."
143   echo "   - a short description of the target platform (arch, OS, distrib, compiler)."
144   echo "   - the config.log produced by the compilation."
145 fi
146
147 rm -f test.success test.failed test.ignored
148 exit $failed_nb