2 # Regular examples: with only one source and tested with all factories by default
3 #################################################################################
4 ### Define the examples' specificities
6 set(_app-bittorrent_sources app-bittorrent/s4u-bittorrent.cpp app-bittorrent/s4u-bittorrent.hpp
7 app-bittorrent/s4u-peer.cpp app-bittorrent/s4u-peer.hpp
8 app-bittorrent/s4u-tracker.cpp app-bittorrent/s4u-tracker.hpp)
9 set(_dht-chord_sources dht-chord/s4u-dht-chord.cpp dht-chord/s4u-dht-chord.hpp dht-chord/s4u-dht-chord-node.cpp)
10 set(_dht-kademlia_sources dht-kademlia/s4u-dht-kademlia.cpp dht-kademlia/s4u-dht-kademlia.hpp
11 dht-kademlia/node.cpp dht-kademlia/node.hpp
12 dht-kademlia/routing_table.cpp dht-kademlia/routing_table.hpp
13 dht-kademlia/answer.cpp dht-kademlia/answer.hpp dht-kademlia/message.hpp)
15 set(_actor-stacksize_factories "^thread") # Threads ignore modifications of the stack size
17 # The maestro-set example only works for threads and when not using windows.
18 set(_maestro-set_factories "thread")
20 set(_maestro-set_disable 1)
24 # These tests timeout with threads, maybe because of dwarf parsing? not sure
25 foreach(example mc-bugged1 mc-bugged2 mc-failing-assert mc-electric-fence)
26 set(_${example}_factories "^thread") # Timeout
27 add_dependencies(tests-mc s4u-${example})
30 # Make all MC tests buildable together
31 #foreach(example ) # no test to be build in any case
35 if(HAVE_C_STACK_CLEANER)
36 add_executable (s4u-mc-bugged1-liveness-cleaner-on EXCLUDE_FROM_ALL s4u-mc-bugged1-liveness/s4u-mc-bugged1-liveness.cpp)
37 target_link_libraries(s4u-mc-bugged1-liveness-cleaner-on simgrid)
38 set_target_properties(s4u-mc-bugged1-liveness-cleaner-on PROPERTIES COMPILE_FLAGS "-DGARBAGE_STACK -fstack-cleaner")
39 add_dependencies(tests-mc s4u-mc-bugged1-liveness-cleaner-on)
41 add_executable (s4u-mc-bugged1-liveness-cleaner-off EXCLUDE_FROM_ALL s4u-mc-bugged1-liveness/s4u-mc-bugged1-liveness.cpp)
42 target_link_libraries(s4u-mc-bugged1-liveness-cleaner-off simgrid)
43 set_target_properties(s4u-mc-bugged1-liveness-cleaner-off PROPERTIES COMPILE_FLAGS "-DGARBAGE_STACK -fno-stack-cleaner")
44 add_dependencies(tests-mc s4u-mc-bugged1-liveness-cleaner-off)
47 # Model-checking liveness
48 if(HAVE_UCONTEXT_CONTEXTS AND SIMGRID_PROCESSOR_x86_64)
49 # liveness model-checking works only on 64bits (for now ...)
50 set(_mc-bugged1-liveness_factories "ucontext") # Timeout
51 add_dependencies(tests-mc s4u-mc-bugged1-liveness)
53 set(_mc-bugged1-liveness_disable 1)
56 # This example hit the 5' timeout on CI, disable it for now
57 # ADD_TESH(s4u-mc-bugged1-liveness-visited-ucontext --setenv bindir=${CMAKE_CURRENT_BINARY_DIR}/mc-bugged1-liveness
58 # --setenv platfdir=${CMAKE_HOME_DIRECTORY}/examples/platforms
59 # --cd ${CMAKE_CURRENT_SOURCE_DIR}/mc-bugged1-liveness
60 # ${CMAKE_HOME_DIRECTORY}/examples/cpp/mc-bugged1-liveness/s4u-mc-bugged1-liveness-visited.tesh)
61 IF(HAVE_C_STACK_CLEANER)
62 add_dependencies(tests-mc s4u-mc-bugged1-liveness-stack-cleaner)
63 # This test checks if the stack cleaner is making a difference:
64 ADD_TEST(s4u-mc-bugged1-liveness-stack-cleaner ${CMAKE_HOME_DIRECTORY}/examples/cpp/mc-bugged1-liveness/s4u-mc-bugged1-liveness-stack-cleaner
65 ${CMAKE_HOME_DIRECTORY}/examples/cpp/mc-bugged1-liveness/
66 ${CMAKE_CURRENT_BINARY_DIR}/mc-bugged1-liveness/)
70 foreach (example mc-bugged1 mc-bugged2 mc-electric-fence mc-failing-assert)
71 ADD_TEST(cover-${example} ${CMAKE_CURRENT_BINARY_DIR}/${example}/s4u-${example} ${CMAKE_HOME_DIRECTORY}/examples/platforms/model_checker_platform.xml)
73 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)
77 foreach (example mc-bugged1 mc-bugged2 mc-failing-assert mc-electric-fence
79 set(_${example}_disable 1)
84 set(_dag-from-dot_disable 1)
87 if(NOT SIMGRID_HAVE_NS3)
88 foreach (example network-ns3 network-ns3-wifi)
89 set(_${example}_disable 1)
93 # Deal with each example
95 foreach (example actor-create actor-daemon actor-exiting actor-join actor-kill
96 actor-lifetime actor-migrate actor-suspend actor-yield actor-stacksize
97 app-bittorrent app-chainsend app-token-ring
98 comm-pingpong comm-ready comm-serialize comm-suspend comm-wait comm-waitany comm-waitall comm-waituntil
99 comm-dependent comm-host2host comm-failure comm-throttling
100 cloud-capping cloud-migration cloud-simple
101 dag-comm dag-from-dax dag-from-dot dag-failure dag-io dag-scheduling dag-simple
102 dht-chord dht-kademlia
103 energy-exec energy-boot energy-link energy-vm energy-exec-ptask energy-wifi
104 engine-filtering engine-run-partial
105 exec-async exec-basic exec-dvfs exec-remote exec-waitany exec-waitfor exec-dependent exec-unassigned
106 exec-ptask-multicore exec-cpu-nonlinear exec-cpu-factors exec-failure
108 mc-bugged1 mc-bugged1-liveness mc-bugged2 mc-electric-fence mc-failing-assert
109 network-ns3 network-ns3-wifi network-wifi
110 io-async io-priority io-degradation io-file-system io-file-remote io-disk-raw io-dependent
111 platform-failures platform-profile platform-properties
112 plugin-host-load plugin-link-load plugin-prodcons
113 replay-comm replay-io
115 synchro-barrier synchro-condition-variable synchro-condition-variable-waituntil synchro-mutex synchro-semaphore
116 clusters-multicpu network-factors network-nonlinear)
118 # Use default source file unless specified otherwise
119 if(NOT DEFINED _${example}_sources)
120 set(_${example}_sources ${example}/s4u-${example}.cpp)
123 if(NOT DEFINED _${example}_disable)
124 add_executable (s4u-${example} EXCLUDE_FROM_ALL ${_${example}_sources})
125 add_dependencies (tests s4u-${example})
126 add_dependencies (s4u-${example} platf_cpp)
127 target_link_libraries(s4u-${example} simgrid)
128 set_target_properties(s4u-${example} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${example})
130 # Use default factories unless specified otherwise
131 if(NOT DEFINED _${example}_factories)
132 set(_${example}_factories "*")
134 # message("Factories of ${example}: ${_${example}_factories}")
136 ADD_TESH_FACTORIES(s4u-${example} "${_${example}_factories}"
137 --setenv bindir=${CMAKE_CURRENT_BINARY_DIR}/${example}
138 --setenv libdir=${CMAKE_BINARY_DIR}/lib
139 --setenv platfdir=${CMAKE_HOME_DIRECTORY}/examples/platforms
140 --setenv srcdir=${CMAKE_CURRENT_SOURCE_DIR}/${example}
141 --cd ${CMAKE_CURRENT_SOURCE_DIR}/${example}
142 ${CMAKE_HOME_DIRECTORY}/examples/cpp/${example}/s4u-${example}.tesh)
144 message(STATUS "Example ${example} disabled, thus not compiled.")
145 unset(_${example}_disable)
148 set(tesh_files ${tesh_files} ${CMAKE_CURRENT_SOURCE_DIR}/${example}/s4u-${example}.tesh)
149 foreach(file ${_${example}_sources})
150 set(examples_src ${examples_src} ${CMAKE_CURRENT_SOURCE_DIR}/${file})
153 unset(_${example}_factories)
154 unset(_${example}_sources)
161 # MASTERWORKERS EXAMPLE
162 foreach(variant fun class)
163 add_executable (s4u-app-masterworkers-${variant} EXCLUDE_FROM_ALL app-masterworkers/s4u-app-masterworkers-${variant}.cpp)
164 target_link_libraries(s4u-app-masterworkers-${variant} simgrid)
165 set_target_properties(s4u-app-masterworkers-${variant} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/app-masterworkers)
166 add_dependencies(tests s4u-app-masterworkers-${variant})
168 set(examples_src ${examples_src} ${CMAKE_CURRENT_SOURCE_DIR}/app-masterworkers/s4u-app-masterworkers-${variant}.cpp)
170 set(tesh_files ${tesh_files} ${CMAKE_CURRENT_SOURCE_DIR}/app-masterworkers/s4u-app-masterworkers.tesh)
172 # The tests the parallel variant of of DHTs
174 if(CMAKE_SYSTEM_NAME STREQUAL "SunOS" AND CMAKE_SYSTEM_PROCESSOR STREQUAL "i386" AND CMAKE_SIZEOF_VOID_P EQUAL 8)
175 # Thread-local storage (TLS) is needed for parallel execution, but it doesn't
176 # play well with Ucontexts on 64bit SunOS (at least on x86_64).
177 set(parallel-factories "^ucontext")
179 set(parallel-factories "*")
182 foreach(example app-bittorrent app-masterworkers
183 dht-chord dht-kademlia
185 ADD_TESH_FACTORIES(s4u-${example}-parallel "${parallel-factories}" --cfg contexts/nthreads:4 ${CONTEXTS_SYNCHRO}
186 --setenv bindir=${CMAKE_CURRENT_BINARY_DIR}/${example}
187 --setenv platfdir=${CMAKE_HOME_DIRECTORY}/examples/platforms
188 --cd ${CMAKE_CURRENT_SOURCE_DIR}/${example}
189 ${CMAKE_HOME_DIRECTORY}/examples/cpp/${example}/s4u-${example}.tesh)
192 # Examples not accepting factories
193 ##################################
195 foreach (example exec-ptask trace-categories trace-masterworkers trace-platform trace-process-migration
196 trace-host-user-variables trace-link-user-variables trace-route-user-variables)
197 add_executable (s4u-${example} EXCLUDE_FROM_ALL ${example}/s4u-${example}.cpp)
198 target_link_libraries(s4u-${example} simgrid)
199 set_target_properties(s4u-${example} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${example})
200 add_dependencies(tests s4u-${example})
202 set(tesh_files ${tesh_files} ${CMAKE_CURRENT_SOURCE_DIR}/${example}/s4u-${example}.tesh)
203 set(examples_src ${examples_src} ${CMAKE_CURRENT_SOURCE_DIR}/${example}/s4u-${example}.cpp)
205 ADD_TESH(s4u-${example} --setenv bindir=${CMAKE_CURRENT_BINARY_DIR}/${example}
206 --setenv srcdir=${CMAKE_CURRENT_SOURCE_DIR}/${example}
207 --setenv platfdir=${CMAKE_HOME_DIRECTORY}/examples/platforms
208 --cd ${CMAKE_CURRENT_BINARY_DIR}/${example}
209 ${CMAKE_HOME_DIRECTORY}/examples/cpp/${example}/s4u-${example}.tesh)
212 if (NOT enable_memcheck AND NOT WIN32)
213 ADD_TESH(simix-breakpoint --setenv bindir=${CMAKE_CURRENT_BINARY_DIR}/comm-pingpong
214 --setenv platfdir=${CMAKE_HOME_DIRECTORY}/examples/platforms
215 ${CMAKE_CURRENT_SOURCE_DIR}/comm-pingpong/simix-breakpoint.tesh)
218 # Add all extra files to the archive
219 ####################################
220 set(examples_src ${examples_src} ${CMAKE_CURRENT_SOURCE_DIR}/mc-bugged1-liveness/s4u-mc-bugged1-liveness.cpp PARENT_SCOPE)
221 set(tesh_files ${tesh_files} ${CMAKE_CURRENT_SOURCE_DIR}/comm-pingpong/simix-breakpoint.tesh
222 ${CMAKE_CURRENT_SOURCE_DIR}/mc-bugged1-liveness/s4u-mc-bugged1-liveness.tesh
223 ${CMAKE_CURRENT_SOURCE_DIR}/mc-bugged1-liveness/s4u-mc-bugged1-liveness-visited.tesh PARENT_SCOPE)
224 set(xml_files ${xml_files} ${CMAKE_CURRENT_SOURCE_DIR}/actor-create/s4u-actor-create_d.xml
225 ${CMAKE_CURRENT_SOURCE_DIR}/actor-lifetime/s4u-actor-lifetime_d.xml
226 ${CMAKE_CURRENT_SOURCE_DIR}/actor-yield/s4u-actor-yield_d.xml
227 ${CMAKE_CURRENT_SOURCE_DIR}/app-bittorrent/s4u-app-bittorrent_d.xml
228 ${CMAKE_CURRENT_SOURCE_DIR}/app-masterworkers/s4u-app-masterworkers_d.xml
229 ${CMAKE_CURRENT_SOURCE_DIR}/comm-suspend/s4u-comm-suspend_d.xml
230 ${CMAKE_CURRENT_SOURCE_DIR}/comm-wait/s4u-comm-wait_d.xml
231 ${CMAKE_CURRENT_SOURCE_DIR}/comm-waitany/s4u-comm-waitany_d.xml
232 ${CMAKE_CURRENT_SOURCE_DIR}/comm-waitall/s4u-comm-waitall_d.xml
233 ${CMAKE_CURRENT_SOURCE_DIR}/comm-ready/s4u-comm-ready_d.xml
234 ${CMAKE_CURRENT_SOURCE_DIR}/comm-waituntil/s4u-comm-waituntil_d.xml
235 ${CMAKE_CURRENT_SOURCE_DIR}/dag-scheduling/Montage_25.xml
236 ${CMAKE_CURRENT_SOURCE_DIR}/dht-chord/s4u-dht-chord_d.xml
237 ${CMAKE_CURRENT_SOURCE_DIR}/dht-kademlia/s4u-dht-kademlia_d.xml
238 ${CMAKE_CURRENT_SOURCE_DIR}/energy-boot/platform_boot.xml
239 ${CMAKE_CURRENT_SOURCE_DIR}/io-file-remote/s4u-io-file-remote_d.xml
240 ${CMAKE_CURRENT_SOURCE_DIR}/platform-properties/s4u-platform-properties_d.xml
241 ${CMAKE_CURRENT_SOURCE_DIR}/platform-failures/s4u-platform-failures_d.xml
242 ${CMAKE_CURRENT_SOURCE_DIR}/replay-comm/s4u-replay-comm-split_d.xml
243 ${CMAKE_CURRENT_SOURCE_DIR}/replay-comm/s4u-replay-comm_d.xml
244 ${CMAKE_CURRENT_SOURCE_DIR}/replay-io/s4u-replay-io_d.xml
245 ${CMAKE_CURRENT_SOURCE_DIR}/network-ns3/3hosts_2links_d.xml
246 ${CMAKE_CURRENT_SOURCE_DIR}/network-ns3/3links-timer_d.xml
247 ${CMAKE_CURRENT_SOURCE_DIR}/network-ns3/3links_d.xml
248 ${CMAKE_CURRENT_SOURCE_DIR}/network-ns3/crosstraffic_d.xml
249 ${CMAKE_CURRENT_SOURCE_DIR}/network-ns3/dogbone_d.xml
250 ${CMAKE_CURRENT_SOURCE_DIR}/network-ns3/onelink_d.xml
251 ${CMAKE_CURRENT_SOURCE_DIR}/network-ns3/one_cluster_d.xml PARENT_SCOPE)
252 set(bin_files ${bin_files} ${CMAKE_CURRENT_SOURCE_DIR}/dht-kademlia/generate.py
253 ${CMAKE_CURRENT_SOURCE_DIR}/mc-bugged1-liveness/s4u-mc-bugged1-liveness-stack-cleaner
254 ${CMAKE_CURRENT_SOURCE_DIR}/mc-bugged1-liveness/promela_bugged1_liveness PARENT_SCOPE)
255 set(txt_files ${txt_files} ${CMAKE_CURRENT_SOURCE_DIR}/dag-from-dax/simple_dax_with_cycle.xml
256 ${CMAKE_CURRENT_SOURCE_DIR}/dag-from-dax/smalldax.xml
257 ${CMAKE_CURRENT_SOURCE_DIR}/dag-from-dot/dag.dot
258 ${CMAKE_CURRENT_SOURCE_DIR}/dag-from-dot/dag_with_cycle.dot
259 ${CMAKE_CURRENT_SOURCE_DIR}/replay-comm/s4u-replay-comm-split-p0.txt
260 ${CMAKE_CURRENT_SOURCE_DIR}/replay-comm/s4u-replay-comm-split-p1.txt
261 ${CMAKE_CURRENT_SOURCE_DIR}/replay-comm/s4u-replay-comm.txt
262 ${CMAKE_CURRENT_SOURCE_DIR}/replay-io/s4u-replay-io.txt PARENT_SCOPE)