Logo AND Algorithmique Numérique Distribuée

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