Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
fix Java and MC examples
[simgrid.git] / tools / cmake / Tests.cmake
index 0f2c6a0..530884a 100644 (file)
@@ -57,7 +57,7 @@ MACRO(ADD_TESH_FACTORIES NAME FACTORIES)
     LIST(REMOVE_AT ARGR 0)
   ENDFOREACH()
   FOREACH(FACTORY ${FACTORIES})
-    if ((${FACTORY} STREQUAL "thread" AND HAVE_THREAD_CONTEXTS) OR
+    if ((${FACTORY} STREQUAL "thread" ) OR # Always available, thanks to C++11 threads
         (${FACTORY} STREQUAL "boost" AND HAVE_BOOST_CONTEXTS) OR
         (${FACTORY} STREQUAL "raw" AND HAVE_RAW_CONTEXTS) OR
         (${FACTORY} STREQUAL "ucontext" AND HAVE_UCONTEXT_CONTEXTS))
@@ -66,31 +66,47 @@ MACRO(ADD_TESH_FACTORIES NAME FACTORIES)
   ENDFOREACH()
 ENDMACRO()
 
+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()
+  FOREACH(FACTORY ${FACTORIES})
+    if ((${FACTORY} STREQUAL "thread" ) OR # Always available, thanks to C++11 threads
+        (${FACTORY} STREQUAL "boost" AND HAVE_BOOST_CONTEXTS) OR
+        (${FACTORY} STREQUAL "raw" AND HAVE_RAW_CONTEXTS) OR
+        (${FACTORY} STREQUAL "ucontext" AND HAVE_UCONTEXT_CONTEXTS))
+      set_tests_properties("${NAME}-${FACTORY}" PROPERTIES ${ARGR})
+    endif()
+  ENDFOREACH()
+ENDMACRO()      
+
 IF(enable_java)
   IF(WIN32)
-    SET(TESH_CLASSPATH "${CMAKE_BINARY_DIR}/examples/java/\;${CMAKE_BINARY_DIR}/teshsuite/java/\;${SIMGRID_JAR}")
+    SET(TESH_CLASSPATH "${CMAKE_BINARY_DIR}/examples/deprecated/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}")
+    SET(TESH_CLASSPATH "${CMAKE_BINARY_DIR}/examples/deprecated/java/:${CMAKE_BINARY_DIR}/teshsuite/java/:${SIMGRID_JAR}")
   ENDIF()
 ENDIF()
 
 IF(SIMGRID_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)
+  ADD_TESH_FACTORIES(mc-bugged1                "ucontext;raw" --setenv bindir=${CMAKE_BINARY_DIR}/examples/deprecated/msg/mc --cd ${CMAKE_HOME_DIRECTORY}/examples/deprecated/msg/mc bugged1.tesh)
+  ADD_TESH_FACTORIES(mc-bugged2                "ucontext;raw" --setenv bindir=${CMAKE_BINARY_DIR}/examples/deprecated/msg/mc --cd ${CMAKE_HOME_DIRECTORY}/examples/deprecated/msg/mc bugged2.tesh)
   IF(HAVE_UCONTEXT_CONTEXTS AND SIMGRID_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)
+    ADD_TESH(mc-bugged1-liveness-ucontext         --setenv bindir=${CMAKE_BINARY_DIR}/examples/deprecated/msg/mc --cd ${CMAKE_HOME_DIRECTORY}/examples/deprecated/msg/mc bugged1_liveness.tesh)
+    ADD_TESH(mc-bugged1-liveness-ucontext-sparse  --setenv bindir=${CMAKE_BINARY_DIR}/examples/deprecated/msg/mc --cd ${CMAKE_HOME_DIRECTORY}/examples/deprecated/msg/mc bugged1_liveness_sparse.tesh)
+    ADD_TESH(mc-bugged1-liveness-visited-ucontext --setenv bindir=${CMAKE_BINARY_DIR}/examples/deprecated/msg/mc --cd ${CMAKE_HOME_DIRECTORY}/examples/deprecated/msg/mc bugged1_liveness_visited.tesh)
+    ADD_TESH(mc-bugged1-liveness-visited-ucontext-sparse --setenv bindir=${CMAKE_BINARY_DIR}/examples/deprecated/msg/mc --cd ${CMAKE_HOME_DIRECTORY}/examples/deprecated/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/)
+      ADD_TEST(mc-bugged1-liveness-stack-cleaner ${CMAKE_HOME_DIRECTORY}/examples/deprecated/msg/mc/bugged1_liveness_stack_cleaner ${CMAKE_HOME_DIRECTORY}/examples/deprecated/msg/mc/ ${CMAKE_BINARY_DIR}/examples/deprecated/msg/mc/)
     ENDIF()
   ENDIF()
 ENDIF()
 
-IF(enable_smpi_MPICH3_testsuite AND SMPI_FORTRAN AND HAVE_THREAD_CONTEXTS)
+IF(enable_smpi_MPICH3_testsuite AND SMPI_FORTRAN)
   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 "-wrapper=${TESH_WRAPPER}" -mpiexec=${CMAKE_BINARY_DIR}/smpi_script/bin/smpirun -srcdir=${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/f77/ -tests=testlist -privatization=${HAVE_PRIVATIZATION} -execarg=--cfg=contexts/stack-size:8000 -execarg=--cfg=contexts/factory:thread -execarg=--cfg=smpi/privatization:${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 "-wrapper=${TESH_WRAPPER}" -mpiexec=${CMAKE_BINARY_DIR}/smpi_script/bin/smpirun -srcdir=${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/f90/ -tests=testlist -privatization=${HAVE_PRIVATIZATION} -execarg=--cfg=smpi/privatization:${HAVE_PRIVATIZATION} -execarg=--cfg=contexts/factory:thread)
@@ -114,30 +130,21 @@ if(Boost_UNIT_TEST_FRAMEWORK_FOUND)
   add_executable       (unit-tmgr src/surf/trace_mgr_test.cpp)
   target_link_libraries(unit-tmgr simgrid boost_unit_test_framework)
   ADD_TEST(unit-tmgr ${CMAKE_BINARY_DIR}/unit-tmgr --build_info=yes)
-  set_property(
-    TARGET unit-tmgr
-    APPEND PROPERTY
-           INCLUDE_DIRECTORIES "${INTERNAL_INCLUDES}"
-          )
+  set_property(TARGET unit-tmgr APPEND PROPERTY INCLUDE_DIRECTORIES "${INTERNAL_INCLUDES}")
+  add_dependencies(tests unit-tmgr)
   if (SIMGRID_HAVE_MC)
     # snapshot
     add_executable       (unit-mc-snapshot src/mc/sosp/mc_snapshot_test.cpp)
     target_link_libraries(unit-mc-snapshot simgrid boost_unit_test_framework)
     ADD_TEST(unit-mc-snapshot ${CMAKE_BINARY_DIR}/unit-mc-snapshot --build_info=yes)
-    set_property(
-      TARGET unit-mc-snapshot
-      APPEND PROPERTY
-             INCLUDE_DIRECTORIES "${INTERNAL_INCLUDES}"
-            )
+    set_property(TARGET unit-mc-snapshot APPEND PROPERTY INCLUDE_DIRECTORIES "${INTERNAL_INCLUDES}")
+    add_dependencies(tests unit-mc-snapshot)
     # pagestore
     add_executable       (unit-mc-pagestore src/mc/sosp/PageStore_test.cpp)
     target_link_libraries(unit-mc-pagestore simgrid boost_unit_test_framework)
     ADD_TEST(unit-mc-pagestore ${CMAKE_BINARY_DIR}/unit-mc-pagestore --build_info=yes)
-    set_property(
-      TARGET unit-mc-pagestore
-      APPEND PROPERTY
-             INCLUDE_DIRECTORIES "${INTERNAL_INCLUDES}"
-            )
+    set_property(TARGET unit-mc-pagestore APPEND PROPERTY INCLUDE_DIRECTORIES "${INTERNAL_INCLUDES}")
+    add_dependencies(tests unit-mc-pagestore)
   endif()
 
 else()