From 01fdeeeaa47199383ca69d244df546b45f8b954c Mon Sep 17 00:00:00 2001 From: Martin Quinson Date: Mon, 13 Mar 2017 01:12:52 +0100 Subject: [PATCH] move an example from teshsuite to examples --- .gitignore | 10 +++++----- examples/msg/CMakeLists.txt | 7 ++++--- .../msg/process-join/process-join.c | 12 ++++++------ .../msg/process-join/process-join.tesh | 2 +- teshsuite/msg/CMakeLists.txt | 4 ++-- 5 files changed, 18 insertions(+), 17 deletions(-) rename teshsuite/msg/process_join/process_join.c => examples/msg/process-join/process-join.c (80%) rename teshsuite/msg/process_join/process_join.tesh => examples/msg/process-join/process-join.tesh (94%) diff --git a/.gitignore b/.gitignore index 6b2f1ccd63..feeb1ee395 100644 --- a/.gitignore +++ b/.gitignore @@ -147,7 +147,12 @@ examples/msg/io-file-unlink/io-file-unlink examples/msg/io-remote/io-remote examples/msg/io-storage/io-storage examples/msg/platform-failures/platform-failures +examples/msg/process-create/process-create examples/msg/process-kill/process-kill +examples/msg/process-join/process-join +examples/msg/process-migration/process-migration +examples/msg/process-startkilltime/process-startkilltime +examples/msg/process-suspend/process-suspend examples/msg/app-masterworker/app-masterworker examples/msg/mc/bugged1 examples/msg/mc/bugged1_liveness @@ -164,7 +169,6 @@ examples/msg/mc/test/snapshot_comparison2 examples/msg/mc/test/snapshot_comparison3 examples/msg/mc/test/snapshot_comparison4 examples/msg/mc/test/snapshot_comparison5 -examples/msg/process-migration/process-migration examples/msg/ms.trace examples/msg/network-ns3/network-ns3 examples/msg/app-pmm/app-pmm @@ -175,9 +179,6 @@ examples/msg/synchro-semaphore/synchro-semaphore examples/msg/app-pingpong/app-pingpong examples/msg/maestro-set/maestro-set examples/msg/simulation.trace -examples/msg/process-create/process-create -examples/msg/process-startkilltime/process-startkilltime -examples/msg/process-suspend/process-suspend examples/msg/app-token-ring/app-token-ring examples/msg/trace-categories/trace-categories examples/msg/trace-route-user-variables/trace-route-user-variables @@ -248,7 +249,6 @@ teshsuite/msg/host_on_off_recv/host_on_off_recv teshsuite/msg/host_on_off_wait/host_on_off_wait teshsuite/msg/listen_async/listen_async teshsuite/msg/pid/pid -teshsuite/msg/process_join/process_join teshsuite/msg/process/process teshsuite/msg/storage_client_server/storage_client_server teshsuite/msg/task_destroy_cancel/task_destroy_cancel diff --git a/examples/msg/CMakeLists.txt b/examples/msg/CMakeLists.txt index f25ab08c84..ba41822b45 100644 --- a/examples/msg/CMakeLists.txt +++ b/examples/msg/CMakeLists.txt @@ -2,7 +2,8 @@ foreach(x actions-comm actions-storage app-masterworker app-pingpong app-pmm app-token-ring async-yield async-wait async-waitall async-waitany cloud-capping cloud-masterworker cloud-migration cloud-simple cloud-two-tasks dht-chord dht-pastry energy-consumption energy-onoff energy-pstate energy-ptask energy-vm platform-failures - io-file io-remote io-storage task-priority process-create process-daemon process-kill process-migration process-suspend + io-file io-remote io-storage task-priority + process-create process-daemon process-join process-kill process-migration process-suspend platform-properties process-startkilltime synchro-semaphore trace-categories trace-route-user-variables trace-link-user-variables trace-masterworker trace-platform trace-process-migration trace-host-user-variables) @@ -96,8 +97,8 @@ set(xml_files ${xml_files} ${CMAKE_CURRENT_SOURCE_DIR}/actions-comm/actio foreach(x actions-comm actions-storage app-bittorrent app-chainsend app-masterworker app-pingpong app-token-ring async-yield async-wait async-waitall async-waitany cloud-capping cloud-masterworker cloud-migration cloud-simple cloud-two-tasks dht-chord dht-pastry dht-kademlia platform-failures io-file io-remote io-storage task-priority - process-create process-daemon process-kill process-migration process-suspend platform-properties synchro-semaphore - process-startkilltime) + process-create process-daemon process-join process-kill process-migration process-startkilltime process-suspend + platform-properties synchro-semaphore) ADD_TESH_FACTORIES(msg-${x} "thread;ucontext;raw;boost" --setenv bindir=${CMAKE_BINARY_DIR}/examples/msg/${x} --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/platforms --cd ${CMAKE_HOME_DIRECTORY}/examples/msg/${x} ${x}.tesh) endforeach() diff --git a/teshsuite/msg/process_join/process_join.c b/examples/msg/process-join/process-join.c similarity index 80% rename from teshsuite/msg/process_join/process_join.c rename to examples/msg/process-join/process-join.c index a19aa05319..282c342ca4 100644 --- a/teshsuite/msg/process_join/process_join.c +++ b/examples/msg/process-join/process-join.c @@ -8,7 +8,7 @@ XBT_LOG_NEW_DEFAULT_CATEGORY(msg_test, "Messages specific for this msg example"); -static int slave(int argc, char *argv[]) +static int slave(int argc, char* argv[]) { XBT_INFO("Slave started"); MSG_process_sleep(3); @@ -16,22 +16,22 @@ static int slave(int argc, char *argv[]) return 0; } -static int master(int argc, char *argv[]) +static int master(int argc, char* argv[]) { msg_process_t process; XBT_INFO("Start slave"); - process = MSG_process_create("slave from master", slave, NULL, MSG_host_self()); + process = MSG_process_create("slave from master", slave, NULL, MSG_host_self()); XBT_INFO("Join the slave (timeout 2)"); MSG_process_join(process, 2); XBT_INFO("Start slave"); - process = MSG_process_create("slave from master", slave, NULL, MSG_host_self()); + process = MSG_process_create("slave from master", slave, NULL, MSG_host_self()); XBT_INFO("Join the slave (timeout 4)"); MSG_process_join(process, 4); XBT_INFO("Start slave"); - process = MSG_process_create("slave from master", slave, NULL, MSG_host_self()); + process = MSG_process_create("slave from master", slave, NULL, MSG_host_self()); XBT_INFO("Join the slave (timeout 2)"); MSG_process_join(process, 2); @@ -50,7 +50,7 @@ static int master(int argc, char *argv[]) return 0; } -int main(int argc, char *argv[]) +int main(int argc, char* argv[]) { msg_error_t res; diff --git a/teshsuite/msg/process_join/process_join.tesh b/examples/msg/process-join/process-join.tesh similarity index 94% rename from teshsuite/msg/process_join/process_join.tesh rename to examples/msg/process-join/process-join.tesh index 33a956d245..5147a7973d 100644 --- a/teshsuite/msg/process_join/process_join.tesh +++ b/examples/msg/process-join/process-join.tesh @@ -1,5 +1,5 @@ -$ ./process_join$EXEEXT ${srcdir:=.}/../../../examples/platforms/small_platform.xml +$ ./process-join$EXEEXT ${srcdir:=.}/small_platform.xml > [Tremblay:master:(1) 0.000000] [msg_test/INFO] Start slave > [Tremblay:slave from master:(2) 0.000000] [msg_test/INFO] Slave started > [Tremblay:master:(1) 0.000000] [msg_test/INFO] Join the slave (timeout 2) diff --git a/teshsuite/msg/CMakeLists.txt b/teshsuite/msg/CMakeLists.txt index 989b8bd93c..ba63986a32 100644 --- a/teshsuite/msg/CMakeLists.txt +++ b/teshsuite/msg/CMakeLists.txt @@ -1,5 +1,5 @@ foreach(x concurrent_rw get_sender host_on_off host_on_off_recv host_on_off_processes host_on_off_wait listen_async pid - process process_join storage_client_server trace_integration) + process storage_client_server trace_integration) add_executable (${x} ${x}/${x}.c) target_link_libraries(${x} simgrid) set_target_properties(${x} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${x}) @@ -33,6 +33,6 @@ set(xml_files ${xml_files} ${CMAKE_CURRENT_SOURCE_DIR}/trace_integration ${CMAKE_CURRENT_SOURCE_DIR}/trace_integration/test-hbp2.5-hbp1.5.xml PARENT_SCOPE) foreach(x concurrent_rw get_sender host_on_off host_on_off_processes host_on_off_recv host_on_off_wait listen_async pid - process process_join storage_client_server task_destroy_cancel trace_integration) + process storage_client_server task_destroy_cancel trace_integration) ADD_TESH_FACTORIES(tesh-msg-${x} "thread;boost;ucontext;raw" --setenv srcdir=${CMAKE_HOME_DIRECTORY}/teshsuite/msg/${x} --cd ${CMAKE_BINARY_DIR}/teshsuite/msg/${x} ${CMAKE_HOME_DIRECTORY}/teshsuite/msg/${x}/${x}.tesh) endforeach() -- 2.20.1