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 "raw;boost;ucontext") # 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)
23 foreach (example mc-bugged1 mc-bugged2 mc-failing-assert mc-electric-fence)
24 if(NOT SIMGRID_HAVE_MC)
25 set(_${example}_disable 1)
27 set(_${example}_factories "ucontext;raw;boost")
30 set(_mc-bugged1-liveness_disable 1)
32 if(HAVE_C_STACK_CLEANER)
33 add_executable (s4u-mc-bugged1-liveness-cleaner-on EXCLUDE_FROM_ALL s4u-mc-bugged1-liveness/s4u-mc-bugged1-liveness.cpp)
34 target_link_libraries(s4u-mc-bugged1-liveness-cleaner-on simgrid)
35 set_target_properties(s4u-mc-bugged1-liveness-cleaner-on PROPERTIES COMPILE_FLAGS "-DGARBAGE_STACK -fstack-cleaner")
36 add_dependencies(tests s4u-mc-bugged1-liveness-cleaner-on)
38 add_executable (s4u-mc-bugged1-liveness-cleaner-off EXCLUDE_FROM_ALL s4u-mc-bugged1-liveness/s4u-mc-bugged1-liveness.cpp)
39 target_link_libraries(s4u-mc-bugged1-liveness-cleaner-off simgrid)
40 set_target_properties(s4u-mc-bugged1-liveness-cleaner-off PROPERTIES COMPILE_FLAGS "-DGARBAGE_STACK -fno-stack-cleaner")
41 add_dependencies(tests s4u-mc-bugged1-liveness-cleaner-off)
47 add_executable (s4u-network-ns3 EXCLUDE_FROM_ALL network-ns3/s4u-network-ns3.cpp)
48 target_link_libraries(s4u-network-ns3 simgrid)
49 set_target_properties(s4u-network-ns3 PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/network-ns3)
50 add_dependencies(tests s4u-network-ns3)
53 # Deal with each example
55 foreach (example actor-create actor-daemon actor-exiting actor-join actor-kill
56 actor-lifetime actor-migrate actor-suspend actor-yield actor-stacksize
57 app-bittorrent app-chainsend app-pingpong app-token-ring
58 async-ready async-wait async-waitany async-waitall async-waituntil
60 cloud-capping cloud-migration cloud-simple
61 dht-chord dht-kademlia
62 energy-exec energy-boot energy-link energy-vm energy-exec-ptask
64 exec-async exec-basic exec-dvfs exec-ptask exec-remote exec-waitany exec-waitfor exec-dependent
66 mc-bugged1 mc-bugged1-liveness mc-bugged2 mc-electric-fence mc-failing-assert
67 io-async io-file-system io-file-remote io-disk-raw io-dependent
68 platform-failures platform-profile platform-properties
72 synchro-barrier synchro-condition-variable synchro-mutex synchro-semaphore)
74 # Use default source file unless specified otherwise
75 if(NOT DEFINED _${example}_sources)
76 set(_${example}_sources ${example}/s4u-${example}.cpp)
79 if(NOT DEFINED _${example}_disable)
80 add_executable (s4u-${example} EXCLUDE_FROM_ALL ${_${example}_sources})
81 add_dependencies (tests s4u-${example})
82 target_link_libraries(s4u-${example} simgrid)
83 set_target_properties(s4u-${example} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${example})
85 # Use default factories unless specified otherwise
86 if(NOT DEFINED _${example}_factories)
87 set(_${example}_factories "thread;ucontext;raw;boost")
89 # message("Factories of ${example}: ${_${example}_factories}")
91 ADD_TESH_FACTORIES(s4u-${example} "${_${example}_factories}"
92 --setenv bindir=${CMAKE_CURRENT_BINARY_DIR}/${example}
93 --setenv platfdir=${CMAKE_HOME_DIRECTORY}/examples/platforms
94 --cd ${CMAKE_CURRENT_SOURCE_DIR}/${example}
95 ${CMAKE_HOME_DIRECTORY}/examples/s4u/${example}/s4u-${example}.tesh)
97 message(STATUS "Example ${example} disabled, thus not compiled.")
98 unset(_${example}_disabled)
101 set(tesh_files ${tesh_files} ${CMAKE_CURRENT_SOURCE_DIR}/${example}/s4u-${example}.tesh)
102 foreach(file ${_${example}_sources})
103 set(examples_src ${examples_src} ${CMAKE_CURRENT_SOURCE_DIR}/${file})
106 unset(_${example}_factories)
107 unset(_${example}_sources)
114 # MASTERWORKERS EXAMPLE
115 foreach(variant fun class)
116 add_executable (s4u-app-masterworkers-${variant} EXCLUDE_FROM_ALL app-masterworkers/s4u-app-masterworkers-${variant}.cpp)
117 target_link_libraries(s4u-app-masterworkers-${variant} simgrid)
118 set_target_properties(s4u-app-masterworkers-${variant} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/app-masterworkers)
119 add_dependencies(tests s4u-app-masterworkers-${variant})
121 set(examples_src ${examples_src} ${CMAKE_CURRENT_SOURCE_DIR}/app-masterworkers/s4u-app-masterworkers-${variant}.cpp)
123 set(tesh_files ${tesh_files} ${CMAKE_CURRENT_SOURCE_DIR}/app-masterworkers/s4u-app-masterworkers.tesh)
125 # Model-checking liveness
127 IF(HAVE_UCONTEXT_CONTEXTS AND SIMGRID_PROCESSOR_x86_64) # liveness model-checking works only on 64bits (for now ...)
128 ADD_TESH(s4u-mc-bugged1-liveness-ucontext --setenv bindir=${CMAKE_CURRENT_BINARY_DIR}/mc-bugged1-liveness
129 --setenv platfdir=${CMAKE_HOME_DIRECTORY}/examples/platforms
130 --cd ${CMAKE_CURRENT_SOURCE_DIR}/mc-bugged1-liveness
131 ${CMAKE_HOME_DIRECTORY}/examples/s4u/mc-bugged1-liveness/s4u-mc-bugged1-liveness.tesh)
133 ADD_TESH(s4u-mc-bugged1-liveness-visited-ucontext --setenv bindir=${CMAKE_CURRENT_BINARY_DIR}/mc-bugged1-liveness
134 --setenv platfdir=${CMAKE_HOME_DIRECTORY}/examples/platforms
135 --cd ${CMAKE_CURRENT_SOURCE_DIR}/mc-bugged1-liveness
136 ${CMAKE_HOME_DIRECTORY}/examples/s4u/mc-bugged1-liveness/s4u-mc-bugged1-liveness-visited.tesh)
137 IF(HAVE_C_STACK_CLEANER)
138 # This test checks if the stack cleaner is making a difference:
139 ADD_TEST(s4u-mc-bugged1-liveness-stack-cleaner ${CMAKE_HOME_DIRECTORY}/examples/s4u/mc-bugged1-liveness/s4u-mc-bugged1-liveness-stack-cleaner
140 ${CMAKE_HOME_DIRECTORY}/examples/s4u/mc-bugged1-liveness/
141 ${CMAKE_CURRENT_BINARY_DIR}/mc-bugged1-liveness/)
146 SET_TESTS_PROPERTIES(mc-bugged1-liveness-visited-ucontext PROPERTIES RUN_SERIAL "TRUE")
150 # The tests the parallel variant of of DHTs
152 if(CMAKE_SYSTEM_NAME STREQUAL "SunOS" AND CMAKE_SYSTEM_PROCESSOR STREQUAL "i386" AND CMAKE_SIZEOF_VOID_P EQUAL 8)
153 # Thread-local storage (TLS) is needed for parallel execution, but it doesn't
154 # play well with Ucontexts on 64bit SunOS (at least on x86_64).
155 set(parallel-factories "thread;raw;boost")
157 set(parallel-factories "thread;ucontext;raw;boost")
160 foreach(example app-bittorrent app-masterworkers
161 dht-chord dht-kademlia
163 ADD_TESH_FACTORIES(s4u-${example}-parallel "${parallel-factories}" --cfg contexts/nthreads:4 ${CONTEXTS_SYNCHRO}
164 --setenv bindir=${CMAKE_CURRENT_BINARY_DIR}/${example}
165 --setenv platfdir=${CMAKE_HOME_DIRECTORY}/examples/platforms
166 --cd ${CMAKE_CURRENT_SOURCE_DIR}/${example}
167 ${CMAKE_HOME_DIRECTORY}/examples/s4u/${example}/s4u-${example}.tesh)
172 ADD_TESH_FACTORIES(s4u-network-ns3 "thread;ucontext;raw;boost"
173 --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/s4u
174 --setenv bindir=${CMAKE_BINARY_DIR}/examples/s4u
175 --setenv platfdir=${CMAKE_HOME_DIRECTORY}/examples/platforms
176 ${CMAKE_HOME_DIRECTORY}/examples/s4u/network-ns3/s4u-network-ns3.tesh)
178 # Examples not accepting factories
179 ##################################
181 foreach (example trace-platform)
182 add_executable (s4u-${example} EXCLUDE_FROM_ALL ${example}/s4u-${example}.cpp)
183 target_link_libraries(s4u-${example} simgrid)
184 set_target_properties(s4u-${example} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${example})
185 add_dependencies(tests s4u-${example})
187 set(tesh_files ${tesh_files} ${CMAKE_CURRENT_SOURCE_DIR}/${example}/s4u-${example}.tesh)
188 set(examples_src ${examples_src} ${CMAKE_CURRENT_SOURCE_DIR}/${example}/s4u-${example}.cpp)
190 ADD_TESH(s4u-${example} --setenv bindir=${CMAKE_CURRENT_BINARY_DIR}/${example}
191 --setenv platfdir=${CMAKE_HOME_DIRECTORY}/examples/platforms
192 ${CMAKE_HOME_DIRECTORY}/examples/s4u/${example}/s4u-${example}.tesh)
195 if (NOT enable_memcheck AND NOT WIN32)
196 ADD_TESH(simix-breakpoint --setenv bindir=${CMAKE_CURRENT_BINARY_DIR}/app-pingpong
197 --setenv platfdir=${CMAKE_HOME_DIRECTORY}/examples/platforms
198 ${CMAKE_CURRENT_SOURCE_DIR}/app-pingpong/simix-breakpoint.tesh)
201 # Add all extra files to the archive
202 ####################################
204 set(examples_src ${examples_src} ${CMAKE_CURRENT_SOURCE_DIR}/network-ns3/s4u-network-ns3.cpp PARENT_SCOPE)
205 set(tesh_files ${tesh_files} ${CMAKE_CURRENT_SOURCE_DIR}/app-pingpong/simix-breakpoint.tesh
206 ${CMAKE_CURRENT_SOURCE_DIR}/mc-bugged1-liveness/s4u-mc-bugged1-liveness-visited.tesh
207 ${CMAKE_CURRENT_SOURCE_DIR}/network-ns3/s4u-network-ns3.tesh PARENT_SCOPE)
208 set(xml_files ${xml_files} ${CMAKE_CURRENT_SOURCE_DIR}/actor-create/s4u-actor-create_d.xml
209 ${CMAKE_CURRENT_SOURCE_DIR}/actor-lifetime/s4u-actor-lifetime_d.xml
210 ${CMAKE_CURRENT_SOURCE_DIR}/actor-yield/s4u-actor-yield_d.xml
211 ${CMAKE_CURRENT_SOURCE_DIR}/app-bittorrent/s4u-app-bittorrent_d.xml
212 ${CMAKE_CURRENT_SOURCE_DIR}/app-masterworkers/s4u-app-masterworkers_d.xml
213 ${CMAKE_CURRENT_SOURCE_DIR}/async-wait/s4u-async-wait_d.xml
214 ${CMAKE_CURRENT_SOURCE_DIR}/async-waitany/s4u-async-waitany_d.xml
215 ${CMAKE_CURRENT_SOURCE_DIR}/async-waitall/s4u-async-waitall_d.xml
216 ${CMAKE_CURRENT_SOURCE_DIR}/async-ready/s4u-async-ready_d.xml
217 ${CMAKE_CURRENT_SOURCE_DIR}/async-waituntil/s4u-async-waituntil_d.xml
218 ${CMAKE_CURRENT_SOURCE_DIR}/dht-chord/s4u-dht-chord_d.xml
219 ${CMAKE_CURRENT_SOURCE_DIR}/dht-kademlia/s4u-dht-kademlia_d.xml
220 ${CMAKE_CURRENT_SOURCE_DIR}/energy-boot/platform_boot.xml
221 ${CMAKE_CURRENT_SOURCE_DIR}/io-file-remote/s4u-io-file-remote_d.xml
222 ${CMAKE_CURRENT_SOURCE_DIR}/platform-properties/s4u-platform-properties_d.xml
223 ${CMAKE_CURRENT_SOURCE_DIR}/platform-failures/s4u-platform-failures_d.xml
224 ${CMAKE_CURRENT_SOURCE_DIR}/replay-comm/s4u-replay-comm-split_d.xml
225 ${CMAKE_CURRENT_SOURCE_DIR}/replay-comm/s4u-replay-comm_d.xml
226 ${CMAKE_CURRENT_SOURCE_DIR}/replay-io/s4u-replay-io_d.xml
227 ${CMAKE_CURRENT_SOURCE_DIR}/network-ns3/3hosts_2links_d.xml
228 ${CMAKE_CURRENT_SOURCE_DIR}/network-ns3/3links-timer_d.xml
229 ${CMAKE_CURRENT_SOURCE_DIR}/network-ns3/3links_d.xml
230 ${CMAKE_CURRENT_SOURCE_DIR}/network-ns3/crosstraffic_d.xml
231 ${CMAKE_CURRENT_SOURCE_DIR}/network-ns3/dogbone_d.xml
232 ${CMAKE_CURRENT_SOURCE_DIR}/network-ns3/onelink_d.xml
233 ${CMAKE_CURRENT_SOURCE_DIR}/network-ns3/one_cluster_d.xml PARENT_SCOPE)
234 set(bin_files ${bin_files} ${CMAKE_CURRENT_SOURCE_DIR}/dht-kademlia/generate.py
235 ${CMAKE_CURRENT_SOURCE_DIR}/mc-bugged1-liveness/s4u-mc-bugged1-liveness-stack-cleaner
236 ${CMAKE_CURRENT_SOURCE_DIR}/mc-bugged1-liveness/promela_bugged1_liveness PARENT_SCOPE)
237 set(txt_files ${txt_files} ${CMAKE_CURRENT_SOURCE_DIR}/replay-comm/s4u-replay-comm-split-p0.txt
238 ${CMAKE_CURRENT_SOURCE_DIR}/replay-comm/s4u-replay-comm-split-p1.txt
239 ${CMAKE_CURRENT_SOURCE_DIR}/replay-comm/s4u-replay-comm.txt
240 ${CMAKE_CURRENT_SOURCE_DIR}/replay-io/s4u-replay-io.txt PARENT_SCOPE)