Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
adding a JBOD concept
[simgrid.git] / examples / cpp / CMakeLists.txt
index 82fcc27..c05ec92 100644 (file)
@@ -16,19 +16,26 @@ set(_actor-stacksize_factories "^thread") # Threads ignore modifications of the
 # The maestro-set example only works for threads
 set(_maestro-set_factories "thread")
 
-# These tests timeout with threads, not sure why
-foreach(example mc-bugged1 mc-bugged2 mc-failing-assert mc-electric-fence)
-   set(_${example}_factories "^thread") # Timeout
-   add_dependencies(tests-mc s4u-${example})
-endforeach()
+if(SIMGRID_HAVE_MC)
+  # These tests timeout with threads, not sure why
+  foreach(example mc-bugged1 mc-bugged2 mc-failing-assert mc-electric-fence)
+    set(_${example}_factories "^thread") # Timeout
+    add_dependencies(tests-mc s4u-${example})
+  endforeach()
 
-if(enable_coverage)
-  foreach (example mc-bugged1 mc-bugged2 mc-electric-fence mc-failing-assert)
-    ADD_TEST(cover-${example} ${CMAKE_CURRENT_BINARY_DIR}/${example}/s4u-${example} ${CMAKE_HOME_DIRECTORY}/examples/platforms/model_checker_platform.xml)
+  if(enable_coverage)
+    foreach (example mc-bugged1 mc-bugged2 mc-electric-fence mc-failing-assert)
+      ADD_TEST(cover-${example} ${CMAKE_CURRENT_BINARY_DIR}/${example}/s4u-${example} ${CMAKE_HOME_DIRECTORY}/examples/platforms/model_checker_platform.xml)
+    endforeach()
+  endif()
+else()
+  foreach (example mc-bugged1 mc-bugged2  mc-centralized-mutex mc-failing-assert mc-electric-fence)
+    set(_${example}_disable 1)
   endforeach()
 endif()
 
-if(SIMGRID_HAVE_MC)
+set(tesh_files ${tesh_files} ${CMAKE_CURRENT_SOURCE_DIR}/synchro-mutex/s4u-mc-synchro-mutex-stateful.tesh)
+if(SIMGRID_HAVE_STATEFUL_MC)
   if(HAVE_C_STACK_CLEANER)
     add_executable       (s4u-mc-bugged1-liveness-cleaner-on  EXCLUDE_FROM_ALL s4u-mc-bugged1-liveness/s4u-mc-bugged1-liveness.cpp)
     target_link_libraries(s4u-mc-bugged1-liveness-cleaner-on  simgrid)
@@ -41,6 +48,14 @@ if(SIMGRID_HAVE_MC)
     add_dependencies(tests-mc s4u-mc-bugged1-liveness-cleaner-off)
   endif()
 
+  ADD_TESH(s4u-mc-synchro-mutex-stateful
+     --setenv bindir=${CMAKE_CURRENT_BINARY_DIR}/synchro-mutex
+     --setenv libdir=${CMAKE_BINARY_DIR}/lib
+     --setenv platfdir=${CMAKE_HOME_DIRECTORY}/examples/platforms
+     --setenv srcdir=${CMAKE_CURRENT_SOURCE_DIR}/synchro-mutex
+     --cd ${CMAKE_CURRENT_SOURCE_DIR}/synchro-mutex
+      ${CMAKE_HOME_DIRECTORY}/examples/cpp/synchro-mutex/s4u-mc-synchro-mutex-stateful.tesh)
+
   # Model-checking liveness
   if(HAVE_UCONTEXT_CONTEXTS AND SIMGRID_PROCESSOR_x86_64)
     # liveness model-checking works only on 64bits (for now ...)
@@ -51,10 +66,13 @@ if(SIMGRID_HAVE_MC)
     # This example never ends, disable it for now
     set(_mc-bugged2-liveness_disable 1)
 
-    ADD_TESH(s4u-mc-bugged1-liveness-visited-ucontext --setenv bindir=${CMAKE_CURRENT_BINARY_DIR}/mc-bugged1-liveness
-                                                      --setenv platfdir=${CMAKE_HOME_DIRECTORY}/examples/platforms
-                                                      --cd ${CMAKE_CURRENT_SOURCE_DIR}/mc-bugged1-liveness
-                                                       ${CMAKE_HOME_DIRECTORY}/examples/cpp/mc-bugged1-liveness/s4u-mc-bugged1-liveness-visited.tesh)
+    if ("${CMAKE_SYSTEM}" MATCHES "Linux")
+      # timeout under FreeBSD (test never stops)
+      ADD_TESH(s4u-mc-bugged1-liveness-visited-ucontext --setenv bindir=${CMAKE_CURRENT_BINARY_DIR}/mc-bugged1-liveness
+                                                        --setenv platfdir=${CMAKE_HOME_DIRECTORY}/examples/platforms
+                                                        --cd ${CMAKE_CURRENT_SOURCE_DIR}/mc-bugged1-liveness
+                                                        ${CMAKE_HOME_DIRECTORY}/examples/cpp/mc-bugged1-liveness/s4u-mc-bugged1-liveness-visited.tesh)
+    endif()
     IF(HAVE_C_STACK_CLEANER)
       add_dependencies(tests-mc s4u-mc-bugged1-liveness-stack-cleaner)
       # This test checks if the stack cleaner is making a difference:
@@ -81,21 +99,25 @@ endif()
 foreach (example synchro-barrier synchro-mutex synchro-semaphore)
   set(tesh_files ${tesh_files} ${CMAKE_CURRENT_SOURCE_DIR}/${example}/s4u-mc-${example}.tesh)
 
-  ADD_TESH(s4u-mc-${example}
-            --setenv bindir=${CMAKE_CURRENT_BINARY_DIR}/${example}
-            --setenv libdir=${CMAKE_BINARY_DIR}/lib
-            --setenv platfdir=${CMAKE_HOME_DIRECTORY}/examples/platforms
-            --setenv srcdir=${CMAKE_CURRENT_SOURCE_DIR}/${example}
-            --cd ${CMAKE_CURRENT_SOURCE_DIR}/${example}
-            ${CMAKE_HOME_DIRECTORY}/examples/cpp/${example}/s4u-mc-${example}.tesh)
+  if (SIMGRID_HAVE_MC)
+    ADD_TESH(s4u-mc-${example}
+              --setenv bindir=${CMAKE_CURRENT_BINARY_DIR}/${example}
+              --setenv libdir=${CMAKE_BINARY_DIR}/lib
+              --setenv platfdir=${CMAKE_HOME_DIRECTORY}/examples/platforms
+              --setenv srcdir=${CMAKE_CURRENT_SOURCE_DIR}/${example}
+              --cd ${CMAKE_CURRENT_SOURCE_DIR}/${example}
+              ${CMAKE_HOME_DIRECTORY}/examples/cpp/${example}/s4u-mc-${example}.tesh)
 
-  add_dependencies(tests-mc s4u-${example})
+    add_dependencies(tests-mc s4u-${example})
+  endif()
 endforeach()
 
-# Dependency on the regular tests
-foreach(example mc-centralized-mutex)
-  add_dependencies(tests-mc s4u-${example})
-endforeach()
+if (SIMGRID_HAVE_MC)
+  # Dependency on the regular tests
+  foreach(example mc-centralized-mutex)
+    add_dependencies(tests-mc s4u-${example})
+  endforeach()
+endif()
 
 if(NOT HAVE_GRAPHVIZ)
   set(_dag-from-dot_disable 1)
@@ -106,7 +128,24 @@ if (NOT SIMGRID_HAVE_JSON)
   set(_dag-from-json-simple_disable 1)
 endif()
 
-if(NOT SIMGRID_HAVE_NS3)
+if(SIMGRID_HAVE_NS3)
+  if(NS3_VERSION VERSION_GREATER_EQUAL 3.37)
+    set(_network-ns3_teshfile         ${CMAKE_HOME_DIRECTORY}/examples/cpp/network-ns3/s4u-network-ns3-timed.tesh)
+    set(tesh_files    ${tesh_files}   ${CMAKE_HOME_DIRECTORY}/examples/cpp/network-ns3/s4u-network-ns3-notime.tesh)
+  else()
+    set(_network-ns3_teshfile         ${CMAKE_HOME_DIRECTORY}/examples/cpp/network-ns3/s4u-network-ns3-notime.tesh)
+    set(tesh_files    ${tesh_files}   ${CMAKE_HOME_DIRECTORY}/examples/cpp/network-ns3/s4u-network-ns3-timed.tesh)
+  endif()
+
+foreach (example network-ns3 network-ns3-wifi)
+  add_dependencies(tests-ns3 s4u-${example})
+endforeach()
+
+else()
+  # Even if ns3 is not found, we need to override the teshfile name and make sure that everything gets included in the archive
+  set(_network-ns3_teshfile         ${CMAKE_HOME_DIRECTORY}/examples/cpp/network-ns3/s4u-network-ns3-notime.tesh)
+  set(tesh_files    ${tesh_files}   ${CMAKE_HOME_DIRECTORY}/examples/cpp/network-ns3/s4u-network-ns3-timed.tesh)
+
   foreach (example network-ns3 network-ns3-wifi)
     set(_${example}_disable 1)
   endforeach()
@@ -131,7 +170,9 @@ foreach (example activity-testany activity-waitany
                  maestro-set
                  mc-bugged1 mc-bugged1-liveness mc-bugged2 mc-bugged2-liveness mc-centralized-mutex mc-electric-fence mc-failing-assert
                  network-ns3 network-ns3-wifi network-wifi
-                 io-async io-priority io-degradation io-file-system io-file-remote io-disk-raw io-dependent
+                 io-async io-priority io-degradation io-file-system io-file-remote io-disk-raw io-jbod-raw io-dependent
+                 task-io task-simple task-variable-load task-storm task-switch-host
+                 photovoltaic-simple
                  platform-comm-serialize platform-failures platform-profile platform-properties
                  plugin-host-load plugin-link-load plugin-prodcons
                  replay-comm replay-io
@@ -144,6 +185,11 @@ foreach (example activity-testany activity-waitany
     set(_${example}_sources ${example}/s4u-${example}.cpp)
   endif()
 
+  # Use default tesh file unless specified otherwise
+  if(NOT DEFINED _${example}_teshfile)
+    set(_${example}_teshfile ${CMAKE_HOME_DIRECTORY}/examples/cpp/${example}/s4u-${example}.tesh)
+  endif()
+
   if(NOT DEFINED _${example}_disable)
     add_executable       (s4u-${example} EXCLUDE_FROM_ALL ${_${example}_sources})
     add_dependencies     (tests s4u-${example})
@@ -163,19 +209,20 @@ foreach (example activity-testany activity-waitany
                                       --setenv platfdir=${CMAKE_HOME_DIRECTORY}/examples/platforms
                                       --setenv srcdir=${CMAKE_CURRENT_SOURCE_DIR}/${example}
                                       --cd ${CMAKE_CURRENT_SOURCE_DIR}/${example}
-                                      ${CMAKE_HOME_DIRECTORY}/examples/cpp/${example}/s4u-${example}.tesh)
+                                      ${_${example}_teshfile})
   else()
     message(STATUS "Example ${example} disabled, thus not compiled.")
     unset(_${example}_disable)
   endif()
 
-  set(tesh_files    ${tesh_files}    ${CMAKE_CURRENT_SOURCE_DIR}/${example}/s4u-${example}.tesh)
+  set(tesh_files    ${tesh_files}    ${_${example}_teshfile})
   foreach(file ${_${example}_sources})
     set(examples_src  ${examples_src} ${CMAKE_CURRENT_SOURCE_DIR}/${file})
   endforeach()
 
   unset(_${example}_factories)
   unset(_${example}_sources)
+  unset(_${example}_teshfile)
 endforeach()
 
 
@@ -219,7 +266,7 @@ foreach(example mc-failing-assert)
 # We should first optimize mmalloc_heap_differ() which takes ~4sec for each pair to compare (maybe {175 x 174/ 2} pairs here)
 # See the comment on mmalloc_heap_differ() in compare.cpp for more info on why it's hard to optimize.
 #
-#  if(SIMGRID_HAVE_MC)
+#  if(SIMGRID_HAVE_STATEFUL_MC)
 #    ADD_TESH(s4u-${example}-statequality  --setenv bindir=${CMAKE_CURRENT_BINARY_DIR}/${example}
 #                                      --setenv libdir=${CMAKE_BINARY_DIR}/lib
 #                                      --setenv platfdir=${CMAKE_HOME_DIRECTORY}/examples/platforms
@@ -228,12 +275,14 @@ foreach(example mc-failing-assert)
 #                                      ${CMAKE_HOME_DIRECTORY}/examples/cpp/${example}/s4u-${example}-statequality.tesh)
 #  endif()
 
-  ADD_TESH(s4u-${example}-nodpor    --setenv bindir=${CMAKE_CURRENT_BINARY_DIR}/${example}
-                                    --setenv libdir=${CMAKE_BINARY_DIR}/lib
-                                    --setenv platfdir=${CMAKE_HOME_DIRECTORY}/examples/platforms
-                                    --setenv srcdir=${CMAKE_CURRENT_SOURCE_DIR}/${example}
-                                    --cd ${CMAKE_CURRENT_SOURCE_DIR}/${example}
-                                    ${CMAKE_HOME_DIRECTORY}/examples/cpp/${example}/s4u-${example}-nodpor.tesh)
+  if(SIMGRID_HAVE_MC)
+    ADD_TESH(s4u-${example}-nodpor    --setenv bindir=${CMAKE_CURRENT_BINARY_DIR}/${example}
+                                      --setenv libdir=${CMAKE_BINARY_DIR}/lib
+                                      --setenv platfdir=${CMAKE_HOME_DIRECTORY}/examples/platforms
+                                      --setenv srcdir=${CMAKE_CURRENT_SOURCE_DIR}/${example}
+                                      --cd ${CMAKE_CURRENT_SOURCE_DIR}/${example}
+                                      ${CMAKE_HOME_DIRECTORY}/examples/cpp/${example}/s4u-${example}-nodpor.tesh)
+  endif()
   set(tesh_files    ${tesh_files}   ${CMAKE_HOME_DIRECTORY}/examples/cpp/${example}/s4u-${example}-statequality.tesh)
   set(tesh_files    ${tesh_files}   ${CMAKE_HOME_DIRECTORY}/examples/cpp/${example}/s4u-${example}-nodpor.tesh)
 endforeach()