1 # Regular examples: with only one source and tested with all factories by default
2 #################################################################################
3 ### Define the examples' specificities
5 set(_app-bittorrent_sources app-bittorrent/s4u-bittorrent.cpp app-bittorrent/s4u-bittorrent.hpp
6 app-bittorrent/s4u-peer.cpp app-bittorrent/s4u-peer.hpp
7 app-bittorrent/s4u-tracker.cpp app-bittorrent/s4u-tracker.hpp)
8 set(_dht-chord_sources dht-chord/s4u-dht-chord.cpp dht-chord/s4u-dht-chord.hpp dht-chord/s4u-dht-chord-node.cpp)
9 set(_dht-kademlia_sources dht-kademlia/s4u-dht-kademlia.cpp dht-kademlia/s4u-dht-kademlia.hpp
10 dht-kademlia/node.cpp dht-kademlia/node.hpp
11 dht-kademlia/routing_table.cpp dht-kademlia/routing_table.hpp
12 dht-kademlia/answer.cpp dht-kademlia/answer.hpp dht-kademlia/message.hpp)
14 set(_actor-stacksize_factories "^thread") # Threads ignore modifications of the stack size
16 # The maestro-set example only works for threads and when not using windows.
17 set(_maestro-set_factories "thread")
19 set(_maestro-set_disable 1)
23 # These tests timeout with threads, maybe because of dwarf parsing? not sure
24 foreach(example mc-bugged1 mc-bugged2 mc-failing-assert mc-electric-fence)
25 set(_${example}_factories "^thread") # Timeout
26 add_dependencies(tests-mc s4u-${example})
29 if(HAVE_C_STACK_CLEANER)
30 add_executable (s4u-mc-bugged1-liveness-cleaner-on EXCLUDE_FROM_ALL s4u-mc-bugged1-liveness/s4u-mc-bugged1-liveness.cpp)
31 target_link_libraries(s4u-mc-bugged1-liveness-cleaner-on simgrid)
32 set_target_properties(s4u-mc-bugged1-liveness-cleaner-on PROPERTIES COMPILE_FLAGS "-DGARBAGE_STACK -fstack-cleaner")
33 add_dependencies(tests-mc s4u-mc-bugged1-liveness-cleaner-on)
35 add_executable (s4u-mc-bugged1-liveness-cleaner-off EXCLUDE_FROM_ALL s4u-mc-bugged1-liveness/s4u-mc-bugged1-liveness.cpp)
36 target_link_libraries(s4u-mc-bugged1-liveness-cleaner-off simgrid)
37 set_target_properties(s4u-mc-bugged1-liveness-cleaner-off PROPERTIES COMPILE_FLAGS "-DGARBAGE_STACK -fno-stack-cleaner")
38 add_dependencies(tests-mc s4u-mc-bugged1-liveness-cleaner-off)
41 # Model-checking liveness
42 if(HAVE_UCONTEXT_CONTEXTS AND SIMGRID_PROCESSOR_x86_64)
43 # liveness model-checking works only on 64bits (for now ...)
44 set(_mc-bugged1-liveness_factories "ucontext")
45 add_dependencies(tests-mc s4u-mc-bugged1-liveness)
46 set(_mc-bugged2-liveness_factories "ucontext")
48 # This example never ends, disable it for now
49 set(_mc-bugged2-liveness_disable 1)
51 ADD_TESH(s4u-mc-bugged1-liveness-visited-ucontext --setenv bindir=${CMAKE_CURRENT_BINARY_DIR}/mc-bugged1-liveness
52 --setenv platfdir=${CMAKE_HOME_DIRECTORY}/examples/platforms
53 --cd ${CMAKE_CURRENT_SOURCE_DIR}/mc-bugged1-liveness
54 ${CMAKE_HOME_DIRECTORY}/examples/cpp/mc-bugged1-liveness/s4u-mc-bugged1-liveness-visited.tesh)
55 IF(HAVE_C_STACK_CLEANER)
56 add_dependencies(tests-mc s4u-mc-bugged1-liveness-stack-cleaner)
57 # This test checks if the stack cleaner is making a difference:
58 ADD_TEST(s4u-mc-bugged1-liveness-stack-cleaner ${CMAKE_HOME_DIRECTORY}/examples/cpp/mc-bugged1-liveness/s4u-mc-bugged1-liveness-stack-cleaner
59 ${CMAKE_HOME_DIRECTORY}/examples/cpp/mc-bugged1-liveness/
60 ${CMAKE_CURRENT_BINARY_DIR}/mc-bugged1-liveness/)
63 set(_mc-bugged1-liveness_disable 1)
64 set(_mc-bugged2-liveness_disable 1)
68 foreach (example mc-bugged1 mc-bugged2 mc-electric-fence mc-failing-assert)
69 ADD_TEST(cover-${example} ${CMAKE_CURRENT_BINARY_DIR}/${example}/s4u-${example} ${CMAKE_HOME_DIRECTORY}/examples/platforms/model_checker_platform.xml)
71 ADD_TEST(cover-mc-bugged1-liveness ${CMAKE_CURRENT_BINARY_DIR}/mc-bugged1-liveness/s4u-mc-bugged1-liveness ${CMAKE_HOME_DIRECTORY}/examples/platforms/small_platform.xml 1 1001)
75 foreach (example mc-bugged1 mc-bugged2 mc-centralized-mutex mc-failing-assert mc-electric-fence
76 mc-bugged1-liveness mc-bugged2-liveness)
77 set(_${example}_disable 1)
81 # Hijack some regular tests to run them on top of the MC
82 foreach (example synchro-barrier synchro-mutex synchro-semaphore)
83 set(tesh_files ${tesh_files} ${CMAKE_CURRENT_SOURCE_DIR}/${example}/s4u-mc-${example}.tesh)
86 ADD_TESH(s4u-mc-${example}
87 --setenv bindir=${CMAKE_CURRENT_BINARY_DIR}/${example}
88 --setenv libdir=${CMAKE_BINARY_DIR}/lib
89 --setenv platfdir=${CMAKE_HOME_DIRECTORY}/examples/platforms
90 --setenv srcdir=${CMAKE_CURRENT_SOURCE_DIR}/${example}
91 --cd ${CMAKE_CURRENT_SOURCE_DIR}/${example}
92 ${CMAKE_HOME_DIRECTORY}/examples/cpp/${example}/s4u-mc-${example}.tesh)
94 add_dependencies(tests-mc s4u-${example})
99 # Dependency on the regular tests
100 foreach(example mc-centralized-mutex)
101 add_dependencies(tests-mc s4u-${example})
106 if(NOT HAVE_GRAPHVIZ)
107 set(_dag-from-dot_disable 1)
110 if(NOT SIMGRID_HAVE_NS3)
111 foreach (example network-ns3 network-ns3-wifi)
112 set(_${example}_disable 1)
116 # Deal with each example
118 foreach (example activity-testany activity-waitany
119 actor-create actor-daemon actor-exiting actor-join actor-kill
120 actor-lifetime actor-migrate actor-suspend actor-yield actor-stacksize
121 app-bittorrent app-chainsend app-token-ring
122 comm-pingpong comm-ready comm-serialize comm-suspend comm-testany comm-wait comm-waitany comm-waitall comm-waituntil
123 comm-dependent comm-host2host comm-failure comm-throttling
124 cloud-capping cloud-migration cloud-simple
125 dag-comm dag-from-dax dag-from-dot dag-failure dag-io dag-scheduling dag-simple
126 dht-chord dht-kademlia
127 energy-exec energy-boot energy-link energy-vm energy-exec-ptask energy-wifi
128 engine-filtering engine-run-partial
129 exec-async exec-basic exec-dvfs exec-remote exec-waitany exec-waitfor exec-dependent exec-unassigned
130 exec-ptask-multicore exec-ptask-multicore-latency exec-cpu-nonlinear exec-cpu-factors exec-failure exec-threads
132 mc-bugged1 mc-bugged1-liveness mc-bugged2 mc-bugged2-liveness mc-centralized-mutex mc-electric-fence mc-failing-assert
133 network-ns3 network-ns3-wifi network-wifi
134 io-async io-priority io-degradation io-file-system io-file-remote io-disk-raw io-dependent
135 platform-failures platform-profile platform-properties
136 plugin-host-load plugin-link-load plugin-prodcons
137 replay-comm replay-io
139 synchro-barrier synchro-condition-variable synchro-condition-variable-waituntil synchro-mutex synchro-semaphore
140 clusters-multicpu network-factors network-nonlinear)
142 # Use default source file unless specified otherwise
143 if(NOT DEFINED _${example}_sources)
144 set(_${example}_sources ${example}/s4u-${example}.cpp)
147 if(NOT DEFINED _${example}_disable)
148 add_executable (s4u-${example} EXCLUDE_FROM_ALL ${_${example}_sources})
149 add_dependencies (tests s4u-${example})
150 add_dependencies (s4u-${example} platf_cpp)
151 target_link_libraries(s4u-${example} simgrid)
152 set_target_properties(s4u-${example} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${example})
154 # Use default factories unless specified otherwise
155 if(NOT DEFINED _${example}_factories)
156 set(_${example}_factories "*")
158 # message("Factories of ${example}: ${_${example}_factories}")
160 ADD_TESH_FACTORIES(s4u-${example} "${_${example}_factories}"
161 --setenv bindir=${CMAKE_CURRENT_BINARY_DIR}/${example}
162 --setenv libdir=${CMAKE_BINARY_DIR}/lib
163 --setenv platfdir=${CMAKE_HOME_DIRECTORY}/examples/platforms
164 --setenv srcdir=${CMAKE_CURRENT_SOURCE_DIR}/${example}
165 --cd ${CMAKE_CURRENT_SOURCE_DIR}/${example}
166 ${CMAKE_HOME_DIRECTORY}/examples/cpp/${example}/s4u-${example}.tesh)
168 message(STATUS "Example ${example} disabled, thus not compiled.")
169 unset(_${example}_disable)
172 set(tesh_files ${tesh_files} ${CMAKE_CURRENT_SOURCE_DIR}/${example}/s4u-${example}.tesh)
173 foreach(file ${_${example}_sources})
174 set(examples_src ${examples_src} ${CMAKE_CURRENT_SOURCE_DIR}/${file})
177 unset(_${example}_factories)
178 unset(_${example}_sources)
185 # MASTERWORKERS EXAMPLE
186 foreach(variant fun class)
187 add_executable (s4u-app-masterworkers-${variant} EXCLUDE_FROM_ALL app-masterworkers/s4u-app-masterworkers-${variant}.cpp)
188 target_link_libraries(s4u-app-masterworkers-${variant} simgrid)
189 set_target_properties(s4u-app-masterworkers-${variant} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/app-masterworkers)
190 add_dependencies(tests s4u-app-masterworkers-${variant})
192 set(examples_src ${examples_src} ${CMAKE_CURRENT_SOURCE_DIR}/app-masterworkers/s4u-app-masterworkers-${variant}.cpp)
194 set(tesh_files ${tesh_files} ${CMAKE_CURRENT_SOURCE_DIR}/app-masterworkers/s4u-app-masterworkers.tesh)
196 # The tests the parallel variant of of DHTs
198 if(CMAKE_SYSTEM_NAME STREQUAL "SunOS" AND CMAKE_SYSTEM_PROCESSOR STREQUAL "i386" AND CMAKE_SIZEOF_VOID_P EQUAL 8)
199 # Thread-local storage (TLS) is needed for parallel execution, but it doesn't
200 # play well with Ucontexts on 64bit SunOS (at least on x86_64).
201 set(parallel-factories "^ucontext")
203 set(parallel-factories "*")
206 foreach(example app-bittorrent app-masterworkers
207 dht-chord dht-kademlia
209 ADD_TESH_FACTORIES(s4u-${example}-parallel "${parallel-factories}" --cfg contexts/nthreads:4 ${CONTEXTS_SYNCHRO}
210 --setenv bindir=${CMAKE_CURRENT_BINARY_DIR}/${example}
211 --setenv platfdir=${CMAKE_HOME_DIRECTORY}/examples/platforms
212 --cd ${CMAKE_CURRENT_SOURCE_DIR}/${example}
213 ${CMAKE_HOME_DIRECTORY}/examples/cpp/${example}/s4u-${example}.tesh)
216 # Test non-DPOR reductions on a given MC test
217 foreach(example mc-failing-assert)
219 # State equality is not tested because it would take about 15 hours to run that test on my machine.
220 # We should first optimize mmalloc_heap_differ() which takes ~4sec for each pair to compare (maybe {175 x 174/ 2} pairs here)
221 # See the comment on mmalloc_heap_differ() in compare.cpp for more info on why it's hard to optimize.
223 # ADD_TESH(s4u-${example}-statequality --setenv bindir=${CMAKE_CURRENT_BINARY_DIR}/${example}
224 # --setenv libdir=${CMAKE_BINARY_DIR}/lib
225 # --setenv platfdir=${CMAKE_HOME_DIRECTORY}/examples/platforms
226 # --setenv srcdir=${CMAKE_CURRENT_SOURCE_DIR}/${example}
227 # --cd ${CMAKE_CURRENT_SOURCE_DIR}/${example}
228 # ${CMAKE_HOME_DIRECTORY}/examples/cpp/${example}/s4u-${example}-statequality.tesh)
230 ADD_TESH(s4u-${example}-nodpor --setenv bindir=${CMAKE_CURRENT_BINARY_DIR}/${example}
231 --setenv libdir=${CMAKE_BINARY_DIR}/lib
232 --setenv platfdir=${CMAKE_HOME_DIRECTORY}/examples/platforms
233 --setenv srcdir=${CMAKE_CURRENT_SOURCE_DIR}/${example}
234 --cd ${CMAKE_CURRENT_SOURCE_DIR}/${example}
235 ${CMAKE_HOME_DIRECTORY}/examples/cpp/${example}/s4u-${example}-nodpor.tesh)
237 set(tesh_files ${tesh_files} ${CMAKE_HOME_DIRECTORY}/examples/cpp/${example}/s4u-${example}-statequality.tesh)
238 set(tesh_files ${tesh_files} ${CMAKE_HOME_DIRECTORY}/examples/cpp/${example}/s4u-${example}-nodpor.tesh)
241 # Examples not accepting factories
242 ##################################
244 foreach (example exec-ptask trace-categories trace-masterworkers trace-platform trace-process-migration
245 trace-host-user-variables trace-link-user-variables trace-route-user-variables)
246 add_executable (s4u-${example} EXCLUDE_FROM_ALL ${example}/s4u-${example}.cpp)
247 target_link_libraries(s4u-${example} simgrid)
248 set_target_properties(s4u-${example} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${example})
249 add_dependencies(tests s4u-${example})
251 set(tesh_files ${tesh_files} ${CMAKE_CURRENT_SOURCE_DIR}/${example}/s4u-${example}.tesh)
252 set(examples_src ${examples_src} ${CMAKE_CURRENT_SOURCE_DIR}/${example}/s4u-${example}.cpp)
254 ADD_TESH(s4u-${example} --setenv bindir=${CMAKE_CURRENT_BINARY_DIR}/${example}
255 --setenv srcdir=${CMAKE_CURRENT_SOURCE_DIR}/${example}
256 --setenv platfdir=${CMAKE_HOME_DIRECTORY}/examples/platforms
257 --cd ${CMAKE_CURRENT_BINARY_DIR}/${example}
258 ${CMAKE_HOME_DIRECTORY}/examples/cpp/${example}/s4u-${example}.tesh)
261 if (NOT enable_memcheck AND NOT WIN32)
262 ADD_TESH(debug-breakpoint --setenv bindir=${CMAKE_CURRENT_BINARY_DIR}/comm-pingpong
263 --setenv platfdir=${CMAKE_HOME_DIRECTORY}/examples/platforms
264 ${CMAKE_CURRENT_SOURCE_DIR}/comm-pingpong/debug-breakpoint.tesh)
267 # Add all extra files to the archive
268 ####################################
269 set(examples_src ${examples_src} ${CMAKE_CURRENT_SOURCE_DIR}/mc-bugged1-liveness/s4u-mc-bugged1-liveness.cpp PARENT_SCOPE)
270 set(tesh_files ${tesh_files} ${CMAKE_CURRENT_SOURCE_DIR}/comm-pingpong/debug-breakpoint.tesh
271 ${CMAKE_CURRENT_SOURCE_DIR}/mc-bugged1-liveness/s4u-mc-bugged1-liveness.tesh
272 ${CMAKE_CURRENT_SOURCE_DIR}/mc-bugged1-liveness/s4u-mc-bugged1-liveness-visited.tesh PARENT_SCOPE)
273 set(xml_files ${xml_files} ${CMAKE_CURRENT_SOURCE_DIR}/actor-create/s4u-actor-create_d.xml
274 ${CMAKE_CURRENT_SOURCE_DIR}/actor-lifetime/s4u-actor-lifetime_d.xml
275 ${CMAKE_CURRENT_SOURCE_DIR}/app-bittorrent/s4u-app-bittorrent_d.xml
276 ${CMAKE_CURRENT_SOURCE_DIR}/app-masterworkers/s4u-app-masterworkers_d.xml
277 ${CMAKE_CURRENT_SOURCE_DIR}/dag-scheduling/Montage_25.xml
278 ${CMAKE_CURRENT_SOURCE_DIR}/dht-chord/s4u-dht-chord_d.xml
279 ${CMAKE_CURRENT_SOURCE_DIR}/dht-kademlia/s4u-dht-kademlia_d.xml
280 ${CMAKE_CURRENT_SOURCE_DIR}/io-file-remote/s4u-io-file-remote_d.xml
281 ${CMAKE_CURRENT_SOURCE_DIR}/platform-failures/s4u-platform-failures_d.xml
282 ${CMAKE_CURRENT_SOURCE_DIR}/replay-comm/s4u-replay-comm-split_d.xml
283 ${CMAKE_CURRENT_SOURCE_DIR}/replay-comm/s4u-replay-comm_d.xml
284 ${CMAKE_CURRENT_SOURCE_DIR}/replay-io/s4u-replay-io_d.xml
285 ${CMAKE_CURRENT_SOURCE_DIR}/network-ns3/3hosts_2links_d.xml
286 ${CMAKE_CURRENT_SOURCE_DIR}/network-ns3/3links-timer_d.xml
287 ${CMAKE_CURRENT_SOURCE_DIR}/network-ns3/3links_d.xml
288 ${CMAKE_CURRENT_SOURCE_DIR}/network-ns3/crosstraffic_d.xml
289 ${CMAKE_CURRENT_SOURCE_DIR}/network-ns3/dogbone_d.xml
290 ${CMAKE_CURRENT_SOURCE_DIR}/network-ns3/onelink_d.xml
291 ${CMAKE_CURRENT_SOURCE_DIR}/network-ns3/one_cluster_d.xml PARENT_SCOPE)
292 set(bin_files ${bin_files} ${CMAKE_CURRENT_SOURCE_DIR}/dht-kademlia/generate.py
293 ${CMAKE_CURRENT_SOURCE_DIR}/mc-bugged1-liveness/s4u-mc-bugged1-liveness-stack-cleaner
294 ${CMAKE_CURRENT_SOURCE_DIR}/mc-bugged1-liveness/promela_bugged1_liveness
295 ${CMAKE_CURRENT_SOURCE_DIR}/mc-bugged2-liveness/promela_bugged2_liveness PARENT_SCOPE)
296 set(txt_files ${txt_files} ${CMAKE_CURRENT_SOURCE_DIR}/dag-from-dax/simple_dax_with_cycle.xml
297 ${CMAKE_CURRENT_SOURCE_DIR}/dag-from-dax/smalldax.xml
298 ${CMAKE_CURRENT_SOURCE_DIR}/dag-from-dot/dag.dot
299 ${CMAKE_CURRENT_SOURCE_DIR}/dag-from-dot/dag_with_cycle.dot
300 ${CMAKE_CURRENT_SOURCE_DIR}/replay-comm/s4u-replay-comm-split-p0.txt
301 ${CMAKE_CURRENT_SOURCE_DIR}/replay-comm/s4u-replay-comm-split-p1.txt
302 ${CMAKE_CURRENT_SOURCE_DIR}/replay-comm/s4u-replay-comm.txt
303 ${CMAKE_CURRENT_SOURCE_DIR}/replay-io/s4u-replay-io.txt PARENT_SCOPE)