Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Remove the stateful model-checking from the archive. It's not working anymore
[simgrid.git] / tools / cmake / Tests.cmake
index 047bfde..c5567a0 100644 (file)
@@ -1,15 +1,36 @@
-IF(enable_smpi AND NOT WIN32)
-  execute_process(COMMAND chmod a=rwx ${CMAKE_BINARY_DIR}/bin/smpicc)
-  execute_process(COMMAND chmod a=rwx ${CMAKE_BINARY_DIR}/bin/smpicxx)
-  execute_process(COMMAND chmod a=rwx ${CMAKE_BINARY_DIR}/bin/smpiff)
-  execute_process(COMMAND chmod a=rwx ${CMAKE_BINARY_DIR}/bin/smpif90)
-  execute_process(COMMAND chmod a=rwx ${CMAKE_BINARY_DIR}/bin/smpirun)
-ENDIF()
+SET(TESH_OPTION "--ignore-jenkins")
+SET(TESH_COMMAND "${PYTHON_EXECUTABLE}" ${CMAKE_BINARY_DIR}/bin/tesh)
+
+SET(TESH_LIBRARY_PATH "${CMAKE_BINARY_DIR}/lib")
+if(NOT $ENV{LD_LIBRARY_PATH} STREQUAL "")
+  SET(TESH_LIBRARY_PATH "${TESH_LIBRARY_PATH}:$ENV{LD_LIBRARY_PATH}")
+endif()
+
+IF(enable_memcheck)
+  INCLUDE(FindValgrind)
+
+  if (NOT VALGRIND_EXE MATCHES "NOTFOUND")
+    execute_process(COMMAND ${VALGRIND_EXE} --version  OUTPUT_VARIABLE "VALGRIND_VERSION")
+    message(STATUS "Valgrind version: ${VALGRIND_VERSION}")
+
+    set(VALGRIND_WRAPPER ${CMAKE_HOME_DIRECTORY}/tools/cmake/scripts/my_valgrind.pl)
+    set(VALGRIND_WRAPPER ${VALGRIND_WRAPPER}\ --trace-children=yes\ --trace-children-skip=/usr/bin/*,/bin/*\ --leak-check=full\ --show-reachable=yes\ --track-origins=no\ --read-var-info=no\ --num-callers=20\ --suppressions=${CMAKE_HOME_DIRECTORY}/tools/simgrid.supp\ )
+    if(enable_memcheck_xml)
+      SET(VALGRIND_WRAPPER ${VALGRIND_WRAPPER}\ --xml=yes\ --xml-file=memcheck_test_%p.memcheck\ --child-silent-after-fork=yes\ )
+    endif()
+    set(TESH_OPTION ${TESH_OPTION} --setenv VALGRIND_NO_LEAK_CHECK=--leak-check=no\ --show-leak-kinds=none)
+    set(TESH_OPTION ${TESH_OPTION} --setenv VALGRIND_NO_TRACE_CHILDREN=--trace-children=no)
 
-SET(TESH_COMMAND ${PERL_EXECUTABLE} ${CMAKE_BINARY_DIR}/bin/tesh)
-IF(CMAKE_HOST_WIN32)
-  SET(TESH_OPTION $TESH_OPTION --timeout 50)
+#    message(STATUS "tesh wrapper: ${VALGRIND_WRAPPER}")
+
+    mark_as_advanced(VALGRIND_WRAPPER)
+  else()
+    set(enable_memcheck false)
+    message(STATUS "Error: Command valgrind not found --> enable_memcheck autoset to false.")
+  endif()
 ENDIF()
+SET(VALGRIND_WRAPPER_UNBOXED "${VALGRIND_WRAPPER}")
+SEPARATE_ARGUMENTS(VALGRIND_WRAPPER_UNBOXED)
 
 #some tests may take forever on non futexes systems, using busy_wait with n cores < n workers
 # default to posix for these tests if futexes are not supported
@@ -20,10 +41,49 @@ ENDIF()
 MACRO(ADD_TESH NAME)
   SET(ARGT ${ARGV})
   LIST(REMOVE_AT ARGT 0)
-  IF(WIN32)
-    STRING(REPLACE "§" "\;" ARGT "${ARGT}")
-  ENDIF()
-  ADD_TEST(${NAME} ${TESH_COMMAND} ${TESH_OPTION} ${ARGT})
+  if(VALGRIND_WRAPPER)
+    ADD_TEST(${NAME} ${TESH_COMMAND} --wrapper "${VALGRIND_WRAPPER}" ${TESH_OPTION} ${ARGT})
+  else()
+    ADD_TEST(${NAME} ${TESH_COMMAND} ${TESH_OPTION} ${ARGT})
+  endif()
+ENDMACRO()
+
+# Build a list variable named FACTORIES_LIST with the given arguments, but:
+# - replace wildcard "*" with all known factories
+# - if the list begins with "^", take the complement
+# - finally remove unsupported factories
+#
+# Used by ADD_TESH_FACTORIES, and SET_TESH_PROPERTIES
+MACRO(SETUP_FACTORIES_LIST)
+  set(ALL_KNOWN_FACTORIES "thread;boost;raw;ucontext")
+
+  if("${ARGV}" STREQUAL "*")    # take all known factories
+    SET(FACTORIES_LIST ${ALL_KNOWN_FACTORIES})
+  elseif("${ARGV}" MATCHES "^\\^") # exclude given factories
+    SET(FACTORIES_LIST ${ALL_KNOWN_FACTORIES})
+    STRING(SUBSTRING "${ARGV}" 1 -1 EXCLUDED)
+    LIST(REMOVE_ITEM FACTORIES_LIST ${EXCLUDED})
+  else()                        # take given factories
+    SET(FACTORIES_LIST "${ARGV}")
+  endif()
+
+  # Exclude unsupported factories. Threads are always available, thanks to C++11 threads.
+  if(NOT HAVE_BOOST_CONTEXTS)
+    LIST(REMOVE_ITEM FACTORIES_LIST "boost")
+  endif()
+  if(NOT HAVE_RAW_CONTEXTS)
+    LIST(REMOVE_ITEM FACTORIES_LIST "raw")
+  endif()
+  if(NOT HAVE_UCONTEXT_CONTEXTS)
+    LIST(REMOVE_ITEM FACTORIES_LIST "ucontext")
+  endif()
+
+  # Check that there is no unknown factory
+  FOREACH(FACTORY ${FACTORIES_LIST})
+    if(NOT FACTORY IN_LIST ALL_KNOWN_FACTORIES)
+      message(FATAL_ERROR "Unknown factory: ${FACTORY}")
+    endif()
+  ENDFOREACH()
 ENDMACRO()
 
 MACRO(ADD_TESH_FACTORIES NAME FACTORIES)
@@ -32,120 +92,71 @@ MACRO(ADD_TESH_FACTORIES NAME FACTORIES)
   FOREACH(I ${FACTORIES}) # remove all factories
     LIST(REMOVE_AT ARGR 0)
   ENDFOREACH()
-  FOREACH(FACTORY ${FACTORIES})
-    if ((${FACTORY} STREQUAL "thread" AND HAVE_THREAD_CONTEXTS) OR
-        (${FACTORY} STREQUAL "boost" AND HAVE_BOOST_CONTEXTS) OR
-        (${FACTORY} STREQUAL "raw" AND HAVE_RAW_CONTEXTS) OR
-        (${FACTORY} STREQUAL "ucontext" AND HAVE_UCONTEXT_CONTEXTS))
-      ADD_TESH("${NAME}-${FACTORY}" "--cfg" "contexts/factory:${FACTORY}" ${ARGR})
-    ENDIF()
+  SETUP_FACTORIES_LIST(${FACTORIES})
+  FOREACH(FACTORY ${FACTORIES_LIST})
+    ADD_TESH("${NAME}-${FACTORY}" "--cfg" "contexts/factory:${FACTORY}" ${ARGR})
   ENDFOREACH()
 ENDMACRO()
 
-IF(NOT enable_memcheck)
-  ### GENERIC  ###
-  # BEGIN TESH TESTS
-  # test for code coverage
-    ADD_TEST(test-help            ${CMAKE_BINARY_DIR}/teshsuite/simdag/basic-parsing-test/basic-parsing-test --help)
-    ADD_TEST(test-help-models     ${CMAKE_BINARY_DIR}/teshsuite/simdag/basic-parsing-test/basic-parsing-test --help-models)
-    ADD_TEST(test-tracing-help    ${CMAKE_BINARY_DIR}/teshsuite/simdag/basic-parsing-test/basic-parsing-test --help-tracing)
-  # END TESH TESTS
-
-  ### MC ###
-  IF(HAVE_MC)
-    ADD_TESH_FACTORIES(mc-bugged1                "ucontext;raw" --setenv bindir=${CMAKE_BINARY_DIR}/examples/msg/mc --cd ${CMAKE_HOME_DIRECTORY}/examples/msg/mc bugged1.tesh)
-    ADD_TESH_FACTORIES(mc-bugged2                "ucontext;raw" --setenv bindir=${CMAKE_BINARY_DIR}/examples/msg/mc --cd ${CMAKE_HOME_DIRECTORY}/examples/msg/mc bugged2.tesh)
-    IF(HAVE_UCONTEXT_CONTEXTS AND PROCESSOR_x86_64) # liveness model-checking works only on 64bits (for now ...)
-      ADD_TESH(mc-bugged1-liveness-ucontext         --setenv bindir=${CMAKE_BINARY_DIR}/examples/msg/mc --cd ${CMAKE_HOME_DIRECTORY}/examples/msg/mc bugged1_liveness.tesh)
-      ADD_TESH(mc-bugged1-liveness-ucontext-sparse  --setenv bindir=${CMAKE_BINARY_DIR}/examples/msg/mc --cd ${CMAKE_HOME_DIRECTORY}/examples/msg/mc bugged1_liveness_sparse.tesh)
-      ADD_TESH(mc-bugged1-liveness-visited-ucontext --setenv bindir=${CMAKE_BINARY_DIR}/examples/msg/mc --cd ${CMAKE_HOME_DIRECTORY}/examples/msg/mc bugged1_liveness_visited.tesh)
-      ADD_TESH(mc-bugged1-liveness-visited-ucontext-sparse --setenv bindir=${CMAKE_BINARY_DIR}/examples/msg/mc --cd ${CMAKE_HOME_DIRECTORY}/examples/msg/mc bugged1_liveness_visited_sparse.tesh)
-    if(HAVE_C_STACK_CLEANER)
-      # This test checks if the stack cleaner is making a difference:
-      add_test(mc-bugged1-liveness-stack-cleaner ${CMAKE_HOME_DIRECTORY}/examples/msg/mc/bugged1_liveness_stack_cleaner ${CMAKE_HOME_DIRECTORY}/examples/msg/mc/ ${CMAKE_BINARY_DIR}/examples/msg/mc/)
-    endif()
-    ENDIF()
-  ENDIF()
-
-  ## INTERFACES ##
-  ### SIMDAG ###
-  # BEGIN TESH TESTS
-  # these tests need the assertion mechanism
-  # exclude them from memcheck, as they normally die, leaving lots of unfree'd objects
-  IF(enable_debug AND NOT enable_memcheck)
-    ADD_TESH(tesh-parser-bogus-symmetric         --setenv bindir=${CMAKE_BINARY_DIR}/teshsuite/simdag/flatifier --cd ${CMAKE_HOME_DIRECTORY}/teshsuite/simdag/platforms bogus_two_hosts_asymetric.tesh)
-    ADD_TESH(tesh-parser-bogus-missing-gw        --setenv bindir=${CMAKE_BINARY_DIR}/teshsuite/simdag/flatifier --cd ${CMAKE_HOME_DIRECTORY}/teshsuite/simdag/platforms bogus_missing_gateway.tesh)
-    ADD_TESH(tesh-parser-bogus-disk-attachment   --setenv bindir=${CMAKE_BINARY_DIR}/teshsuite/simdag/flatifier --cd ${CMAKE_HOME_DIRECTORY}/teshsuite/simdag/platforms bogus_disk_attachment.tesh)
-
-    #These tests fail on Windows as the signal returned is not the same as Unix would send.
-    IF(WIN32)
-      set_property(TEST tesh-parser-bogus-symmetric PROPERTY WILL_FAIL TRUE)
-      set_property(TEST tesh-parser-bogus-missing-gw PROPERTY WILL_FAIL TRUE)
-      set_property(TEST tesh-parser-bogus-disk-attachment PROPERTY WILL_FAIL TRUE)
-    ENDIF()
-  ENDIF()
-  # END TESH TESTS
-
-  ### SMPI ###
-  IF(enable_smpi_MPICH3_testsuite)
-    IF(HAVE_THREAD_CONTEXTS)
-      ADD_TEST(test-smpi-mpich3-coll-thread      ${CMAKE_COMMAND} -E chdir ${CMAKE_BINARY_DIR}/teshsuite/smpi/mpich3-test/coll ${PERL_EXECUTABLE} ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/runtests -mpiexec=${CMAKE_BINARY_DIR}/smpi_script/bin/smpirun -srcdir=${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/coll -tests=testlist -execarg=--cfg=contexts/factory:thread -execarg=--cfg=smpi/privatize_global_variables:${HAVE_PRIVATIZATION})
-      SET_TESTS_PROPERTIES(test-smpi-mpich3-coll-thread    PROPERTIES PASS_REGULAR_EXPRESSION "tests passed!")
-    ENDIF()
-    IF(HAVE_UCONTEXT_CONTEXTS)
-      ADD_TEST(test-smpi-mpich3-coll-ompi-ucontext ${CMAKE_COMMAND} -E chdir ${CMAKE_BINARY_DIR}/teshsuite/smpi/mpich3-test/coll ${PERL_EXECUTABLE} ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/runtests -mpiexec=${CMAKE_BINARY_DIR}/smpi_script/bin/smpirun -srcdir=${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/coll -tests=testlist -execarg=--cfg=contexts/factory:ucontext -execarg=--cfg=smpi/coll_selector:ompi -execarg=--cfg=smpi/privatize_global_variables:${HAVE_PRIVATIZATION} -execarg=--cfg=smpi/bcast:binomial_tree)
-      SET_TESTS_PROPERTIES(test-smpi-mpich3-coll-ompi-ucontext PROPERTIES PASS_REGULAR_EXPRESSION "tests passed!")
-    ENDIF()
-    IF(HAVE_RAW_CONTEXTS)
-      ADD_TEST(test-smpi-mpich3-coll-mpich-raw ${CMAKE_COMMAND} -E chdir ${CMAKE_BINARY_DIR}/teshsuite/smpi/mpich3-test/coll ${PERL_EXECUTABLE} ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/runtests -mpiexec=${CMAKE_BINARY_DIR}/smpi_script/bin/smpirun -srcdir=${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/coll -tests=testlist -execarg=--cfg=contexts/factory:raw -execarg=--cfg=smpi/coll_selector:mpich -execarg=--cfg=smpi/privatize_global_variables:${HAVE_PRIVATIZATION})
-      ADD_TEST(test-smpi-mpich3-coll-ompi-raw ${CMAKE_COMMAND} -E chdir ${CMAKE_BINARY_DIR}/teshsuite/smpi/mpich3-test/coll ${PERL_EXECUTABLE} ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/runtests -mpiexec=${CMAKE_BINARY_DIR}/smpi_script/bin/smpirun -srcdir=${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/coll -tests=testlist -execarg=--cfg=contexts/factory:raw -execarg=--cfg=smpi/coll_selector:ompi -execarg=--cfg=smpi/privatize_global_variables:${HAVE_PRIVATIZATION} -execarg=--cfg=smpi/bcast:binomial_tree)
-      ADD_TEST(test-smpi-mpich3-coll-mvapich2-raw ${CMAKE_COMMAND} -E chdir ${CMAKE_BINARY_DIR}/teshsuite/smpi/mpich3-test/coll ${PERL_EXECUTABLE} ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/runtests -mpiexec=${CMAKE_BINARY_DIR}/smpi_script/bin/smpirun -srcdir=${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/coll -tests=testlist -execarg=--cfg=contexts/factory:raw -execarg=--cfg=smpi/coll_selector:mvapich2 -execarg=--cfg=smpi/privatize_global_variables:${HAVE_PRIVATIZATION})
-      ADD_TEST(test-smpi-mpich3-coll-impi-raw ${CMAKE_COMMAND} -E chdir ${CMAKE_BINARY_DIR}/teshsuite/smpi/mpich3-test/coll ${PERL_EXECUTABLE} ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/runtests -mpiexec=${CMAKE_BINARY_DIR}/smpi_script/bin/smpirun -srcdir=${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/coll -tests=testlist -execarg=--cfg=contexts/factory:raw -execarg=--cfg=smpi/coll_selector:impi -execarg=--cfg=smpi/privatize_global_variables:${HAVE_PRIVATIZATION})
-      SET_TESTS_PROPERTIES(test-smpi-mpich3-coll-mpich-raw test-smpi-mpich3-coll-ompi-raw test-smpi-mpich3-coll-mpich-raw test-smpi-mpich3-coll-mvapich2-raw test-smpi-mpich3-coll-impi-raw  PROPERTIES PASS_REGULAR_EXPRESSION "tests passed!")
-      ADD_TEST(test-smpi-mpich3-attr-raw       ${CMAKE_COMMAND} -E chdir ${CMAKE_BINARY_DIR}/teshsuite/smpi/mpich3-test/attr ${PERL_EXECUTABLE} ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/runtests -mpiexec=${CMAKE_BINARY_DIR}/smpi_script/bin/smpirun -srcdir=${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/attr -tests=testlist -execarg=--cfg=contexts/factory:raw)
-      ADD_TEST(test-smpi-mpich3-comm-raw       ${CMAKE_COMMAND} -E chdir ${CMAKE_BINARY_DIR}/teshsuite/smpi/mpich3-test/comm ${PERL_EXECUTABLE} ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/runtests -mpiexec=${CMAKE_BINARY_DIR}/smpi_script/bin/smpirun -srcdir=${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/comm -tests=testlist -execarg=--cfg=contexts/factory:raw)
-      ADD_TEST(test-smpi-mpich3-init-raw       ${CMAKE_COMMAND} -E chdir ${CMAKE_BINARY_DIR}/teshsuite/smpi/mpich3-test/init ${PERL_EXECUTABLE} ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/runtests -mpiexec=${CMAKE_BINARY_DIR}/smpi_script/bin/smpirun -srcdir=${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/init -tests=testlist -execarg=--cfg=contexts/factory:raw)
-      ADD_TEST(test-smpi-mpich3-datatype-raw   ${CMAKE_COMMAND} -E chdir ${CMAKE_BINARY_DIR}/teshsuite/smpi/mpich3-test/datatype ${PERL_EXECUTABLE} ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/runtests -mpiexec=${CMAKE_BINARY_DIR}/smpi_script/bin/smpirun -srcdir=${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/datatype -tests=testlist -execarg=--cfg=contexts/factory:raw -execarg=--cfg=smpi/privatize_global_variables:${HAVE_PRIVATIZATION})
-      ADD_TEST(test-smpi-mpich3-group-raw      ${CMAKE_COMMAND} -E chdir ${CMAKE_BINARY_DIR}/teshsuite/smpi/mpich3-test/group ${PERL_EXECUTABLE} ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/runtests -mpiexec=${CMAKE_BINARY_DIR}/smpi_script/bin/smpirun -srcdir=${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/group -tests=testlist -execarg=--cfg=contexts/factory:raw)
-      ADD_TEST(test-smpi-mpich3-pt2pt-raw      ${CMAKE_COMMAND} -E chdir ${CMAKE_BINARY_DIR}/teshsuite/smpi/mpich3-test/pt2pt ${PERL_EXECUTABLE} ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/runtests -mpiexec=${CMAKE_BINARY_DIR}/smpi_script/bin/smpirun -srcdir=${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/pt2pt -tests=testlist -execarg=--cfg=contexts/factory:raw -execarg=--cfg=smpi/privatize_global_variables:${HAVE_PRIVATIZATION})
-      ADD_TEST(test-smpi-mpich3-topo-raw       ${CMAKE_COMMAND} -E chdir ${CMAKE_BINARY_DIR}/teshsuite/smpi/mpich3-test/topo ${PERL_EXECUTABLE} ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/runtests -mpiexec=${CMAKE_BINARY_DIR}/smpi_script/bin/smpirun -srcdir=${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/topo -tests=testlist -execarg=--cfg=contexts/factory:raw)
-      ADD_TEST(test-smpi-mpich3-rma-raw       ${CMAKE_COMMAND} -E chdir ${CMAKE_BINARY_DIR}/teshsuite/smpi/mpich3-test/rma ${PERL_EXECUTABLE} ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/runtests -mpiexec=${CMAKE_BINARY_DIR}/smpi_script/bin/smpirun -srcdir=${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/rma -tests=testlist -execarg=--cfg=contexts/factory:raw -execarg=--cfg=smpi/privatize_global_variables:${HAVE_PRIVATIZATION})
-      ADD_TEST(test-smpi-mpich3-info-raw       ${CMAKE_COMMAND} -E chdir ${CMAKE_BINARY_DIR}/teshsuite/smpi/mpich3-test/info ${PERL_EXECUTABLE} ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/runtests -mpiexec=${CMAKE_BINARY_DIR}/smpi_script/bin/smpirun -srcdir=${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/info -tests=testlist -execarg=--cfg=contexts/factory:raw -execarg=--cfg=smpi/privatize_global_variables:${HAVE_PRIVATIZATION})
-      ADD_TEST(test-smpi-mpich3-perf-raw       ${CMAKE_COMMAND} -E chdir ${CMAKE_BINARY_DIR}/teshsuite/smpi/mpich3-test/perf ${PERL_EXECUTABLE} ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/runtests -mpiexec=${CMAKE_BINARY_DIR}/smpi_script/bin/smpirun -srcdir=${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/perf -tests=testlist -execarg=--cfg=contexts/factory:raw -execarg=--cfg=smpi/running_power:-1)
-      SET_TESTS_PROPERTIES(test-smpi-mpich3-attr-raw test-smpi-mpich3-comm-raw test-smpi-mpich3-init-raw test-smpi-mpich3-datatype-raw test-smpi-mpich3-group-raw test-smpi-mpich3-pt2pt-raw test-smpi-mpich3-topo-raw test-smpi-mpich3-rma-raw test-smpi-mpich3-info-raw PROPERTIES PASS_REGULAR_EXPRESSION "tests passed!")
-    ENDIF()
-    IF(SMPI_FORTRAN AND HAVE_THREAD_CONTEXTS)
-      ADD_TEST(test-smpi-mpich3-thread-f77     ${CMAKE_COMMAND} -E chdir ${CMAKE_BINARY_DIR}/teshsuite/smpi/mpich3-test/f77/ ${PERL_EXECUTABLE} ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/runtests -mpiexec=${CMAKE_BINARY_DIR}/smpi_script/bin/smpirun -srcdir=${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/f77/ -tests=testlist -execarg=--cfg=contexts/stack_size:8000 -execarg=--cfg=smpi/privatize_global_variables:${HAVE_PRIVATIZATION})
-      SET_TESTS_PROPERTIES(test-smpi-mpich3-thread-f77 PROPERTIES PASS_REGULAR_EXPRESSION "tests passed!")
-      ADD_TEST(test-smpi-mpich3-thread-f90     ${CMAKE_COMMAND} -E chdir ${CMAKE_BINARY_DIR}/teshsuite/smpi/mpich3-test/f90/ ${PERL_EXECUTABLE} ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/runtests -mpiexec=${CMAKE_BINARY_DIR}/smpi_script/bin/smpirun -srcdir=${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/f90/ -tests=testlist -execarg=--cfg=smpi/privatize_global_variables:${HAVE_PRIVATIZATION})
-      SET_TESTS_PROPERTIES(test-smpi-mpich3-thread-f90 PROPERTIES PASS_REGULAR_EXPRESSION "tests passed!")
-    ENDIF()
-  ENDIF()
-
-  ## BINDINGS ##
-  ### LUA ###
-  IF(HAVE_LUA)
-    # Tests testing simulation from C but using lua for platform files. Executed like this
-    # ~$ ./masterslave platform.lua deploy.lua
-    ADD_TESH(lua-platform-masterslave                --setenv srcdir=${CMAKE_HOME_DIRECTORY}/teshsuite/lua --cd ${CMAKE_BINARY_DIR}/examples/lua ${CMAKE_HOME_DIRECTORY}/teshsuite/lua/lua_platforms.tesh)
-    SET_TESTS_PROPERTIES(lua-platform-masterslave    PROPERTIES ENVIRONMENT "LUA_CPATH=${CMAKE_BINARY_DIR}/examples/lua/?.so")
-  ENDIF()
-
-  ### JAVA ###
-  IF(enable_java)
-    IF(WIN32)
-      SET(TESH_CLASSPATH "${CMAKE_BINARY_DIR}/examples/java/\;${CMAKE_BINARY_DIR}/teshsuite/java/\;${SIMGRID_JAR}")
-      STRING(REPLACE "\;" "§" TESH_CLASSPATH "${TESH_CLASSPATH}")
-    ELSE()
-      SET(TESH_CLASSPATH "${CMAKE_BINARY_DIR}/examples/java/:${CMAKE_BINARY_DIR}/teshsuite/java/:${SIMGRID_JAR}")
-    ENDIF()
-  ENDIF()
-ENDIF()
+MACRO(SET_TESH_PROPERTIES NAME FACTORIES)
+  SET(ARGR ${ARGV})
+  LIST(REMOVE_AT ARGR 0) # remove name
+  FOREACH(I ${FACTORIES}) # remove all factories
+    LIST(REMOVE_AT ARGR 0)
+  ENDFOREACH()
+  SETUP_FACTORIES_LIST(${FACTORIES})
+  FOREACH(FACTORY ${FACTORIES_LIST})
+    set_tests_properties("${NAME}-${FACTORY}" PROPERTIES ${ARGR})
+  ENDFOREACH()
+ENDMACRO()
 
-  ## OTHER ##
-ADD_TEST(testall                                 ${CMAKE_BINARY_DIR}/testall)
+# New tests should use the Catch Framework
+set(UNIT_TESTS  src/xbt/unit-tests_main.cpp
+                src/kernel/resource/NetworkModelFactors_test.cpp
+                src/kernel/resource/SplitDuplexLinkImpl_test.cpp
+                src/kernel/resource/profile/Profile_test.cpp
+                src/kernel/routing/DijkstraZone_test.cpp
+                src/kernel/routing/DragonflyZone_test.cpp
+                src/kernel/routing/FatTreeZone_test.cpp
+                src/kernel/routing/FloydZone_test.cpp
+                src/kernel/routing/FullZone_test.cpp
+                src/kernel/routing/StarZone_test.cpp
+                src/kernel/routing/TorusZone_test.cpp
+                src/xbt/config_test.cpp
+                src/xbt/dict_test.cpp
+                src/xbt/dynar_test.cpp
+                src/xbt/random_test.cpp
+                src/xbt/xbt_str_test.cpp
+                src/xbt/utils/iter/subsets_tests.cpp
+                src/kernel/lmm/maxmin_test.cpp)
 
-IF(enable_memcheck)
-  INCLUDE(FindValgrind)
-  INCLUDE(${CMAKE_BINARY_DIR}/memcheck_tests.cmake)
-ENDIF()
+set(MC_UNIT_TESTS src/mc/explo/odpor/ClockVector_test.cpp
+                  src/mc/explo/odpor/Execution_test.cpp
+                  src/mc/explo/odpor/WakeupTree_test.cpp
+                  
+                  src/mc/explo/udpor/Unfolding_test.cpp
+                  src/mc/explo/udpor/UnfoldingEvent_test.cpp
+                  src/mc/explo/udpor/EventSet_test.cpp
+                  src/mc/explo/udpor/ExtensionSet_test.cpp
+                  src/mc/explo/udpor/History_test.cpp
+                  src/mc/explo/udpor/Configuration_test.cpp)
+if (SIMGRID_HAVE_MC)
+  set(UNIT_TESTS ${UNIT_TESTS} ${MC_UNIT_TESTS})
+else()
+  set(EXTRA_DIST ${EXTRA_DIST} ${MC_UNIT_TESTS})
+endif()
+if (SIMGRID_HAVE_EIGEN3)
+  set(UNIT_TESTS ${UNIT_TESTS} src/kernel/lmm/bmf_test.cpp)
+else()
+  set(EXTRA_DIST ${EXTRA_DIST} src/kernel/lmm/bmf_test.cpp)
+endif()
+set(EXTRA_DIST ${EXTRA_DIST} src/kernel/routing/NetZone_test.hpp)
+
+add_executable       (unit-tests EXCLUDE_FROM_ALL ${UNIT_TESTS})
+add_dependencies     (tests unit-tests)
+target_link_libraries(unit-tests simgrid)
+ADD_TEST(unit-tests ${VALGRIND_WRAPPER_UNBOXED} ${CMAKE_BINARY_DIR}/unit-tests)
+set_property(TARGET unit-tests APPEND PROPERTY INCLUDE_DIRECTORIES "${INTERNAL_INCLUDES}")
+set(EXTRA_DIST ${EXTRA_DIST} ${UNIT_TESTS})
+
+unset(UNIT_TESTS)