Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
821742718974b7f065ea60ec594c715200524e8f
[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 gras_TESTS="gras/trp_tcp_usage;      gras/trp_file_usage;                        \
44             gras/datadesc_usage@EXEEXT@;                                         \
45             gras/datadesc_usage@EXEEXT@ --read @srcdir@/gras/datadesc.little32;  \
46             gras/datadesc_usage@EXEEXT@ --read @srcdir@/gras/datadesc.little32_4;\
47             gras/datadesc_usage@EXEEXT@ --read @srcdir@/gras/datadesc.little64;  \
48             gras/datadesc_usage@EXEEXT@ --read @srcdir@/gras/datadesc.big32;     \
49             gras/datadesc_usage@EXEEXT@ --read @srcdir@/gras/datadesc.big32_8_4; \
50             gras/datadesc_usage@EXEEXT@ --read @srcdir@/gras/datadesc.big32_2;"     
51
52 # Data sets still to regenerate:
53 #
54 #           gras/datadesc_usage@EXEEXT@ --read @srcdir@/gras/datadesc.big32_4;   \
55 #           gras/datadesc_usage@EXEEXT@ --read @srcdir@/gras/datadesc.big64;"    
56
57 ##
58 ## Loop on all tests to run them
59 ##
60
61 # we split tests on ';' so that they can contain spaces (test=accumulator)
62 test=""
63
64 for testpart in $xbt_TESTS $gras_TESTS $surf_TESTS
65 do
66   test="$test $testpart"
67   if echo $test | grep ';' ; then
68     # end of test declaration found.
69   
70     # we must have a space after the ;
71     if echo $test | egrep ';[^ ]' ; then
72       echo "$0.in broken: you should add a space after each ';'"
73       exit 1
74     fi
75     
76     # Cleanup test declaration, run it.
77     test=`echo $test | sed 's/;//'`
78     
79     tests_nb=`expr $tests_nb + 1`
80     echo "#### Test $test"
81     if [ x@EXEEXT@ = x ] ; then 
82       wine=
83     else
84       wine=wine
85     fi
86     if [ "x$test" = "xdict_crash@EXEEXT@" ] ; then
87       $wine ./$test --xbt-log="root.thres=info" 2>&1
88       retval=$?
89     else 
90       winesave=$wine
91       if [ x@EXEEXT@ != x ] ; then 
92         if echo ${test} | grep @EXEEXT@ >/dev/null ; then : ; else
93 #         echo "This is not a win32 binary, don't use wine"
94           wine=""
95         fi
96       fi
97         # if the user defines valgrind while cross-compiling, too bad
98         $wine $valgrind ./$test --xbt-log="root.thres=info" 2>&1
99         retval=$?
100       wine=$winesave
101     fi
102     if [ $retval != 0 ] ; then if [ $retval != 77 ]; then
103       echo "## failed" # . Rerun $test with full details."
104 #      if [ "x$test" = "xdict_crash" ] ; then
105 #      $wine ./$test --xbt-log="root.thres=debug" 2>&1
106 #    else 
107 #      $wine $valgrind ./$test --xbt-log="root.thres=debug" 2>&1
108 #    fi
109       failed_nb=`expr $failed_nb + 1`
110       echo "  $test (returned $retval)" >> test.failed
111     else # retval == 77
112       echo "## Ignored since it returned 77"
113       ignored_nb=`expr $ignored_nb + 1`
114       echo "  $test" >> test.ignored
115     fi else
116       echo "## Success"
117       success_nb=`expr $success_nb + 1`
118       echo "  $test" >> test.success
119     fi
120     test=""
121   fi # end of ';' found in test declaration => run it
122 done
123
124 ###
125 ### Display summary
126 ###
127
128 echo
129 echo "#### Summary"
130 echo "$success_nb tests of $tests_nb successfull:"
131 cat test.success
132
133 if [ $ignored_nb != 0 ] ; then
134   echo "$failed_nb tests of $tests_nb ignored:"
135   cat test.ignored
136   echo "  (they returned 77, meaning that they are not applicable)"
137 fi
138 if [ $failed_nb != 0 ] ; then
139   echo "$failed_nb tests of $tests_nb failed: "
140   cat test.failed
141   echo "Rerun the tests using the following command: script -c 'make test' simgrid.tests.log"
142   echo " and send the following informations to simgrid-devel@lists.gforge.inria.fr:"
143   echo "   - the file simgrid.tests.log produced by this command."
144   echo "   - a short description of the target platform (arch, OS, distrib, compiler)."
145   echo "   - the config.log produced by the compilation."
146 fi
147
148 rm -f test.success test.failed test.ignored
149 exit $failed_nb