From: navarro Date: Fri, 27 Apr 2012 09:09:35 +0000 (+0200) Subject: Add a specific test for arguments start_time and kill_time of process tag. X-Git-Tag: v3_7~58 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/1bcbbd87509050edcb2accd6ba00134f968323c3?hp=a40bbe687be041fe44c7dcf353d99da7d5a69568;ds=sidebyside Add a specific test for arguments start_time and kill_time of process tag. --- diff --git a/buildtools/Cmake/AddTests.cmake b/buildtools/Cmake/AddTests.cmake index 8adab59483..6c038b21b3 100644 --- a/buildtools/Cmake/AddTests.cmake +++ b/buildtools/Cmake/AddTests.cmake @@ -124,7 +124,8 @@ ADD_TEST(tesh-simdag-par-1 ${CMAKE_BINARY_DIR}/bin/tesh ${TESH_OPTION} --setenv ADD_TEST(tesh-simdag-par-2 ${CMAKE_BINARY_DIR}/bin/tesh ${TESH_OPTION} --setenv srcdir=${CMAKE_HOME_DIRECTORY}/teshsuite --cd ${CMAKE_BINARY_DIR}/teshsuite ${CMAKE_HOME_DIRECTORY}/teshsuite/simdag/partask/test_comp_only_par.tesh) # MSG examples -ADD_TEST(msg-file ${CMAKE_BINARY_DIR}/bin/tesh ${TESH_OPTION} --setenv bindir=${CMAKE_BINARY_DIR}/examples/msg/ --setenv srcdir=${CMAKE_HOME_DIRECTORY}/ --cd ${CMAKE_HOME_DIRECTORY}/examples/ ${CMAKE_HOME_DIRECTORY}/examples/msg/io/io.tesh) +ADD_TEST(msg-file ${CMAKE_BINARY_DIR}/bin/tesh ${TESH_OPTION} --setenv bindir=${CMAKE_BINARY_DIR}/examples/msg/ --setenv srcdir=${CMAKE_HOME_DIRECTORY}/ --cd ${CMAKE_HOME_DIRECTORY}/examples/ ${CMAKE_HOME_DIRECTORY}/examples/msg/io/io.tesh) +ADD_TEST(msg-start-kill-time ${CMAKE_BINARY_DIR}/bin/tesh ${TESH_OPTION} --setenv bindir=${CMAKE_BINARY_DIR}/examples/msg/ --setenv srcdir=${CMAKE_HOME_DIRECTORY}/ --cd ${CMAKE_HOME_DIRECTORY}/examples/ ${CMAKE_HOME_DIRECTORY}/examples/msg/start_kill_time/start_kill_time.tesh) ADD_TEST(msg-sendrecv-CLM03-thread ${CMAKE_BINARY_DIR}/bin/tesh ${TESH_OPTION} --cfg contexts/factory:thread --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/msg --cd ${CMAKE_BINARY_DIR}/examples/msg ${CMAKE_HOME_DIRECTORY}/examples/msg/sendrecv/sendrecv_CLM03.tesh) ADD_TEST(msg-sendrecv-Vegas-thread ${CMAKE_BINARY_DIR}/bin/tesh ${TESH_OPTION} --cfg contexts/factory:thread --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/msg --cd ${CMAKE_BINARY_DIR}/examples/msg ${CMAKE_HOME_DIRECTORY}/examples/msg/sendrecv/sendrecv_Vegas.tesh) diff --git a/buildtools/Cmake/MakeExe.cmake b/buildtools/Cmake/MakeExe.cmake index ae469961b7..eac15c9f35 100644 --- a/buildtools/Cmake/MakeExe.cmake +++ b/buildtools/Cmake/MakeExe.cmake @@ -57,6 +57,7 @@ add_subdirectory(${CMAKE_HOME_DIRECTORY}/examples/msg/icomms) add_subdirectory(${CMAKE_HOME_DIRECTORY}/examples/msg/chord) add_subdirectory(${CMAKE_HOME_DIRECTORY}/examples/msg/token_ring) add_subdirectory(${CMAKE_HOME_DIRECTORY}/examples/msg/pmm) +add_subdirectory(${CMAKE_HOME_DIRECTORY}/examples/msg/start_kill_time) add_subdirectory(${CMAKE_HOME_DIRECTORY}/examples/msg/io) diff --git a/examples/msg/start_kill_time/CMakeLists.txt b/examples/msg/start_kill_time/CMakeLists.txt new file mode 100644 index 0000000000..85b478cb88 --- /dev/null +++ b/examples/msg/start_kill_time/CMakeLists.txt @@ -0,0 +1,12 @@ +cmake_minimum_required(VERSION 2.6) + +set(EXECUTABLE_OUTPUT_PATH "${CMAKE_CURRENT_BINARY_DIR}") + +add_executable(sk_time "sk_time.c") + +### Add definitions for compile +if(WIN32) +target_link_libraries(sk_time simgrid ) +else(WIN32) +target_link_libraries(sk_time simgrid m ) +endif(WIN32) \ No newline at end of file diff --git a/examples/msg/start_kill_time/deployment_start.xml b/examples/msg/start_kill_time/deployment_start.xml new file mode 100644 index 0000000000..a5c56f0846 --- /dev/null +++ b/examples/msg/start_kill_time/deployment_start.xml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/examples/msg/start_kill_time/deployment_start_kill.xml b/examples/msg/start_kill_time/deployment_start_kill.xml new file mode 100644 index 0000000000..474c99d177 --- /dev/null +++ b/examples/msg/start_kill_time/deployment_start_kill.xml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/examples/msg/start_kill_time/sk_time.c b/examples/msg/start_kill_time/sk_time.c new file mode 100644 index 0000000000..090cea9149 --- /dev/null +++ b/examples/msg/start_kill_time/sk_time.c @@ -0,0 +1,71 @@ +/* Copyright (c) 2007, 2009, 2010. The SimGrid Team. + * All rights reserved. */ + +/* This program is free software; you can redistribute it and/or modify it + * under the terms of the license (GNU LGPL) which comes with this package. */ + +#include "msg/msg.h" /* Yeah! If you want to use msg, you need to include msg/msg.h */ +#include "xbt/sysdep.h" /* calloc */ + +/* Create a log channel to have nice outputs. */ +#include "xbt/log.h" +XBT_LOG_NEW_DEFAULT_CATEGORY(msg_test, + "Messages specific for this msg example"); + +/** Lazy guy function. This process suspends itself asap. */ +static int slave(int argc, char *argv[]) +{ + XBT_INFO("Hello!"); + MSG_process_sleep(10.0); + XBT_INFO("OK, goodbye now."); + return 0; +} /* end_of_lazy_guy */ + +static int master(int argc, char *argv[]) +{ + m_process_t bob = NULL; + + XBT_INFO("Hello!"); + MSG_process_sleep(10.0); + XBT_INFO("OK, goodbye now."); + return 0; +} /* end_of_dram_master */ + +/** Test function */ +static MSG_error_t test_all(const char *platform_file, + const char *application_file) +{ + MSG_error_t res = MSG_OK; + + MSG_create_environment(platform_file); + MSG_function_register("master", master); + MSG_function_register("slave", slave); + MSG_launch_application(application_file); + + res = MSG_main(); + + XBT_INFO("Simulation time %g", MSG_get_clock()); + return res; +} /* end_of_test_all */ + + +/** Main function */ +int main(int argc, char *argv[]) +{ + MSG_error_t res = MSG_OK; + + MSG_global_init(&argc, argv); + if (argc < 3) { + XBT_CRITICAL("Usage: %s platform_file deployment_file\n", argv[0]); + XBT_CRITICAL("example: %s msg_platform.xml msg_deployment_suspend.xml\n", + argv[0]); + exit(1); + } + test_all(argv[1], argv[2]); + res = MSG_clean(); + + if (res == MSG_OK) + return 0; + else + return 1; +} /* end_of_main */ diff --git a/examples/msg/start_kill_time/start_kill_time.tesh b/examples/msg/start_kill_time/start_kill_time.tesh new file mode 100644 index 0000000000..4745b6daf9 --- /dev/null +++ b/examples/msg/start_kill_time/start_kill_time.tesh @@ -0,0 +1,22 @@ +#! ./tesh + +p Test1 Process with start time + +$ $SG_TEST_EXENV ${bindir:=.}/start_kill_time/sk_time ${srcdir:=.}/examples/platforms/cluster.xml ${srcdir:=.}/examples/msg/start_kill_time/deployment_start.xml "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n" +> [ 0.000000] (1:master@c-0.me) Hello! +> [ 1.000000] (2:slave@c-1.me) Hello! +> [ 2.000000] (3:slave@c-2.me) Hello! +> [ 3.000000] (4:slave@c-3.me) Hello! +> [ 4.000000] (5:slave@c-4.me) Hello! +> [ 5.000000] (6:slave@c-5.me) Hello! +> [ 10.000000] (1:master@c-0.me) OK, goodbye now. +> [ 11.000000] (2:slave@c-1.me) OK, goodbye now. +> [ 12.000000] (3:slave@c-2.me) OK, goodbye now. +> [ 13.000000] (4:slave@c-3.me) OK, goodbye now. +> [ 14.000000] (5:slave@c-4.me) OK, goodbye now. +> [ 15.000000] (6:slave@c-5.me) OK, goodbye now. +> [ 15.000000] (0:@) Simulation time 15 + +p Test2 Process with start and kill times + +$ $SG_TEST_EXENV ${bindir:=.}/start_kill_time/sk_time ${srcdir:=.}/examples/platforms/cluster.xml ${srcdir:=.}/examples/msg/start_kill_time/deployment_start_kill.xml "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"