Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Add test for host on off and some fixes
authorPaul Bédaride <paul.bedaride@gmail.com>
Thu, 24 Jul 2014 09:53:48 +0000 (11:53 +0200)
committerPaul Bédaride <paul.bedaride@gmail.com>
Thu, 24 Jul 2014 10:47:34 +0000 (12:47 +0200)
17 files changed:
buildtools/Cmake/AddTests.cmake
buildtools/Cmake/DefinePackages.cmake
buildtools/Cmake/MakeExe.cmake
src/msg/msg_process.c
src/simix/smx_process.c
src/surf/surf_interface.cpp
src/surf/surf_interface.hpp
src/surf/workstation_interface.cpp
teshsuite/msg/host_on_off_processes/CMakeLists.txt [new file with mode: 0644]
teshsuite/msg/host_on_off_processes/host_on_off_processes.c [new file with mode: 0644]
teshsuite/msg/host_on_off_processes/host_on_off_processes.tesh [new file with mode: 0644]
teshsuite/msg/host_on_off_processes/host_on_off_processes_d.xml [new file with mode: 0644]
teshsuite/simdag/basic/basic0.tesh
teshsuite/smpi/mpich3-test/CMakeLists.txt
teshsuite/xbt/mallocator/CMakeLists.txt [new file with mode: 0644]
teshsuite/xbt/mallocator/mallocator.tesh [new file with mode: 0644]
teshsuite/xbt/mallocator/mallocator_test.c [new file with mode: 0644]

index d2fbaac..12c7b57 100644 (file)
@@ -160,6 +160,7 @@ IF(NOT enable_memcheck)
   # BEGIN TESH TESTS
   ADD_TESH(tesh-xbt-log-large                    --setenv bindir=${CMAKE_BINARY_DIR}/teshsuite/xbt/log_large --cd ${CMAKE_HOME_DIRECTORY}/teshsuite/xbt/log_large log_large_test.tesh)
   ADD_TESH(tesh-xbt-log-parallel                 --setenv bindir=${CMAKE_BINARY_DIR}/teshsuite/xbt/parallel_log --cd ${CMAKE_HOME_DIRECTORY}/teshsuite/xbt/parallel_log parallel_log_crashtest.tesh)
+  ADD_TESH(tesh-xbt-mallocator                  --setenv bindir=${CMAKE_BINARY_DIR}/teshsuite/xbt/mallocator --cd ${CMAKE_HOME_DIRECTORY}/teshsuite/xbt/mallocator mallocator.tesh)
   IF(HAVE_MMALLOC)
     IF(${ARCH_32_BITS})
       ADD_TESH(tesh-xbt-mmalloc-32               --setenv bindir=${CMAKE_BINARY_DIR}/teshsuite/xbt/mmalloc --cd ${CMAKE_HOME_DIRECTORY}/teshsuite/xbt/mmalloc mmalloc_32.tesh)
@@ -180,6 +181,7 @@ IF(NOT enable_memcheck)
   # BEGIN TESH TESTS
   ADD_TESH_FACTORIES(tesh-msg-get-sender         "thread;ucontext;raw" --setenv srcdir=${CMAKE_HOME_DIRECTORY}/teshsuite/msg/get_sender --cd ${CMAKE_BINARY_DIR}/teshsuite/msg/get_sender ${CMAKE_HOME_DIRECTORY}/teshsuite/msg/get_sender/get_sender.tesh)
   ADD_TESH_FACTORIES(tesh-msg-host-on-off        "thread;ucontext;raw" --setenv srcdir=${CMAKE_HOME_DIRECTORY}/teshsuite/msg/host_on_off --cd ${CMAKE_BINARY_DIR}/teshsuite/msg/host_on_off ${CMAKE_HOME_DIRECTORY}/teshsuite/msg/host_on_off/host_on_off.tesh)
+  ADD_TESH_FACTORIES(tesh-msg-host-on-off-processes "thread;ucontext;raw" --setenv srcdir=${CMAKE_HOME_DIRECTORY}/teshsuite/msg/host_on_off_processes --cd ${CMAKE_BINARY_DIR}/teshsuite/msg/host_on_off_processes ${CMAKE_HOME_DIRECTORY}/teshsuite/msg/host_on_off_processes/host_on_off_processes.tesh)
   ADD_TESH_FACTORIES(tesh-msg-pid                "thread;ucontext;raw" --setenv srcdir=${CMAKE_HOME_DIRECTORY}/teshsuite/msg/pid --cd ${CMAKE_BINARY_DIR}/teshsuite/msg/pid ${CMAKE_HOME_DIRECTORY}/teshsuite/msg/pid/pid.tesh)
   ADD_TESH_FACTORIES(tesh-msg-process            "thread;ucontext;raw" --setenv srcdir=${CMAKE_HOME_DIRECTORY}/teshsuite/msg/process --cd ${CMAKE_BINARY_DIR}/teshsuite/msg/process ${CMAKE_HOME_DIRECTORY}/teshsuite/msg/process/process.tesh)
   ADD_TESH_FACTORIES(tesh-msg-process-join       "thread;ucontext;raw" --setenv srcdir=${CMAKE_HOME_DIRECTORY}/teshsuite/msg/process_join --cd ${CMAKE_BINARY_DIR}/teshsuite/msg/process_join ${CMAKE_HOME_DIRECTORY}/teshsuite/msg/process_join/process_join.tesh)
index 7baf324..59b44da 100644 (file)
@@ -1029,6 +1029,7 @@ set(TESHSUITE_CMAKEFILES_TXT
   teshsuite/msg/CMakeLists.txt
   teshsuite/msg/get_sender/CMakeLists.txt
   teshsuite/msg/host_on_off/CMakeLists.txt
+  teshsuite/msg/host_on_off_processes/CMakeLists.txt
   teshsuite/msg/pid/CMakeLists.txt
   teshsuite/msg/process/CMakeLists.txt
   teshsuite/msg/process_join/CMakeLists.txt
@@ -1099,6 +1100,7 @@ set(TESHSUITE_CMAKEFILES_TXT
   teshsuite/xbt/heap_bench/CMakeLists.txt
   teshsuite/xbt/log_large/CMakeLists.txt
   teshsuite/xbt/log_usage/CMakeLists.txt
+  teshsuite/xbt/mallocator/CMakeLists.txt
   teshsuite/xbt/mmalloc/CMakeLists.txt
   teshsuite/xbt/parallel_log/CMakeLists.txt
   teshsuite/xbt/parmap_bench/CMakeLists.txt
index 99fbd2d..60b58fb 100644 (file)
@@ -87,6 +87,7 @@ add_subdirectory(${CMAKE_HOME_DIRECTORY}/teshsuite/mc/dwarf_expression)
 add_subdirectory(${CMAKE_HOME_DIRECTORY}/teshsuite/msg)
 add_subdirectory(${CMAKE_HOME_DIRECTORY}/teshsuite/msg/get_sender)
 add_subdirectory(${CMAKE_HOME_DIRECTORY}/teshsuite/msg/host_on_off)
+add_subdirectory(${CMAKE_HOME_DIRECTORY}/teshsuite/msg/host_on_off_processes)
 add_subdirectory(${CMAKE_HOME_DIRECTORY}/teshsuite/msg/pid)
 add_subdirectory(${CMAKE_HOME_DIRECTORY}/teshsuite/msg/process)
 add_subdirectory(${CMAKE_HOME_DIRECTORY}/teshsuite/msg/process_join)
@@ -165,6 +166,7 @@ add_subdirectory(${CMAKE_HOME_DIRECTORY}/teshsuite/xbt/graphxml_usage)
 add_subdirectory(${CMAKE_HOME_DIRECTORY}/teshsuite/xbt/heap_bench)
 add_subdirectory(${CMAKE_HOME_DIRECTORY}/teshsuite/xbt/log_large)
 add_subdirectory(${CMAKE_HOME_DIRECTORY}/teshsuite/xbt/log_usage)
+add_subdirectory(${CMAKE_HOME_DIRECTORY}/teshsuite/xbt/mallocator)
 add_subdirectory(${CMAKE_HOME_DIRECTORY}/teshsuite/xbt/mmalloc)
 add_subdirectory(${CMAKE_HOME_DIRECTORY}/teshsuite/xbt/parallel_log)
 add_subdirectory(${CMAKE_HOME_DIRECTORY}/teshsuite/xbt/parmap_bench)
index a14e882..70725e7 100644 (file)
@@ -53,6 +53,7 @@ void MSG_process_cleanup_from_SIMIX(smx_process_t smx_proc)
 
   // free the MSG process
   xbt_free(msg_proc);
+  SIMIX_process_cleanup(smx_proc);
 }
 
 /* This function creates a MSG process. It has the prototype enforced by SIMIX_function_register_process_create */
index f816973..8d2320a 100644 (file)
@@ -69,7 +69,7 @@ void SIMIX_process_cleanup(smx_process_t process)
         SIMIX_comm_destroy(action);
       else
         XBT_DEBUG("Don't destroy it since it's a detached comm");
-      
+
     }
     else if (action->comm.dst_proc == process){
       XBT_DEBUG("Found an unfinished recv comm %p, state %d, src = %p, dst = %p",
index cc093ad..a20ea1b 100644 (file)
@@ -672,10 +672,12 @@ void Model::updateActionsState(double now, double delta)
 
 void Model::updateActionsStateLazy(double /*now*/, double /*delta*/)
 {
+ THROW_UNIMPLEMENTED;
 }
 
 void Model::updateActionsStateFull(double /*now*/, double /*delta*/)
 {
+  THROW_UNIMPLEMENTED;
 }
 
 /************
index eef00fb..1f0adfe 100644 (file)
@@ -279,7 +279,6 @@ public:
    * @param constraint The lmm constraint associated to this Resource if it is part of a LMM component
    */
   Resource(ModelPtr model, const char *name, xbt_dict_t props, lmm_constraint_t constraint);
-
   /**
    * @brief Resource constructor
    *
@@ -645,40 +644,6 @@ protected:
   double m_finish; /**< finish time : this is modified during the run and fluctuates until the task is completed */
 
 private:
-  int resourceUsed(void *resource_id);
-
-  /**
-   * @brief Share the resources to the actions
-   *
-   * @param now [TODO]
-   * @return In how much time the next action may terminate
-   */
-  double shareResources(double now);
-
-  /**
-   * @brief Update the current action state
-   * @details [TODO]
-   *
-   * @param now [TODO]
-   * @param delta [TODO]
-   */
-  void updateActionsState(double now, double delta);
-
-  /**
-   * @brief Update the [TODO]
-   * @details [TODO]
-   *
-   * @param id [TODO]
-   * @param event_type [TODO]
-   * @param value [TODO]
-   * @param time [TODO]
-   */
-  void updateResourceState(void *id, tmgr_trace_event_t event_type,
-                                 double value, double time);
-
-  ActionLmmListPtr p_modifiedSet;
-  xbt_heap_t p_actionHeap;
-  int m_selectiveUpdate;
   bool m_failed;
   double m_start; /**< start time  */
   char *p_category;               /**< tracing category for categorized resource utilization monitoring */
index ba424e9..a1d9d3a 100644 (file)
@@ -125,6 +125,7 @@ void Workstation::setState(e_surf_resource_state_t state){
   e_surf_resource_state_t old = Resource::getState();
   Resource::setState(state);
   surf_callback_emit(workstationStateChangedCallbacks, this, old, state);
+  p_cpu->setState(state);
 }
 
 int Workstation::getCore(){
diff --git a/teshsuite/msg/host_on_off_processes/CMakeLists.txt b/teshsuite/msg/host_on_off_processes/CMakeLists.txt
new file mode 100644 (file)
index 0000000..6109947
--- /dev/null
@@ -0,0 +1,32 @@
+cmake_minimum_required(VERSION 2.6)
+
+set(EXECUTABLE_OUTPUT_PATH "${CMAKE_CURRENT_BINARY_DIR}")
+
+add_executable(host_on_off_processes host_on_off_processes.c)
+
+### Add definitions for compile
+target_link_libraries(host_on_off_processes simgrid)
+
+set(tesh_files
+  ${tesh_files}
+  ${CMAKE_CURRENT_SOURCE_DIR}/host_on_off_processes.tesh
+  PARENT_SCOPE
+  )
+set(xml_files
+  ${xml_files}
+  ${CMAKE_CURRENT_SOURCE_DIR}/host_on_off_processes_d.xml
+  PARENT_SCOPE
+  )
+set(teshsuite_src
+  ${teshsuite_src}
+  ${CMAKE_CURRENT_SOURCE_DIR}/host_on_off_processes.c
+  PARENT_SCOPE
+  )
+set(bin_files
+  ${bin_files}
+  PARENT_SCOPE
+  )
+set(txt_files
+  ${txt_files}
+  PARENT_SCOPE
+  )
diff --git a/teshsuite/msg/host_on_off_processes/host_on_off_processes.c b/teshsuite/msg/host_on_off_processes/host_on_off_processes.c
new file mode 100644 (file)
index 0000000..13dea29
--- /dev/null
@@ -0,0 +1,209 @@
+/* Copyright (c) 2010-2014. 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 <stdio.h>
+#include "msg/msg.h"            /* Yeah! If you want to use msg, you need to include msg/msg.h */
+#include "xbt/sysdep.h"         /* calloc, printf */
+
+/* Create a log channel to have nice outputs. */
+#include "xbt/log.h"
+#include "xbt/asserts.h"
+XBT_LOG_NEW_DEFAULT_CATEGORY(msg_test,
+                             "Messages specific for this msg example");
+
+int test(int argc, char *argv[]);
+int daemon(int argc, char *argv[]);
+int commRX(int argc, char *argv[]);
+int commTX(int argc, char *argv[]);
+
+xbt_dynar_t tests;
+
+int test(int argc, char *argv[])
+{
+  int test = 0;
+  char **argvF;
+  argvF = xbt_new(char*, 2);
+  argvF[0] = xbt_strdup("daemon");
+  msg_host_t jupiter = MSG_get_host_by_name("Jupiter");
+
+  test = 1;
+  if (xbt_dynar_member(tests, &test)){
+    XBT_INFO("Test 1:");
+    XBT_INFO("  Create a process on Jupiter");
+    argvF = xbt_new(char*, 2);
+    argvF[0] = xbt_strdup("daemon");
+    MSG_process_create_with_arguments("daemon", daemon, NULL, jupiter, 1, argvF);
+    XBT_INFO("  Turn off Jupiter");
+    MSG_host_off(jupiter);
+    MSG_process_sleep(10);
+    XBT_INFO("Test 1 seems ok, cool !(number of Process : %d, it should be 1 (i.e. the Test one))", MSG_process_get_number());
+  }
+
+  test = 2;
+  if (xbt_dynar_member(tests, &test)){
+    XBT_INFO("Test 2:");
+    XBT_INFO("  Turn off Jupiter");
+    MSG_host_off(jupiter);
+    argvF = xbt_new(char*, 2);
+    argvF[0] = xbt_strdup("daemon");
+    MSG_process_create_with_arguments("daemon", daemon, NULL, jupiter, 1, argvF);
+    MSG_process_sleep(10);
+    XBT_INFO("  Test 2 does not crash, WTF ?!(number of Process : %d, it should be 1)", MSG_process_get_number());
+    XBT_INFO("  Ok so let's turn on/off the node to see whether the process is correctly bound to Jupiter");
+    MSG_host_on(jupiter);
+    XBT_INFO("  Turn off");
+    MSG_host_off(jupiter);
+    XBT_INFO("  sleep");
+    MSG_process_sleep(10);
+    XBT_INFO("number of Process : %d it should be 1. The daemon that has been created for test2 has been correctly destroyed....ok at least it looks rigorous, cool ! You just have to disallow the possibility to create a new process on a node when the node is off.)", MSG_process_get_number());
+  }
+
+  test = 3;
+  if (xbt_dynar_member(tests, &test)){
+    XBT_INFO("Test 3 (turn off src during a communication) : Create a Process/task to make a communication between Jupiter and Tremblay and turn off Jupiter during the communication");
+    MSG_host_on(jupiter);
+    MSG_process_sleep(10);
+    argvF = xbt_new(char*, 2);
+    argvF[0] = xbt_strdup("commRX");
+    MSG_process_create_with_arguments("commRX", commRX, NULL, MSG_get_host_by_name("Tremblay"), 1, argvF);
+    argvF = xbt_new(char*, 2);
+    argvF[0] = xbt_strdup("commTX");
+    MSG_process_create_with_arguments("commTX", commTX, NULL, MSG_get_host_by_name("Jupiter"), 1, argvF);
+    XBT_INFO("  number of processes: %d", MSG_process_get_number());
+    MSG_process_sleep(10);
+    XBT_INFO("  Turn Jupiter off");
+    MSG_host_off(jupiter);
+    XBT_INFO("Test 3 seems ok  (number of Process : %d, it should be 1 or 2 if RX has not been satisfied) cool, you can now turn off a node that has a process paused by a sleep call", MSG_process_get_number());
+  }
+
+  test = 4;
+  if (xbt_dynar_member(tests, &test)){
+    XBT_INFO("Test 4 (turn off dest during a communication : Create a Process/task to make a communication between Tremblay and Jupiter and turn off Jupiter during the communication");
+    MSG_host_on(jupiter);
+    MSG_process_sleep(10);
+    argvF = xbt_new(char*, 2);
+    argvF[0] = xbt_strdup("commTX");
+    MSG_process_create_with_arguments("commTX", commTX, NULL, MSG_get_host_by_name("Tremblay"), 1, argvF);
+    argvF = xbt_new(char*, 2);
+    argvF[0] = xbt_strdup("commRX");
+    MSG_process_create_with_arguments("commRX", commRX, NULL, MSG_get_host_by_name("Jupiter"), 1, argvF);
+    MSG_host_off(jupiter);
+    XBT_INFO("Test 4 seems ok, cool !(number of Process : %d, it should be 1", MSG_process_get_number());
+  }
+
+  test =5;
+  if (xbt_dynar_member(tests, &test)){
+
+  }
+
+  test = 6;
+  if (xbt_dynar_member(tests, &test)){
+
+  }
+
+  test = 7;
+  if (xbt_dynar_member(tests, &test)){
+
+  }
+
+  test = 8;
+  if (xbt_dynar_member(tests, &test)){
+
+  }
+
+  return 0;
+}
+
+int daemon(int argc, char *argv[])
+{
+  msg_task_t task = NULL;
+  task = MSG_task_create("deamon", 100*MSG_get_host_speed(MSG_host_self()), 0, NULL);
+  XBT_INFO("  Execute deamon");
+  MSG_task_execute(task);
+  XBT_INFO("  I'm done. See you!");
+  return 0;
+}
+
+int commTX(int argc, char *argv[])
+{
+  msg_task_t task = NULL;
+  char mailbox[80];
+  sprintf(mailbox, "comm");
+  XBT_INFO("  Start TX");
+  task = MSG_task_create("COMM", 0, 100000000, NULL);
+  MSG_task_isend(task, mailbox);
+  // We should wait a bit (if not the process will end before the communication, leading to an exception at the other side).
+  MSG_process_sleep(30);
+  XBT_INFO("  TX done");
+  return 0;
+}
+
+int commRX(int argc, char *argv[])
+{
+  msg_task_t task = NULL;
+  char mailbox[80];
+  sprintf(mailbox, "comm");
+  XBT_INFO("  Start RX");
+  msg_error_t error = MSG_task_receive(&(task), mailbox);
+  if (error==MSG_OK) {
+    XBT_INFO("  Receive message: %s", task->name);
+  } else if (error==MSG_HOST_FAILURE) {
+    XBT_INFO("  Receive message: HOST_FAILURE");
+  } else if (error==MSG_TRANSFER_FAILURE) {
+    XBT_INFO("  Receive message: TRANSFERT_FAILURE");
+  } else {
+    XBT_INFO("  Receive message: %d", error);
+  }
+  XBT_INFO("  RX Done");
+  return 0;
+}
+
+/** Main function */
+int main(int argc, char *argv[])
+{
+  msg_error_t res;
+  const char *platform_file;
+  const char *application_file;
+
+  MSG_init(&argc, argv);
+  if (argc != 4) {
+    printf("Usage: %s platform_file deployment_file test_number\n", argv[0]);
+    printf("example: %s msg_platform.xml msg_deployment.xml 1\n", argv[0]);
+    exit(1);
+  }
+
+  unsigned int iter;
+  char *groups;
+  xbt_dynar_t s_tests = xbt_str_split(argv[3], ",");
+  int tmp_test = 0;
+  tests = xbt_dynar_new(sizeof(int), NULL);
+  xbt_dynar_foreach(s_tests, iter, groups) {
+     sscanf(xbt_dynar_get_as(s_tests, iter, char *), "%d", &tmp_test);
+     xbt_dynar_set_as(tests, iter, int, tmp_test);
+  }
+
+  platform_file = argv[1];
+  application_file = argv[2];
+
+  /* MSG_config("workstation/model","KCCFLN05"); */
+  {                             /*  Simulation setting */
+    MSG_create_environment(platform_file);
+  }
+  {                             /*   Application deployment */
+    MSG_function_register("test", test);
+    MSG_function_register("daemon", daemon);
+
+    MSG_launch_application(application_file);
+  }
+  res = MSG_main();
+
+  XBT_INFO("Simulation time %g", MSG_get_clock());
+
+  if (res == MSG_OK)
+    return 0;
+  else
+    return 1;
+}                               /* end_of_main */
diff --git a/teshsuite/msg/host_on_off_processes/host_on_off_processes.tesh b/teshsuite/msg/host_on_off_processes/host_on_off_processes.tesh
new file mode 100644 (file)
index 0000000..c448cf4
--- /dev/null
@@ -0,0 +1,30 @@
+
+$ ./host_on_off_processes ${srcdir:=.}/../../../examples/platforms/small_platform.xml ${srcdir:=.}/host_on_off_processes_d.xml 1 --log=no_loc --log=msg.thresh:error --log=surf_maxmin.thresh:error
+> [Tremblay:test:(1) 0.000000] [msg_test/INFO] Test 1:
+> [Tremblay:test:(1) 0.000000] [msg_test/INFO]   Create a process on Jupiter
+> [Jupiter:daemon:(2) 0.000000] [msg_test/INFO]   Execute deamon
+> [Tremblay:test:(1) 0.000000] [msg_test/INFO]   Turn off Jupiter
+> [Tremblay:test:(1) 10.000000] [msg_test/INFO] Test 1 seems ok, cool !(number of Process : 1, it should be 1 (i.e. the Test one))
+> [10.000000] [msg_test/INFO] Simulation time 10
+
+$ ./host_on_off_processes ${srcdir:=.}/../../../examples/platforms/small_platform.xml ${srcdir:=.}/host_on_off_processes_d.xml 2 --log=no_loc --log=msg.thresh:error --log=surf_maxmin.thresh:error
+> [Tremblay:test:(1) 0.000000] [msg_test/INFO] Test 2:
+> [Tremblay:test:(1) 0.000000] [msg_test/INFO]   Turn off Jupiter
+> [0.000000] [simix_process/WARNING] Cannot launch process 'daemon' on failed host 'Jupiter'
+> [Tremblay:test:(1) 10.000000] [msg_test/INFO]   Test 2 does not crash, WTF ?!(number of Process : 1, it should be 1)
+> [Tremblay:test:(1) 10.000000] [msg_test/INFO]   Ok so let's turn on/off the node to see whether the process is correctly bound to Jupiter
+> [Tremblay:test:(1) 10.000000] [msg_test/INFO]   Turn off
+> [Tremblay:test:(1) 10.000000] [msg_test/INFO]   sleep
+> [Tremblay:test:(1) 20.000000] [msg_test/INFO] number of Process : 1 it should be 1. The daemon that has been created for test2 has been correctly destroyed....ok at least it looks rigorous, cool ! You just have to disallow the possibility to create a new process on a node when the node is off.)
+> [20.000000] [msg_test/INFO] Simulation time 20
+
+$ ./host_on_off_processes ${srcdir:=.}/../../../examples/platforms/small_platform.xml ${srcdir:=.}/host_on_off_processes_d.xml 3 --log=no_loc --log=msg.thresh:error --log=surf_maxmin.thresh:error
+> [Tremblay:test:(1) 0.000000] [msg_test/INFO] Test 3 (turn off src during a communication) : Create a Process/task to make a communication between Jupiter and Tremblay and turn off Jupiter during the communication
+> [Tremblay:commRX:(2) 10.000000] [msg_test/INFO]   Start RX
+> [Jupiter:commTX:(3) 10.000000] [msg_test/INFO]   Start TX
+> [Tremblay:test:(1) 10.000000] [msg_test/INFO]   number of processes: 3
+> [Tremblay:test:(1) 20.000000] [msg_test/INFO]   Turn Jupiter off
+> [Tremblay:test:(1) 20.000000] [msg_test/INFO] Test 3 seems ok  (number of Process : 2, it should be 1 or 2 if RX has not been satisfied) cool, you can now turn off a node that has a process paused by a sleep call
+> [Tremblay:commRX:(2) 20.000000] [msg_test/INFO]   Receive message: TRANSFERT_FAILURE
+> [Tremblay:commRX:(2) 20.000000] [msg_test/INFO]   RX Done
+> [20.000000] [msg_test/INFO] Simulation time 20
diff --git a/teshsuite/msg/host_on_off_processes/host_on_off_processes_d.xml b/teshsuite/msg/host_on_off_processes/host_on_off_processes_d.xml
new file mode 100644 (file)
index 0000000..5b31159
--- /dev/null
@@ -0,0 +1,8 @@
+<?xml version='1.0'?>
+<!DOCTYPE platform SYSTEM "http://simgrid.gforge.inria.fr/simgrid.dtd">
+<platform version="3">
+  <!-- The master process (with some arguments) -->
+  <process host="Tremblay" function="test">
+    <argument value="4"/>
+  </process>
+</platform>
index 004b530..aaf4bbe 100644 (file)
@@ -1,3 +1,3 @@
-$ ${bindir:=.}/basic0 basic_platform.xml "--log=root.fmt:[%10.6r]%e%m%n"
+$ ${bindir:=.}/basic0 ../../../examples/platforms/two_hosts_platform_shared.xml "--log=root.fmt:[%10.6r]%e%m%n"
 > [  0.000000] surf_workstation_model_init_ptask_L07
 > [  0.800100] Simulation time: 0.800100
index f70f1b0..0eb3631 100644 (file)
@@ -1,6 +1,6 @@
 set(tesh_files
   ${tesh_files}
-  
+
   PARENT_SCOPE
   )
 set(xml_files
@@ -13,9 +13,10 @@ set(examples_src
   )
 set(bin_files
   ${bin_files}
+  ${CMAKE_CURRENT_SOURCE_DIR}/generate_report
   PARENT_SCOPE
   )
-  
+
 #set(stdo_std_smpi
 #  ${CMAKE_CURRENT_SOURCE_DIR}/topol/cartmap.std
 #  ${CMAKE_CURRENT_SOURCE_DIR}/topol/graphtest.std
diff --git a/teshsuite/xbt/mallocator/CMakeLists.txt b/teshsuite/xbt/mallocator/CMakeLists.txt
new file mode 100644 (file)
index 0000000..7935111
--- /dev/null
@@ -0,0 +1,29 @@
+cmake_minimum_required(VERSION 2.6)
+
+set(EXECUTABLE_OUTPUT_PATH "${CMAKE_CURRENT_BINARY_DIR}")
+
+add_executable(mallocator mallocator_test.c)
+target_link_libraries(mallocator simgrid)
+
+set(tesh_files
+  ${tesh_files}
+  ${CMAKE_CURRENT_SOURCE_DIR}/mallocator.tesh
+  PARENT_SCOPE
+  )
+set(xml_files
+  ${xml_files}
+  PARENT_SCOPE
+  )
+set(teshsuite_src
+  ${teshsuite_src}
+  ${CMAKE_CURRENT_SOURCE_DIR}/mallocator_test.c
+  PARENT_SCOPE
+  )
+set(bin_files
+  ${bin_files}
+  PARENT_SCOPE
+  )
+set(txt_files
+  ${txt_files}
+  PARENT_SCOPE
+  )
diff --git a/teshsuite/xbt/mallocator/mallocator.tesh b/teshsuite/xbt/mallocator/mallocator.tesh
new file mode 100644 (file)
index 0000000..87583f1
--- /dev/null
@@ -0,0 +1,5 @@
+$ ${bindir:=.}/mallocator_test
+> Elems: (0,8) (1,16) (2,24) (3,32) (4,40) (5,48) (6,56) (7,64) (8,72) (9,80) (10,88)
+> Elems: (0,8) (1,16) (2,24) (3,32) (4,40)
+> Elems: (0,8) (1,16) (3,32) (4,40)
+> Elems: (0,8) (1,16) (3,32) (4,40) (11,24) (12,48) (13,56) (14,64) (15,72)
diff --git a/teshsuite/xbt/mallocator/mallocator_test.c b/teshsuite/xbt/mallocator/mallocator_test.c
new file mode 100644 (file)
index 0000000..58166bf
--- /dev/null
@@ -0,0 +1,72 @@
+#include "xbt/mallocator.h"
+#include "xbt.h"
+
+typedef struct element {
+  int value;
+} s_element_t;
+typedef struct element *element_t;
+
+element_t base_mallocator;
+
+static void *element_mallocator_new_f(void)
+{
+  element_t elem = xbt_new(s_element_t, 1);
+  elem->value = 0;
+  return elem;
+}
+
+static void element_mallocator_free_f(void *elem)
+{
+  xbt_free(elem);
+}
+
+#define element_mallocator_reset_f ((void_f_pvoid_t)NULL)
+
+static void pprint_elems(xbt_dynar_t elems) {
+  unsigned int iter;
+  element_t elem;
+  printf("Elems:");
+  xbt_dynar_foreach(elems, iter, elem) {
+    printf(" (%d,%ld)", elem->value, base_mallocator-elem);
+  }
+  printf("\n");
+}
+
+int main(int argc, char**argv)
+{
+  xbt_mallocator_initialization_is_done(1);
+  int i = 0;
+  xbt_mallocator_t mallocator = xbt_mallocator_new(65536,
+                                  element_mallocator_new_f,
+                                  element_mallocator_free_f,
+                                  element_mallocator_reset_f);
+  xbt_dynar_t elems = xbt_dynar_new(sizeof(element_t), NULL);
+  element_t elem = NULL;
+  base_mallocator = xbt_mallocator_get(mallocator);
+
+  for (i=0; i<=10; i++) {
+    elem = xbt_mallocator_get(mallocator);
+    elem->value = i;
+    xbt_dynar_push(elems, &elem);
+  }
+  pprint_elems(elems);
+
+  for (i=0; i<=5; i++) {
+    xbt_dynar_pop(elems, &elem);
+    xbt_mallocator_release(mallocator, elem);
+  }
+  pprint_elems(elems);
+
+  xbt_dynar_remove_at(elems, 2, &elem);
+  xbt_mallocator_release(mallocator, elem);
+  pprint_elems(elems);
+
+  for (i=11; i<=15; i++) {
+    elem = xbt_mallocator_get(mallocator);
+    elem->value = i;
+    xbt_dynar_push(elems, &elem);
+  }
+  pprint_elems(elems);
+
+  return 0;
+}