Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Rename model methods action_use/free to action_ref/unref
[simgrid.git] / testsuite / run_tests.in
index 6859868..6243320 100755 (executable)
@@ -1,4 +1,8 @@
 #! @BASH@
+
+##
+## Cleanups of previous executions
+##
 failed_nb=0
 success_nb=0
 ignored_nb=0
@@ -6,51 +10,127 @@ tests_nb=0
 
 rm -f test.failed test.success test.ignored
 
+# Work around a libtool issue on solaris, making sure that it works even on sh older than tcsh
+LD_LIBRARY_PATH=@top_srcdir@/src/.libs
+if export LD_LIBRARY_PATH ; then 
+  :
+else
+  setenv LD_LIBRARY_PATH @top_srcdir@/src/.libs
+fi
+
+##
+## Args parsing (simplistic for now)
+##
 if [ xvalgrind = "x$1" ] ; then
-  valgrind=valgrind
+  exenv="libtool --mode=execute valgrind --show-reachable=yes"
 else
-  valgrind=
+  exenv=
 fi
-#          config_usage                        \
-for test in log_usage                           \
-            dynar_int dynar_double dynar_string \
-           dict_usage dict_crash               \
-           \
-           datadesc_usage                       
-#          "datadesc_usage --read @srcdir@/datadesc.little32" \
-#          "datadesc_usage --read @srcdir@/datadesc.big32" \
-#          "datadesc_usage --read @srcdir@/datadesc.big64" 
 
-#          "datadesc_usage --read @srcdir@/datadesc.little64" \
-do                 
-  tests_nb=`expr $tests_nb + 1`
-  echo "#### Test $test"
-  if [ "x$test" = "xdict_crash" ] ; then
-    ./$test --gras-log="root.thres=info" 2>&1
-  else 
-    $valgrind ./$test --gras-log="root.thres=info" 2>&1
-  fi
-  retval=$?
-  if [ $retval != 0 ] ; then if [ $retval != 77 ]; then
-    echo "## failed. Rerun $test with full details."
-    if [ "x$test" = "xdict_crash" ] ; then
-      ./$test --gras-log="root.thres=debug" 2>&1
-    else 
-      $valgrind ./$test --gras-log="root.thres=debug" 2>&1
+##
+## Tests defintions
+##
+xbt_TESTS=" \
+            xbt/log_usage@EXEEXT@;        \
+            xbt/context_usage@EXEEXT@;    \
+            xbt/graphxml_usage@EXEEXT@ @srcdir@/xbt/graph.xml;    \
+            xbt/heap_bench@EXEEXT@;"
+
+surf_TESTS="surf/lmm_usage@EXEEXT@;                                        \
+            surf/maxmin_bench@EXEEXT@;                                        \
+           surf/trace_usage@EXEEXT@ --cfg=path:@srcdir@/surf/;              \
+           surf/surf_usage@EXEEXT@  --cfg=path:@srcdir@/surf/ platform.xml; \
+           surf/surf_usage2@EXEEXT@ --cfg=path:@srcdir@/surf/ platform.xml;"
+
+simdag_TESTS="simdag/sd_test --cfg=path:@srcdir@/simdag @srcdir@/simdag/small_platform_variable.xml; \
+              simdag/sd_test @top_srcdir@/examples/msg/small_platform.xml; \
+              simdag/sd_test @top_srcdir@/examples/msg/msg_platform.xml; "
+
+
+##
+## Loop on all tests to run them
+##
+
+# we split tests on ';' so that they can contain spaces (test=accumulator)
+test=""
+
+for testpart in $xbt_TESTS $surf_TESTS $simdag_TESTS
+do
+  test="$test $testpart"
+  if echo $test | grep  ';' >/dev/null ; then
+    # end of test declaration found.
+  
+    # we must have a space after the ;
+    if echo $test | egrep ';[^ ]' ; then
+      echo "$0.in broken: you should add a space after each ';'"
+      exit 1
     fi
-    failed_nb=`expr $failed_nb + 1`
-    echo "  $test (returned $retval)" >> test.failed
-  else # retval == 77
-    echo "## Ignored since it returned 77"
-    ignored_nb=`expr $ignored_nb + 1`
-    echo "  $test" >> test.ignored
-  fi else
-    echo "## Success"
-    success_nb=`expr $success_nb + 1`
-    echo "  $test" >> test.success
-  fi
+    
+    # Cleanup test declaration, run it.
+    test=`echo $test | sed 's/;//'`
+    
+    if [ ".$1" = .windump ] ; then
+      test=`echo $test | sed 's|/home.*testsuite/|//10.0.2.4/qemu/testsuite/|'`
+      test=`echo $test | sed 's|/|\\\\|g'`
+      echo "\\\\10.0.2.4\\qemu\\testsuite\\$test"
+      echo "@if errorlevel 1 echo ERRORERRORERRORERRORERRORERRORERRORERRORERRORERRORERRORERROR"
+      test=""
+    else
+      tests_nb=`expr $tests_nb + 1`
+      echo "#### Test $test"
+      if [ x@EXEEXT@ = x ] ; then
+        :
+      else
+        # overwrites "valgrind" as a value, but should be exclusive.
+        exenv=wine  
+      fi
+      exenvsave=$exenv 
+      if [ "x$test" = "xxbt/dict_crash@EXEEXT@" ] ; then 
+        if echo $exenv | grep valgrind >/dev/null ; then
+         exenv=
+        fi
+        $exenv ./$test --log="root.thres=info" 2>&1
+        retval=$?
+      else 
+        if [ x@EXEEXT@ != x ] && [ x$exenv = xwine ] ; then 
+          if echo ${test} | grep @EXEEXT@ >/dev/null ; then : ; else
+            exenv=""
+          fi
+        fi
+        $exenv ./$test --log="root.thres=info" 2>&1
+        retval=$?
+      fi
+      exenv=$exenvsave
+      if [ $retval != 0 ] ; then if [ $retval != 77 ]; then
+        echo "## failed" # . Rerun $test with full details."
+#      if [ "x$test" = "xdict_crash" ] ; then
+#      $exenv ./$test --log="root.thres=debug" 2>&1
+#    else 
+#      $exenv ./$test --log="root.thres=debug" 2>&1
+#    fi
+        failed_nb=`expr $failed_nb + 1`
+        echo "  $test (returned $retval)" >> test.failed
+      else # retval == 77
+        echo "## Ignored since it returned 77"
+        ignored_nb=`expr $ignored_nb + 1`
+        echo "  $test" >> test.ignored
+      fi else
+        echo "## Success"
+        success_nb=`expr $success_nb + 1`
+        echo "  $test" >> test.success
+      fi
+      test=""
+    fi # end of ';' found in test declaration => run it
+  fi # end of run it only if not in windump mode
 done
 
+###
+### Display summary
+###
+if [ ".$1" = .windump ] ; then
+  echo pause
+  exit 0
+fi
 
 echo
 echo "#### Summary"
@@ -65,9 +145,9 @@ fi
 if [ $failed_nb != 0 ] ; then
   echo "$failed_nb tests of $tests_nb failed: "
   cat test.failed
-  echo "Rerun the tests using the following command: script -c 'make test' gras.tests.log"
-  echo " and send the following informations to martin.quinson@ens-lyon.fr:"
-  echo "   - the file gras.tests.log produced by this command."
+  echo "Rerun the tests using the following command: script -c 'make check' simgrid.tests.log"
+  echo " and send the following informations to simgrid-devel@lists.gforge.inria.fr:"
+  echo "   - the file simgrid.tests.log produced by this command."
   echo "   - a short description of the target platform (arch, OS, distrib, compiler)."
   echo "   - the config.log produced by the compilation."
 fi