From: Martin Quinson Date: Wed, 29 Nov 2017 15:48:52 +0000 (+0100) Subject: move the MSG process-kill example to teshsuite X-Git-Tag: v3.18~207^2~2 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/091fbe9c7883aeec04fdd7b10ec01c43b7402936 move the MSG process-kill example to teshsuite --- diff --git a/examples/msg/CMakeLists.txt b/examples/msg/CMakeLists.txt index d55fb5c7ea..0c6fa92ef6 100644 --- a/examples/msg/CMakeLists.txt +++ b/examples/msg/CMakeLists.txt @@ -4,7 +4,7 @@ foreach(x app-masterworker app-pingpong app-token-ring async-wait async-waitall dht-pastry energy-consumption energy-onoff energy-pstate energy-ptask energy-vm platform-failures io-file io-remote io-storage task-priority plugin-hostload - process-create process-daemon process-join process-kill process-migration process-suspend + process-create process-daemon process-join 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) @@ -83,7 +83,7 @@ set(xml_files ${xml_files} ${CMAKE_CURRENT_SOURCE_DIR}/app-masterworker/a foreach(x app-chainsend app-masterworker app-pingpong app-token-ring async-wait async-waitall async-waitany cloud-capping cloud-masterworker cloud-migration cloud-simple cloud-two-tasks dht-pastry dht-kademlia platform-failures io-file io-remote io-storage task-priority - process-create process-daemon process-join process-kill process-migration process-startkilltime process-suspend + process-create process-daemon process-join 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/examples/msg/README.doc b/examples/msg/README.doc index 42597dd873..17aeb0a8d5 100644 --- a/examples/msg/README.doc +++ b/examples/msg/README.doc @@ -76,9 +76,6 @@ shipped in the archive: Processes can be suspended and resumed during their executions thanks to the @ref MSG_process_suspend and @ref MSG_process_resume functions. - - Kill processes. - @ref examples/msg/process-kill/process-kill.c \n - Processes can forcefully stop other processes with the @ref MSG_process_kill function. - Migrating processes. @ref examples/msg/process-migration/process-migration.c \n @@ -232,7 +229,6 @@ top of the example file). @example examples/msg/process-create/process-create.c @example examples/msg/process-suspend/process-suspend.c -@example examples/msg/process-kill/process-kill.c @example examples/msg/process-migration/process-migration.c @example examples/msg/process-startkilltime/process-startkilltime.c diff --git a/teshsuite/msg/CMakeLists.txt b/teshsuite/msg/CMakeLists.txt index c52f14fa86..6ac011fb71 100644 --- a/teshsuite/msg/CMakeLists.txt +++ b/teshsuite/msg/CMakeLists.txt @@ -1,6 +1,6 @@ # C examples foreach(x actions-comm actions-storage cloud-sharing get_sender host_on_off host_on_off_recv host_on_off_processes - process-yield + process-kill process-yield trace_integration) add_executable (${x} ${x}/${x}.c) target_link_libraries(${x} simgrid) @@ -39,7 +39,8 @@ set(xml_files ${xml_files} ${CMAKE_CURRENT_SOURCE_DIR}/actions-comm/acti ${CMAKE_CURRENT_SOURCE_DIR}/actions-comm/actions-comm_split_d.xml ${CMAKE_CURRENT_SOURCE_DIR}/actions-storage/actions-storage_d.xml ${CMAKE_CURRENT_SOURCE_DIR}/app-bittorrent/app-bittorrent_d.xml - ${CMAKE_CURRENT_SOURCE_DIR}/process-yield/process-yield_d.xml + ${CMAKE_CURRENT_SOURCE_DIR}/process-kill/process-kill_d.xml + ${CMAKE_CURRENT_SOURCE_DIR}/process-yield/process-yield_d.xml ${CMAKE_CURRENT_SOURCE_DIR}/trace_integration/test-hbp1.0-hbp1.0-hbp1.0.xml ${CMAKE_CURRENT_SOURCE_DIR}/trace_integration/test-hbp1.0-hbp3.0-hbp4.0.xml ${CMAKE_CURRENT_SOURCE_DIR}/trace_integration/test-hbp1.5-hbp1.5.xml @@ -55,7 +56,7 @@ set(xml_files ${xml_files} ${CMAKE_CURRENT_SOURCE_DIR}/actions-comm/acti foreach(x get_sender host_on_off host_on_off_processes host_on_off_recv task_destroy_cancel task_listen_from task_progress - process-yield + process-kill process-yield trace_integration) ADD_TESH_FACTORIES(tesh-msg-${x} "thread;ucontext;raw;boost" --setenv srcdir=${CMAKE_HOME_DIRECTORY}/teshsuite/msg/${x} --cd ${CMAKE_BINARY_DIR}/teshsuite/msg/${x} ${CMAKE_HOME_DIRECTORY}/teshsuite/msg/${x}/${x}.tesh) endforeach() diff --git a/examples/msg/process-kill/process-kill.c b/teshsuite/msg/process-kill/process-kill.c similarity index 87% rename from examples/msg/process-kill/process-kill.c rename to teshsuite/msg/process-kill/process-kill.c index 657c5ccf89..37ee439037 100644 --- a/examples/msg/process-kill/process-kill.c +++ b/teshsuite/msg/process-kill/process-kill.c @@ -14,7 +14,7 @@ static int victimA_fun(int argc, char* argv[]) MSG_process_suspend(MSG_process_self()); /* - First suspend itself */ XBT_INFO("OK, OK. Let's work"); /* - Then is resumed and start to execute a task */ MSG_task_execute(MSG_task_create("work", 1e9, 0, NULL)); - XBT_INFO("Bye!"); /* - But will never reach the end of it */ + XBT_INFO("Bye!"); /* - But will never reach the end of it */ return 0; } @@ -24,9 +24,9 @@ static int victimB_fun(int argc, char* argv[]) return 0; } -static int killer(int argc, char *argv[]) +static int killer(int argc, char* argv[]) { - XBT_INFO("Hello!"); /* - First start a victim process */ + XBT_INFO("Hello!"); /* - First start a victim process */ msg_process_t victimA = MSG_process_create("victim A", victimA_fun, NULL, MSG_host_by_name("Fafard")); msg_process_t victimB = MSG_process_create("victim B", victimB_fun, NULL, MSG_host_by_name("Bourassa")); MSG_process_sleep(10.0); @@ -47,12 +47,12 @@ static int killer(int argc, char *argv[]) return 0; } -int main(int argc, char *argv[]) +int main(int argc, char* argv[]) { MSG_init(&argc, argv); xbt_assert(argc == 2, "Usage: %s platform_file\n\tExample: %s msg_platform.xml\n", argv[0], argv[0]); - MSG_create_environment(argv[1]); /* - Load the platform description */ + MSG_create_environment(argv[1]); /* - Load the platform description */ /* - Create and deploy killer process, that will create the victim process */ MSG_process_create("killer", killer, NULL, MSG_host_by_name("Tremblay")); diff --git a/examples/msg/process-kill/process-kill.tesh b/teshsuite/msg/process-kill/process-kill.tesh similarity index 78% rename from examples/msg/process-kill/process-kill.tesh rename to teshsuite/msg/process-kill/process-kill.tesh index c0aa6d855b..6c008e5715 100644 --- a/examples/msg/process-kill/process-kill.tesh +++ b/teshsuite/msg/process-kill/process-kill.tesh @@ -2,7 +2,7 @@ p Testing a MSG_process_kill function -$ $SG_TEST_EXENV ${bindir:=.}/process-kill ${srcdir:=.}/small_platform.xml "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n" +$ $SG_TEST_EXENV ${bindir:=.}/process-kill ${srcdir:=.}/../../../examples/platforms/small_platform.xml "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n" > [ 0.000000] (1:killer@Tremblay) Hello! > [ 0.000000] (2:victim A@Fafard) Hello! > [ 0.000000] (2:victim A@Fafard) Suspending myself