Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Add a specific test for arguments start_time and kill_time of process tag.
authornavarro <navarro@caraja.(none)>
Fri, 27 Apr 2012 09:09:35 +0000 (11:09 +0200)
committernavarro <navarro@caraja.(none)>
Fri, 27 Apr 2012 09:11:00 +0000 (11:11 +0200)
buildtools/Cmake/AddTests.cmake
buildtools/Cmake/MakeExe.cmake
examples/msg/start_kill_time/CMakeLists.txt [new file with mode: 0644]
examples/msg/start_kill_time/deployment_start.xml [new file with mode: 0644]
examples/msg/start_kill_time/deployment_start_kill.xml [new file with mode: 0644]
examples/msg/start_kill_time/sk_time.c [new file with mode: 0644]
examples/msg/start_kill_time/start_kill_time.tesh [new file with mode: 0644]

index 8adab59..6c038b2 100644 (file)
@@ -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(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)
 
 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)
index ae46996..eac15c9 100644 (file)
@@ -57,6 +57,7 @@ add_subdirectory(${CMAKE_HOME_DIRECTORY}/examples/msg/icomms)
 add_subdirectory(${CMAKE_HOME_DIRECTORY}/examples/msg/chord)\r
 add_subdirectory(${CMAKE_HOME_DIRECTORY}/examples/msg/token_ring)\r
 add_subdirectory(${CMAKE_HOME_DIRECTORY}/examples/msg/pmm)\r
 add_subdirectory(${CMAKE_HOME_DIRECTORY}/examples/msg/chord)\r
 add_subdirectory(${CMAKE_HOME_DIRECTORY}/examples/msg/token_ring)\r
 add_subdirectory(${CMAKE_HOME_DIRECTORY}/examples/msg/pmm)\r
+add_subdirectory(${CMAKE_HOME_DIRECTORY}/examples/msg/start_kill_time)\r
 \r
 add_subdirectory(${CMAKE_HOME_DIRECTORY}/examples/msg/io)\r
 \r
 \r
 add_subdirectory(${CMAKE_HOME_DIRECTORY}/examples/msg/io)\r
 \r
diff --git a/examples/msg/start_kill_time/CMakeLists.txt b/examples/msg/start_kill_time/CMakeLists.txt
new file mode 100644 (file)
index 0000000..85b478c
--- /dev/null
@@ -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 (file)
index 0000000..a5c56f0
--- /dev/null
@@ -0,0 +1,10 @@
+<?xml version='1.0'?>
+<!DOCTYPE platform SYSTEM "http://simgrid.gforge.inria.fr/simgrid.dtd">
+<platform version="3">
+    <process host="c-0.me" function="master"/>
+       <process host="c-1.me" function="slave" start_time="1"/>
+       <process host="c-2.me" function="slave" start_time="2"/>
+       <process host="c-3.me" function="slave" start_time="3"/>
+       <process host="c-4.me" function="slave" start_time="4"/>
+       <process host="c-5.me" function="slave" start_time="5"/>
+</platform>
\ 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 (file)
index 0000000..474c99d
--- /dev/null
@@ -0,0 +1,10 @@
+<?xml version='1.0'?>
+<!DOCTYPE platform SYSTEM "http://simgrid.gforge.inria.fr/simgrid.dtd">
+<platform version="3">
+    <process host="c-0.me" function="master"/>
+       <process host="c-1.me" function="slave" start_time="1" kill_time="10"/>
+       <process host="c-2.me" function="slave" start_time="2" kill_time="10"/>
+       <process host="c-3.me" function="slave" start_time="3" kill_time="10"/>
+       <process host="c-4.me" function="slave" start_time="4" kill_time="10"/>
+       <process host="c-5.me" function="slave" start_time="5" kill_time="10"/>
+</platform>
\ 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 (file)
index 0000000..090cea9
--- /dev/null
@@ -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 (file)
index 0000000..4745b6d
--- /dev/null
@@ -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"