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
17 set(_maestro-set_factories "thread")
20 # These tests timeout with threads, maybe because of dwarf parsing? not sure
21 foreach(example mc-bugged1 mc-bugged2 mc-failing-assert mc-electric-fence)
22 set(_${example}_factories "^thread") # Timeout
23 add_dependencies(tests-mc s4u-${example})
26 if(HAVE_C_STACK_CLEANER)
27 add_executable (s4u-mc-bugged1-liveness-cleaner-on EXCLUDE_FROM_ALL s4u-mc-bugged1-liveness/s4u-mc-bugged1-liveness.cpp)
28 target_link_libraries(s4u-mc-bugged1-liveness-cleaner-on simgrid)
29 set_target_properties(s4u-mc-bugged1-liveness-cleaner-on PROPERTIES COMPILE_FLAGS "-DGARBAGE_STACK -fstack-cleaner")
30 add_dependencies(tests-mc s4u-mc-bugged1-liveness-cleaner-on)
32 add_executable (s4u-mc-bugged1-liveness-cleaner-off EXCLUDE_FROM_ALL s4u-mc-bugged1-liveness/s4u-mc-bugged1-liveness.cpp)
33 target_link_libraries(s4u-mc-bugged1-liveness-cleaner-off simgrid)
34 set_target_properties(s4u-mc-bugged1-liveness-cleaner-off PROPERTIES COMPILE_FLAGS "-DGARBAGE_STACK -fno-stack-cleaner")
35 add_dependencies(tests-mc s4u-mc-bugged1-liveness-cleaner-off)
38 # Model-checking liveness
39 if(HAVE_UCONTEXT_CONTEXTS AND SIMGRID_PROCESSOR_x86_64)
40 # liveness model-checking works only on 64bits (for now ...)
41 set(_mc-bugged1-liveness_factories "ucontext")
42 add_dependencies(tests-mc s4u-mc-bugged1-liveness)
43 set(_mc-bugged2-liveness_factories "ucontext")
45 # This example never ends, disable it for now
46 set(_mc-bugged2-liveness_disable 1)
48 ADD_TESH(s4u-mc-bugged1-liveness-visited-ucontext --setenv bindir=${CMAKE_CURRENT_BINARY_DIR}/mc-bugged1-liveness
49 --setenv platfdir=${CMAKE_HOME_DIRECTORY}/examples/platforms
50 --cd ${CMAKE_CURRENT_SOURCE_DIR}/mc-bugged1-liveness
51 ${CMAKE_HOME_DIRECTORY}/examples/cpp/mc-bugged1-liveness/s4u-mc-bugged1-liveness-visited.tesh)
52 IF(HAVE_C_STACK_CLEANER)
53 add_dependencies(tests-mc s4u-mc-bugged1-liveness-stack-cleaner)
54 # This test checks if the stack cleaner is making a difference:
55 ADD_TEST(s4u-mc-bugged1-liveness-stack-cleaner ${CMAKE_HOME_DIRECTORY}/examples/cpp/mc-bugged1-liveness/s4u-mc-bugged1-liveness-stack-cleaner
56 ${CMAKE_HOME_DIRECTORY}/examples/cpp/mc-bugged1-liveness/
57 ${CMAKE_CURRENT_BINARY_DIR}/mc-bugged1-liveness/)
60 set(_mc-bugged1-liveness_disable 1)
61 set(_mc-bugged2-liveness_disable 1)
65 foreach (example mc-bugged1 mc-bugged2 mc-electric-fence mc-failing-assert)
66 ADD_TEST(cover-${example} ${CMAKE_CURRENT_BINARY_DIR}/${example}/s4u-${example} ${CMAKE_HOME_DIRECTORY}/examples/platforms/model_checker_platform.xml)
68 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)
72 foreach (example mc-bugged1 mc-bugged2 mc-centralized-mutex mc-failing-assert mc-electric-fence
73 mc-bugged1-liveness mc-bugged2-liveness)
74 set(_${example}_disable 1)
78 # Hijack some regular tests to run them on top of the MC
79 foreach (example synchro-barrier synchro-mutex synchro-semaphore)
80 set(tesh_files ${tesh_files} ${CMAKE_CURRENT_SOURCE_DIR}/${example}/s4u-mc-${example}.tesh)
83 ADD_TESH(s4u-mc-${example}
84 --setenv bindir=${CMAKE_CURRENT_BINARY_DIR}/${example}
85 --setenv libdir=${CMAKE_BINARY_DIR}/lib
86 --setenv platfdir=${CMAKE_HOME_DIRECTORY}/examples/platforms
87 --setenv srcdir=${CMAKE_CURRENT_SOURCE_DIR}/${example}
88 --cd ${CMAKE_CURRENT_SOURCE_DIR}/${example}
89 ${CMAKE_HOME_DIRECTORY}/examples/cpp/${example}/s4u-mc-${example}.tesh)
91 add_dependencies(tests-mc s4u-${example})
96 # Dependency on the regular tests
97 foreach(example mc-centralized-mutex)
98 add_dependencies(tests-mc s4u-${example})
102 if(NOT HAVE_GRAPHVIZ)
103 set(_dag-from-dot_disable 1)
104 set(_dag-from-dot-simple_disable 1)
107 if (NOT SIMGRID_HAVE_JSON)
108 set(_dag-from-json-simple_disable 1)
111 if(NOT SIMGRID_HAVE_NS3)
112 foreach (example network-ns3 network-ns3-wifi)
113 set(_${example}_disable 1)
117 # Deal with each example
119 foreach (example activity-testany activity-waitany
120 actor-create actor-daemon actor-exiting actor-join actor-kill
121 actor-lifetime actor-migrate actor-suspend actor-yield actor-stacksize
122 app-bittorrent app-chainsend app-token-ring
123 battery-degradation battery-simple battery-energy
124 comm-pingpong comm-ready comm-suspend comm-testany comm-wait comm-waitany comm-waitall comm-waituntil
125 comm-dependent comm-host2host comm-failure comm-throttling
126 cloud-capping cloud-migration cloud-simple
127 dag-comm dag-from-json-simple dag-from-dax-simple dag-from-dax dag-from-dot-simple dag-from-dot dag-failure dag-io dag-scheduling dag-simple dag-tuto
128 dht-chord dht-kademlia
129 energy-exec energy-boot energy-link energy-vm energy-exec-ptask energy-wifi
130 engine-filtering engine-run-partial
131 exec-async exec-basic exec-dvfs exec-remote exec-waitany exec-waitfor exec-dependent exec-unassigned
132 exec-ptask-multicore exec-ptask-multicore-latency exec-cpu-nonlinear exec-cpu-factors exec-failure exec-threads
134 mc-bugged1 mc-bugged1-liveness mc-bugged2 mc-bugged2-liveness mc-centralized-mutex mc-electric-fence mc-failing-assert
135 network-ns3 network-ns3-wifi network-wifi
136 io-async io-priority io-degradation io-file-system io-file-remote io-disk-raw io-dependent
137 platform-comm-serialize platform-failures platform-profile platform-properties
138 plugin-host-load plugin-link-load plugin-prodcons
139 replay-comm replay-io
141 synchro-barrier synchro-condition-variable synchro-condition-variable-waituntil synchro-mutex synchro-semaphore
142 clusters-multicpu network-factors network-nonlinear)
144 # Use default source file unless specified otherwise
145 if(NOT DEFINED _${example}_sources)
146 set(_${example}_sources ${example}/s4u-${example}.cpp)
149 if(NOT DEFINED _${example}_disable)
150 add_executable (s4u-${example} EXCLUDE_FROM_ALL ${_${example}_sources})
151 add_dependencies (tests s4u-${example})
152 add_dependencies (s4u-${example} platf_cpp)
153 target_link_libraries(s4u-${example} simgrid)
154 set_target_properties(s4u-${example} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${example})
156 # Use default factories unless specified otherwise
157 if(NOT DEFINED _${example}_factories)
158 set(_${example}_factories "*")
160 # message("Factories of ${example}: ${_${example}_factories}")
162 ADD_TESH_FACTORIES(s4u-${example} "${_${example}_factories}"
163 --setenv bindir=${CMAKE_CURRENT_BINARY_DIR}/${example}
164 --setenv libdir=${CMAKE_BINARY_DIR}/lib
165 --setenv platfdir=${CMAKE_HOME_DIRECTORY}/examples/platforms
166 --setenv srcdir=${CMAKE_CURRENT_SOURCE_DIR}/${example}
167 --cd ${CMAKE_CURRENT_SOURCE_DIR}/${example}
168 ${CMAKE_HOME_DIRECTORY}/examples/cpp/${example}/s4u-${example}.tesh)
170 message(STATUS "Example ${example} disabled, thus not compiled.")
171 unset(_${example}_disable)
174 set(tesh_files ${tesh_files} ${CMAKE_CURRENT_SOURCE_DIR}/${example}/s4u-${example}.tesh)
175 foreach(file ${_${example}_sources})
176 set(examples_src ${examples_src} ${CMAKE_CURRENT_SOURCE_DIR}/${file})
179 unset(_${example}_factories)
180 unset(_${example}_sources)
187 # MASTERWORKERS EXAMPLE
188 foreach(variant fun class)
189 add_executable (s4u-app-masterworkers-${variant} EXCLUDE_FROM_ALL app-masterworkers/s4u-app-masterworkers-${variant}.cpp)
190 target_link_libraries(s4u-app-masterworkers-${variant} simgrid)
191 set_target_properties(s4u-app-masterworkers-${variant} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/app-masterworkers)
192 add_dependencies(tests s4u-app-masterworkers-${variant})
194 set(examples_src ${examples_src} ${CMAKE_CURRENT_SOURCE_DIR}/app-masterworkers/s4u-app-masterworkers-${variant}.cpp)
196 set(tesh_files ${tesh_files} ${CMAKE_CURRENT_SOURCE_DIR}/app-masterworkers/s4u-app-masterworkers.tesh)
198 # The tests the parallel variant of of DHTs
200 if(CMAKE_SYSTEM_NAME STREQUAL "SunOS" AND CMAKE_SYSTEM_PROCESSOR STREQUAL "i386" AND CMAKE_SIZEOF_VOID_P EQUAL 8)
201 # Thread-local storage (TLS) is needed for parallel execution, but it doesn't
202 # play well with Ucontexts on 64bit SunOS (at least on x86_64).
203 set(parallel-factories "^ucontext")
205 set(parallel-factories "*")
208 foreach(example app-bittorrent app-masterworkers
209 dht-chord dht-kademlia
211 ADD_TESH_FACTORIES(s4u-${example}-parallel "${parallel-factories}" --cfg contexts/nthreads:4 ${CONTEXTS_SYNCHRO}
212 --setenv bindir=${CMAKE_CURRENT_BINARY_DIR}/${example}
213 --setenv platfdir=${CMAKE_HOME_DIRECTORY}/examples/platforms
214 --cd ${CMAKE_CURRENT_SOURCE_DIR}/${example}
215 ${CMAKE_HOME_DIRECTORY}/examples/cpp/${example}/s4u-${example}.tesh)
218 # Test non-DPOR reductions on a given MC test
219 foreach(example mc-failing-assert)
221 # State equality is not tested because it would take about 15 hours to run that test on my machine.
222 # We should first optimize mmalloc_heap_differ() which takes ~4sec for each pair to compare (maybe {175 x 174/ 2} pairs here)
223 # See the comment on mmalloc_heap_differ() in compare.cpp for more info on why it's hard to optimize.
225 # ADD_TESH(s4u-${example}-statequality --setenv bindir=${CMAKE_CURRENT_BINARY_DIR}/${example}
226 # --setenv libdir=${CMAKE_BINARY_DIR}/lib
227 # --setenv platfdir=${CMAKE_HOME_DIRECTORY}/examples/platforms
228 # --setenv srcdir=${CMAKE_CURRENT_SOURCE_DIR}/${example}
229 # --cd ${CMAKE_CURRENT_SOURCE_DIR}/${example}
230 # ${CMAKE_HOME_DIRECTORY}/examples/cpp/${example}/s4u-${example}-statequality.tesh)
232 ADD_TESH(s4u-${example}-nodpor --setenv bindir=${CMAKE_CURRENT_BINARY_DIR}/${example}
233 --setenv libdir=${CMAKE_BINARY_DIR}/lib
234 --setenv platfdir=${CMAKE_HOME_DIRECTORY}/examples/platforms
235 --setenv srcdir=${CMAKE_CURRENT_SOURCE_DIR}/${example}
236 --cd ${CMAKE_CURRENT_SOURCE_DIR}/${example}
237 ${CMAKE_HOME_DIRECTORY}/examples/cpp/${example}/s4u-${example}-nodpor.tesh)
239 set(tesh_files ${tesh_files} ${CMAKE_HOME_DIRECTORY}/examples/cpp/${example}/s4u-${example}-statequality.tesh)
240 set(tesh_files ${tesh_files} ${CMAKE_HOME_DIRECTORY}/examples/cpp/${example}/s4u-${example}-nodpor.tesh)
243 # Examples not accepting factories
244 ##################################
246 foreach (example exec-ptask trace-categories trace-masterworkers trace-platform trace-process-migration
247 trace-host-user-variables trace-link-user-variables trace-route-user-variables)
248 add_executable (s4u-${example} EXCLUDE_FROM_ALL ${example}/s4u-${example}.cpp)
249 target_link_libraries(s4u-${example} simgrid)
250 set_target_properties(s4u-${example} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${example})
251 add_dependencies(tests s4u-${example})
253 set(tesh_files ${tesh_files} ${CMAKE_CURRENT_SOURCE_DIR}/${example}/s4u-${example}.tesh)
254 set(examples_src ${examples_src} ${CMAKE_CURRENT_SOURCE_DIR}/${example}/s4u-${example}.cpp)
256 ADD_TESH(s4u-${example} --setenv bindir=${CMAKE_CURRENT_BINARY_DIR}/${example}
257 --setenv srcdir=${CMAKE_CURRENT_SOURCE_DIR}/${example}
258 --setenv platfdir=${CMAKE_HOME_DIRECTORY}/examples/platforms
259 --cd ${CMAKE_CURRENT_BINARY_DIR}/${example}
260 ${CMAKE_HOME_DIRECTORY}/examples/cpp/${example}/s4u-${example}.tesh)
263 if (NOT enable_memcheck)
264 ADD_TESH(debug-breakpoint --setenv bindir=${CMAKE_CURRENT_BINARY_DIR}/comm-pingpong
265 --setenv platfdir=${CMAKE_HOME_DIRECTORY}/examples/platforms
266 ${CMAKE_CURRENT_SOURCE_DIR}/comm-pingpong/debug-breakpoint.tesh)
269 # Add all extra files to the archive
270 ####################################
271 set(examples_src ${examples_src} ${CMAKE_CURRENT_SOURCE_DIR}/mc-bugged1-liveness/s4u-mc-bugged1-liveness.cpp PARENT_SCOPE)
272 set(tesh_files ${tesh_files} ${CMAKE_CURRENT_SOURCE_DIR}/comm-pingpong/debug-breakpoint.tesh
273 ${CMAKE_CURRENT_SOURCE_DIR}/mc-bugged1-liveness/s4u-mc-bugged1-liveness.tesh
274 ${CMAKE_CURRENT_SOURCE_DIR}/mc-bugged1-liveness/s4u-mc-bugged1-liveness-visited.tesh PARENT_SCOPE)
275 set(xml_files ${xml_files} ${CMAKE_CURRENT_SOURCE_DIR}/actor-create/s4u-actor-create_d.xml
276 ${CMAKE_CURRENT_SOURCE_DIR}/actor-lifetime/s4u-actor-lifetime_d.xml
277 ${CMAKE_CURRENT_SOURCE_DIR}/app-bittorrent/s4u-app-bittorrent_d.xml
278 ${CMAKE_CURRENT_SOURCE_DIR}/app-masterworkers/s4u-app-masterworkers_d.xml
279 ${CMAKE_CURRENT_SOURCE_DIR}/dag-scheduling/Montage_25.xml
280 ${CMAKE_CURRENT_SOURCE_DIR}/dht-chord/s4u-dht-chord_d.xml
281 ${CMAKE_CURRENT_SOURCE_DIR}/dht-kademlia/s4u-dht-kademlia_d.xml
282 ${CMAKE_CURRENT_SOURCE_DIR}/io-file-remote/s4u-io-file-remote_d.xml
283 ${CMAKE_CURRENT_SOURCE_DIR}/platform-failures/s4u-platform-failures_d.xml
284 ${CMAKE_CURRENT_SOURCE_DIR}/replay-comm/s4u-replay-comm-split_d.xml
285 ${CMAKE_CURRENT_SOURCE_DIR}/replay-comm/s4u-replay-comm_d.xml
286 ${CMAKE_CURRENT_SOURCE_DIR}/replay-io/s4u-replay-io_d.xml
287 ${CMAKE_CURRENT_SOURCE_DIR}/network-ns3/3hosts_2links_d.xml
288 ${CMAKE_CURRENT_SOURCE_DIR}/network-ns3/3links-timer_d.xml
289 ${CMAKE_CURRENT_SOURCE_DIR}/network-ns3/3links_d.xml
290 ${CMAKE_CURRENT_SOURCE_DIR}/network-ns3/crosstraffic_d.xml
291 ${CMAKE_CURRENT_SOURCE_DIR}/network-ns3/dogbone_d.xml
292 ${CMAKE_CURRENT_SOURCE_DIR}/network-ns3/onelink_d.xml
293 ${CMAKE_CURRENT_SOURCE_DIR}/network-ns3/one_cluster_d.xml PARENT_SCOPE)
294 set(bin_files ${bin_files} ${CMAKE_CURRENT_SOURCE_DIR}/battery-degradation/plot_battery_degradation.py
295 ${CMAKE_CURRENT_SOURCE_DIR}/dht-kademlia/generate.py
296 ${CMAKE_CURRENT_SOURCE_DIR}/mc-bugged1-liveness/s4u-mc-bugged1-liveness-stack-cleaner
297 ${CMAKE_CURRENT_SOURCE_DIR}/mc-bugged1-liveness/promela_bugged1_liveness
298 ${CMAKE_CURRENT_SOURCE_DIR}/mc-bugged2-liveness/promela_bugged2_liveness PARENT_SCOPE)
299 set(txt_files ${txt_files} ${CMAKE_CURRENT_SOURCE_DIR}/dag-from-dax/simple_dax_with_cycle.xml
300 ${CMAKE_CURRENT_SOURCE_DIR}/dag-from-dax/smalldax.xml
301 ${CMAKE_CURRENT_SOURCE_DIR}/dag-from-dax-simple/dag.xml
302 ${CMAKE_CURRENT_SOURCE_DIR}/dag-from-dot/dag.dot
303 ${CMAKE_CURRENT_SOURCE_DIR}/dag-from-dot-simple/dag.dot
304 ${CMAKE_CURRENT_SOURCE_DIR}/dag-from-dot/dag_with_cycle.dot
305 ${CMAKE_CURRENT_SOURCE_DIR}/dag-from-json-simple/dag.json
306 ${CMAKE_CURRENT_SOURCE_DIR}/replay-comm/s4u-replay-comm-split-p0.txt
307 ${CMAKE_CURRENT_SOURCE_DIR}/replay-comm/s4u-replay-comm-split-p1.txt
308 ${CMAKE_CURRENT_SOURCE_DIR}/replay-comm/s4u-replay-comm.txt
309 ${CMAKE_CURRENT_SOURCE_DIR}/replay-io/s4u-replay-io.txt PARENT_SCOPE)