Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge branch 'master' of git+ssh://scm.gforge.inria.fr//gitroot/simgrid/simgrid
authorFrederic Suter <frederic.suter@cc.in2p3.fr>
Sun, 4 Sep 2016 15:19:17 +0000 (17:19 +0200)
committerFrederic Suter <frederic.suter@cc.in2p3.fr>
Sun, 4 Sep 2016 15:19:17 +0000 (17:19 +0200)
17 files changed:
.travis.yml
examples/msg/CMakeLists.txt
examples/msg/maestro-set/maestro-set.c [deleted file]
examples/msg/maestro-set/maestro-set.cpp [new file with mode: 0644]
examples/msg/maestro-set/maestro-set.tesh
examples/msg/maestro-set/maestro-set_d.xml [deleted file]
examples/simdag/throttling/sd_throttling.c
examples/smpi/replay/replay.tesh
src/include/surf/surf.h
src/surf/surf_interface.cpp
src/xbt/xbt_replay.cpp
tools/cmake/DefinePackages.cmake
tools/cmake/Modules/FindValgrind.cmake
tools/cmake/Tests.cmake
tools/cmake/scripts/my_valgrind.pl
tools/tesh/background.tesh
tools/tesh/tesh.py

index 7f83eac..3153027 100644 (file)
@@ -5,7 +5,7 @@
 #   apt-get libns3-dev ns3
 #
 #
-sudo: required
+#sudo: required
 dist: trusty
 language: cpp
 compiler:
@@ -43,8 +43,9 @@ addons:
 #   - cd ..
 #   - ls -lR $TRAVIS_BUILD_DIR/LuaInstall
 
-# Still need sudo for update-alternatives
 script:
+   - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew update         ; fi
+   - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install python3; fi
    - cmake -Denable_documentation=OFF -Denable_coverage=OFF -Denable_java=ON -Denable_model-checking=OFF -Denable_lua=OFF -Denable_compile_optimizations=OFF -Denable_smpi=ON -Denable_smpi_MPICH3_testsuite=OFF -Denable_compile_warnings=ON . 
    # run make in the sonar wrapper && run the tests only if the build suceeded
    - ./tools/internal/travis-sonarqube.sh make VERBOSE=1 && ctest --output-on-failure --timeout 100
index ee73989..f249cdc 100644 (file)
@@ -1,8 +1,9 @@
+# C examples
 foreach(x actions-comm actions-storage app-masterworker app-pingpong app-pmm app-token-ring 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-kill process-migration process-suspend 
-          platform-properties maestro-set process-startkilltime synchro-semaphore trace-categories 
+          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)
   add_executable       (${x}     ${x}/${x}.c)
@@ -12,6 +13,15 @@ foreach(x actions-comm actions-storage app-masterworker app-pingpong app-pmm app
   set(tesh_files   ${tesh_files}   ${CMAKE_CURRENT_SOURCE_DIR}/${x}/${x}.tesh)
 endforeach()
 
+# CPP examples
+foreach(x maestro-set)
+  add_executable       (${x}     ${x}/${x}.cpp)
+  target_link_libraries(${x}     simgrid)
+  set_target_properties(${x}  PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${x})
+  set(examples_src ${examples_src} ${CMAKE_CURRENT_SOURCE_DIR}/${x}/${x}.cpp)
+  set(tesh_files   ${tesh_files}   ${CMAKE_CURRENT_SOURCE_DIR}/${x}/${x}.tesh)
+endforeach()
+
 if(HAVE_NS3)
   add_executable       (network-ns3 network-ns3/network-ns3.c)
   target_link_libraries(network-ns3 simgrid)
@@ -40,7 +50,7 @@ foreach (file answer dht-kademlia node routing_table task)
 endforeach()
 
 foreach (file actions-comm actions-storage app-bittorrent app-chainsend app-masterworker app-pingpong async-wait
-         async-waitall async-waitany dht-chord dht-kademlia io-remote platform-properties maestro-set 
+         async-waitall async-waitany dht-chord dht-kademlia io-remote platform-properties
          task-priority)
   set(xml_files    ${xml_files}     ${CMAKE_CURRENT_SOURCE_DIR}/${file}/${file}_d.xml)
 endforeach()
diff --git a/examples/msg/maestro-set/maestro-set.c b/examples/msg/maestro-set/maestro-set.c
deleted file mode 100644 (file)
index f22c97f..0000000
+++ /dev/null
@@ -1,152 +0,0 @@
-/* Copyright (c) 2007-2015. 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 "simgrid/msg.h"
-
-/** @addtogroup MSG_examples
- *
- *  - <b>sendrecv/sendrecv.c: Ping-pong example</b>. It's hard to think of a simpler example. The tesh files laying in
- *    the directory are instructive concerning the way to pass options to the simulators (as described in \ref options).
- */
-
-XBT_LOG_NEW_DEFAULT_CATEGORY(msg_test, "Messages specific for this msg example");
-
-double task_comm_size_lat = 1;
-double task_comm_size_bw = 10e8;
-
-static int sender(int argc, char *argv[])
-{
-  msg_host_t host = NULL;
-  double time;
-  msg_task_t task_la = NULL;
-  msg_task_t task_bw = NULL;
-  char sprintf_buffer_la[64];
-  char sprintf_buffer_bw[64];
-
-  XBT_INFO("sender");
-  XBT_INFO("host = %s", argv[1]);
-
-  host = MSG_host_by_name(argv[1]);
-
-  if (host == NULL) {
-    XBT_INFO("Unknown host %s. Stopping Now! ", argv[1]);
-    abort();
-  }
-
-  /* Latency */
-  time = MSG_get_clock();
-  snprintf(sprintf_buffer_la,64, "latency task");
-  task_la = MSG_task_create(sprintf_buffer_la, 0.0, task_comm_size_lat, NULL);
-  task_la->data = xbt_new(double, 1);
-  *(double *) task_la->data = time;
-  XBT_INFO("task_la->data = %e", *((double *) task_la->data));
-  MSG_task_send(task_la, argv[1]);
-
-  /* Bandwidth */
-  time = MSG_get_clock();
-  snprintf(sprintf_buffer_bw,64, "bandwidth task");
-  task_bw = MSG_task_create(sprintf_buffer_bw, 0.0, task_comm_size_bw, NULL);
-  task_bw->data = xbt_new(double, 1);
-  *(double *) task_bw->data = time;
-  XBT_INFO("task_bw->data = %e", *((double *) task_bw->data));
-  MSG_task_send(task_bw, argv[1]);
-
-  return 0;
-}
-
-static int receiver(int argc, char *argv[])
-{
-  msg_task_t task_la = NULL;
-  msg_task_t task_bw = NULL;
-
-  XBT_INFO("receiver");
-
-  /* Get Latency */
-  int a = MSG_task_receive(&task_la,MSG_host_get_name(MSG_host_self()));
-  xbt_assert(a == MSG_OK, "Unexpected behavior");
-
-  double time1 = MSG_get_clock();
-  double sender_time = *((double *) (task_la->data));
-  double time = sender_time;
-  double communication_time = time1 - time;
-  XBT_INFO("Task received : %s", task_la->name);
-  xbt_free(task_la->data);
-  MSG_task_destroy(task_la);
-  XBT_INFO("Communic. time %e", communication_time);
-  XBT_INFO("--- la %f ----", communication_time);
-
-  /* Get Bandwidth */
-  a = MSG_task_receive(&task_bw,MSG_host_get_name(MSG_host_self()));
-  xbt_assert(a == MSG_OK, "Unexpected behavior");
-  time1 = MSG_get_clock();
-  sender_time = *((double *) (task_bw->data));
-  time = sender_time;
-  communication_time = time1 - time;
-  XBT_INFO("Task received : %s", task_bw->name);
-  xbt_free(task_bw->data);
-  MSG_task_destroy(task_bw);
-  XBT_INFO("Communic. time %e", communication_time);
-  XBT_INFO("--- bw %f ----", task_comm_size_bw / communication_time);
-
-  return 0;
-}
-
-struct application {
-  const char* platform_file;
-  const char* application_file;
-};
-
-/** Test function */
-static msg_error_t test_all(struct application* app)
-{
-  msg_error_t res = MSG_OK;
-
-  MSG_create_environment(app->platform_file);
-
-  /* Become one of the simulated process.
-   *
-   * This must be done after the creation of the platform because we are depending attaching to a host.*/
-  MSG_process_attach("sender", NULL, MSG_host_by_name("Tremblay"), NULL);
-
-  MSG_function_register("receiver", receiver);
-
-  MSG_launch_application(app->application_file);
-
-  // Execute the sender code:
-  const char* argv[3] = { "sender", "Jupiter", NULL };
-  sender(2, (char**) argv);
-
-  MSG_process_detach();
-  return res;
-}                               /* end_of_test_all */
-
-static void maestro(void* data)
-{
-  MSG_main();
-}
-
-/** Main function */
-int main(int argc, char *argv[])
-{
-  msg_error_t res = MSG_OK;
-
-  struct application app;
-  app.platform_file = argv[1];
-  app.application_file = argv[2];
-
-  SIMIX_set_maestro(maestro, &app);
-  MSG_init(&argc, argv);
-
-  if (argc != 3) {
-    XBT_CRITICAL("Usage: %s platform_file deployment_file\n", argv[0]);
-    xbt_die("example: %s msg_platform.xml msg_deployment.xml\n",argv[0]);
-  }
-
-  res = test_all(&app);
-
-  XBT_INFO("Total simulation time: %e", MSG_get_clock());
-  return res != MSG_OK;
-}
diff --git a/examples/msg/maestro-set/maestro-set.cpp b/examples/msg/maestro-set/maestro-set.cpp
new file mode 100644 (file)
index 0000000..c1ab4d2
--- /dev/null
@@ -0,0 +1,96 @@
+/* Copyright (c) 2007-2016. 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. */
+
+/** @addtogroup MSG_examples
+ *
+ *  - <b>maestro-set/maestro-set.cpp: Switch the system thread hosting our maestro</b>. 
+ *    That's a very advanced example in which we move the maestro thread to another process.
+ *    Not many users need it (maybe only one, actually), but this example is also a regression test.
+ * 
+ *    This example is in C++ because we use C++11 threads to ensure that the feature is working as
+ *    expected. You can still use that feature from a C code.
+ */
+
+#include "simgrid/msg.h"
+
+XBT_LOG_NEW_DEFAULT_CATEGORY(msg_test, "Messages specific for this msg example");
+
+#include <thread>
+
+std::thread::id root_id;
+
+static void ensure_root_tid() {
+  std::thread::id this_id = std::this_thread::get_id();
+  xbt_assert(root_id == this_id, "I was supposed to be the main thread");
+  XBT_INFO("I am the main thread, as expected");
+}
+static void ensure_other_tid() {
+  std::thread::id this_id = std::this_thread::get_id();
+  xbt_assert(this_id != root_id, "I was NOT supposed to be the main thread");
+  XBT_INFO("I am not the main thread, as expected");
+}
+
+
+
+static int sender(int argc, char *argv[])
+{
+  ensure_root_tid();
+
+  msg_task_t task_la = MSG_task_create("Some task", 0.0, 10e8, NULL);
+  MSG_task_send(task_la, "some mailbox");
+
+  return 0;
+}
+
+static int receiver(int argc, char *argv[])
+{
+  ensure_other_tid();
+
+  msg_task_t task_la = NULL;
+  xbt_assert(MSG_task_receive(&task_la,"some mailbox") == MSG_OK);
+  XBT_INFO("Task received");
+  MSG_task_destroy(task_la);
+
+  return 0;
+}
+
+static void maestro(void* data)
+{
+  ensure_other_tid();
+  MSG_process_create("receiver",&receiver,NULL,MSG_host_by_name("Jupiter"));
+  MSG_main();
+}
+
+/** Main function */
+int main(int argc, char *argv[])
+{
+  root_id = std::this_thread::get_id();
+
+  SIMIX_set_maestro(maestro, NULL);
+  MSG_init(&argc, argv);
+
+  if (argc != 2) {
+    XBT_CRITICAL("Usage: %s platform_file\n", argv[0]);
+    xbt_die("example: %s msg_platform.xml\n",argv[0]);
+  }
+
+  MSG_create_environment(argv[1]);
+
+  /* Become one of the simulated process.
+   *
+   * This must be done after the creation of the platform because we are depending attaching to a host.*/
+  MSG_process_attach("sender", NULL, MSG_host_by_name("Tremblay"), NULL);
+  ensure_root_tid();
+
+  // Execute the sender code:
+  const char* subargv[3] = { "sender", "Jupiter", NULL };
+  sender(2, (char**) subargv);
+
+  MSG_process_detach(); // Become root thread again
+  XBT_INFO("Detached");
+  ensure_root_tid();
+
+  return 0;
+}
index c5da2fa..a3914dc 100644 (file)
@@ -1,16 +1,10 @@
 #! ./tesh
 
-! output sort 19
-$ $SG_TEST_EXENV maestro-set/maestro-set$EXEEXT ${srcdir:=.}/../platforms/small_platform.xml ${srcdir:=.}/maestro-set/maestro-set_d.xml  "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
-> [  0.000000] (1:sender@Tremblay) sender
-> [  0.000000] (1:sender@Tremblay) host = Jupiter
-> [  0.000000] (1:sender@Tremblay) task_la->data = 0.000000e+00
-> [  0.000000] (2:receiver@Jupiter) receiver
-> [  0.001462] (2:receiver@Jupiter) Task received : latency task
-> [  0.001462] (2:receiver@Jupiter) Communic. time 1.461656e-03
-> [  0.001462] (2:receiver@Jupiter) --- la 0.001462 ----
-> [  0.001462] (1:sender@Tremblay) task_bw->data = 1.461656e-03
-> [138.703988] (0:maestro@) Total simulation time: 1.387040e+02
-> [138.703988] (2:receiver@Jupiter) Task received : bandwidth task
-> [138.703988] (2:receiver@Jupiter) Communic. time 1.387025e+02
-> [138.703988] (2:receiver@Jupiter) --- bw 7209674.030423 ----
+$ $SG_TEST_EXENV maestro-set/maestro-set$EXEEXT ${srcdir:=.}/../platforms/small_platform.xml "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
+> [  0.000000] (0:maestro@) I am not the main thread, as expected
+> [  0.000000] (2:receiver@Jupiter) I am not the main thread, as expected
+> [  0.000000] (1:sender@Tremblay) I am the main thread, as expected
+> [  0.000000] (1:sender@Tremblay) I am the main thread, as expected
+> [150.159342] (2:receiver@Jupiter) Task received
+> [150.159342] (0:maestro@) Detached
+> [150.159342] (0:maestro@) I am the main thread, as expected
diff --git a/examples/msg/maestro-set/maestro-set_d.xml b/examples/msg/maestro-set/maestro-set_d.xml
deleted file mode 100644 (file)
index 5b53097..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-<?xml version='1.0'?>
-<!DOCTYPE platform SYSTEM "http://simgrid.gforge.inria.fr/simgrid/simgrid.dtd">
-<platform version="4"><!-- For using with ping_pong, platform_sendrecv.xml -->
-  <process host="Jupiter" function="receiver"/>
-</platform>
index 65f2401..58b210b 100644 (file)
@@ -50,6 +50,7 @@ int main(int argc, char **argv)
       XBT_INFO("Task '%s' start time: %f, finish time: %f", SD_task_get_name(task), SD_task_get_start_time(task),
                SD_task_get_finish_time(task));
     }
+    xbt_dynar_free(&changed_tasks);
 
     /* let throttle the communication for taskD if its parent is SD_DONE */
     /* the bandwidth is 1.25e8, the data size is 1e7, and we want to throttle the bandwidth by a factor 2.
index c6169b5..0845fb2 100644 (file)
@@ -226,7 +226,7 @@ p Another test of trace replay with SMPI (one trace per process)
 < replay/actions1.txt
 $ mkfile ./split_traces_tesh
 
-$ ../../smpi_script/bin/smpirun -ext smpi_replay --log=replay.thresh:critical --log=smpi_replay.thresh:verbose --log=no_loc --cfg=smpi/simulate-computation:no -np 2 -platform ${srcdir:=.}/../platforms/small_platform.xml -hostfile ${srcdir:=.}/hostfile ./replay/smpi_replay ./split_traces_tesh --log=smpi_kernel.thres:warning
+$ ../../smpi_script/bin/smpirun -ext smpi_replay --log=smpi_replay.thresh:verbose --log=no_loc --cfg=smpi/simulate-computation:no -np 2 -platform ${srcdir:=.}/../platforms/small_platform.xml -hostfile ${srcdir:=.}/hostfile ./replay/smpi_replay ./split_traces_tesh --log=smpi_kernel.thres:warning
 > [0.000000] [xbt_cfg/INFO] Configuration change: Set 'surf/precision' to '1e-9'
 > [0.000000] [xbt_cfg/INFO] Configuration change: Set 'network/model' to 'SMPI'
 > [0.000000] [xbt_cfg/INFO] Configuration change: Set 'network/TCP-gamma' to '4194304'
index 9a7ae1a..ea2b4bd 100644 (file)
@@ -541,7 +541,6 @@ XBT_PUBLIC(void) surf_network_model_init_Constant();
  */
 XBT_PUBLIC(void) surf_network_model_init_CM02();
 
-#if HAVE_NS3
 /** \ingroup SURF_models
  *  \brief Initializes the platform with the network model NS3
  *
@@ -551,7 +550,6 @@ XBT_PUBLIC(void) surf_network_model_init_CM02();
  *  \see surf_host_model_init_NS3()
  */
 XBT_PUBLIC(void) surf_network_model_init_NS3();
-#endif
 
 /** \ingroup SURF_models
  *  \brief Initializes the platform with the network model Reno
index c9590e8..ac574f2 100644 (file)
@@ -64,9 +64,7 @@ s_surf_model_description_t surf_network_model_description[] = {
    surf_network_model_init_IB},
   {"CM02", "Legacy network analytic model (Very similar to LV08, but without corrective factors. The timings of small messages are thus poorly modeled).",
    surf_network_model_init_CM02},
-#if HAVE_NS3
   {"NS3", "Network pseudo-model using the NS3 tcp model instead of an analytic model", surf_network_model_init_NS3},
-#endif
   {"Reno",  "Model from Steven H. Low using lagrange_solve instead of lmm_solve (experts only; check the code for more info).",
    surf_network_model_init_Reno},
   {"Reno2", "Model from Steven H. Low using lagrange_solve instead of lmm_solve (experts only; check the code for more info).",
@@ -76,6 +74,20 @@ s_surf_model_description_t surf_network_model_description[] = {
   {nullptr, nullptr, nullptr}      /* this array must be nullptr terminated */
 };
 
+#if ! HAVE_SMPI
+void surf_network_model_init_SMPI() {
+  xbt_die("Please activate SMPI support in cmake to use the SMPI network model.");
+}
+void surf_network_model_init_IB() {
+  xbt_die("Please activate SMPI support in cmake to use the IB network model.");
+}
+#endif
+#if !HAVE_NS3
+void surf_network_model_init_NS3() {
+  xbt_die("Please activate NS3 support in cmake and install the dependencies to use the NS3 network model.");
+}
+#endif
+
 s_surf_model_description_t surf_cpu_model_description[] = {
   {"Cas01", "Simplistic CPU model (time=size/power).", surf_cpu_model_init_Cas01},
   {nullptr, nullptr,  nullptr}      /* this array must be nullptr terminated */
index f17014a..50f208a 100644 (file)
@@ -147,12 +147,11 @@ void _xbt_replay_action_exit()
  */
 int xbt_replay_action_runner(int argc, char *argv[])
 {
-  int i;
   if (xbt_action_fp) {              // A unique trace file
     while (true) {
       char **evt = action_get_action(argv[0]);
       if (evt == nullptr)
-        break;
+        break;
 
       char* lowername = str_tolower (evt[1]);
       action_fun function = (action_fun)xbt_dict_get(xbt_action_funs, lowername);
@@ -163,7 +162,7 @@ int xbt_replay_action_runner(int argc, char *argv[])
       catch(xbt_ex& e) {
         xbt_die("Replay error :\n %s", e.what());
       }
-      for (i=0;evt[i]!= nullptr;i++)
+      for (int i=0;evt[i]!= nullptr;i++)
         free(evt[i]);
       free(evt);
     }
index ba6c3c0..ff7d97a 100644 (file)
@@ -242,6 +242,9 @@ set(SMPI_SRC
   src/smpi/smpi_topo.cpp
   src/smpi/smpi_utils.cpp
   src/smpi/smpi_f77.cpp
+  
+  src/surf/network_smpi.cpp
+  src/surf/network_ib.cpp
   )
 
 set(XBT_SRC
@@ -315,8 +318,6 @@ set(SURF_SRC
   src/surf/network_cm02.cpp
   src/surf/network_constant.cpp
   src/surf/network_interface.cpp
-  src/surf/network_smpi.cpp
-  src/surf/network_ib.cpp
   src/surf/plugins/energy.cpp
   src/surf/PropertyHolder.cpp
   src/surf/sg_platf.cpp
index fbe10d7..4afd05b 100644 (file)
@@ -8,30 +8,24 @@ find_program(VALGRIND_EXE
   /sw
   /usr
   )
+mark_as_advanced(VALGRIND_EXE)
 
-if(VALGRIND_EXE)
-  message(STATUS "Found valgrind: ${VALGRIND_EXE}")
-  set (TESH_OPTION ${TESH_OPTION} --setenv VALGRIND_COMMAND=${CMAKE_HOME_DIRECTORY}/tools/cmake/scripts/my_valgrind.pl)
-endif()
+if(enable_memcheck)
+  if (NOT VALGRIND_EXE MATCHES "NOTFOUND")
+    execute_process(COMMAND ${VALGRIND_EXE} --version  OUTPUT_VARIABLE "VALGRIND_VERSION")
+    message(STATUS "Valgrind version: ${VALGRIND_VERSION}")
 
-if(enable_memcheck_xml)
-  SET(VALGRIND_EXTRA_COMMAND_OPTIONS "--xml=yes\ --xml-file=memcheck_test_%p.memcheck\ --child-silent-after-fork=yes")
-endif()
+    set(TESH_WRAPPER ${CMAKE_HOME_DIRECTORY}/tools/cmake/scripts/my_valgrind.pl)
+    set(TESH_WRAPPER ${TESH_WRAPPER}\ --trace-children=yes\ --trace-children-skip=/usr/bin/*,/bin/*\ --leak-check=full\ --show-reachable=yes\ --track-origins=no\ --read-var-info=no\ --num-callers=20\ --suppressions=${CMAKE_HOME_DIRECTORY}/tools/simgrid.supp\ )
+    if(enable_memcheck_xml)
+      SET(TESH_WRAPPER ${TESH_WRAPPER}\ --xml=yes\ --xml-file=memcheck_test_%p.memcheck\ --child-silent-after-fork=yes\ )
+    endif()
 
-if(VALGRIND_EXE)
-  execute_process(COMMAND ${VALGRIND_EXE} --version  OUTPUT_VARIABLE "VALGRIND_VERSION")
-  string(REGEX MATCH "[0-9]+.[0-9]+.[0-9]+" NEW_VALGRIND_VERSION "${VALGRIND_VERSION}")
-  if(NEW_VALGRIND_VERSION)
-    message(STATUS "Valgrind version: ${NEW_VALGRIND_VERSION}")
-    set (TESH_OPTION ${TESH_OPTION} --setenv "VALGRIND_OPTIONS=--trace-children=yes\ --trace-children-skip=/usr/bin/*,/bin/*\ --leak-check=full\ --show-reachable=yes\ --track-origins=no\ --read-var-info=no\ --num-callers=20\ --suppressions=${CMAKE_HOME_DIRECTORY}/tools/simgrid.supp\ ${VALGRIND_EXTRA_COMMAND_OPTIONS}" )
-    message(STATUS "Valgrind options: ${TESH_OPTION}")
+#    message(STATUS "tesh wrapper: ${TESH_WRAPPER}")
+
+    mark_as_advanced(TESH_WRAPPER)
   else()
     set(enable_memcheck false)
     message(STATUS "Error: Command valgrind not found --> enable_memcheck autoset to false.")
   endif()
-else()
-  set(enable_memcheck false)
-  message(FATAL_ERROR "Command valgrind not found --> enable_memcheck autoset to false.")
 endif()
-
-mark_as_advanced(VALGRIND_EXE)
index f15edfd..a85ee3d 100644 (file)
@@ -27,7 +27,11 @@ MACRO(ADD_TESH NAME)
   IF(WIN32)
     STRING(REPLACE "ยง" "\;" ARGT "${ARGT}")
   ENDIF()
-  ADD_TEST(${NAME} ${TESH_COMMAND} ${TESH_OPTION} ${ARGT})
+  if(TESH_WRAPPER)
+    ADD_TEST(${NAME} ${TESH_COMMAND} --wrapper "${TESH_WRAPPER}" ${TESH_OPTION} ${ARGT})
+  else()
+    ADD_TEST(${NAME} ${TESH_COMMAND} ${TESH_OPTION} ${ARGT})
+  endif()
 ENDMACRO()
 
 MACRO(ADD_TESH_FACTORIES NAME FACTORIES)
index 1b9067c..6892b52 100755 (executable)
@@ -1,7 +1,6 @@
 #!/usr/bin/env perl
 
-# Copyright (c) 2012-2014. The SimGrid Team.
-# All rights reserved.
+# Copyright (c) 2012-2016. 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.
@@ -13,7 +12,7 @@ my @argv = ("valgrind");
 my $count = 0;
 
 while (defined(my $arg = shift)) {
-    #print "arg($count)$arg\n";
+#    print "arg($count)$arg\n";
     if ($arg =~ m!/smpirun$!) {
         @argv = ( $arg, "-wrapper", "@argv" );
     } elsif ($arg eq "--cd") {
@@ -27,8 +26,8 @@ while (defined(my $arg = shift)) {
     $count++;
 }
 
-#print "COMMAND : $bin $option $cd $path\n";
-#print "cd $path\n";
-#print "valgrind --trace-children=yes --leak-check=full --show-reachable=yes --track-origins=yes --read-var-info=no $bin $option\n";
-#print "@argv\n\n";
+# print "COMMAND:";
+# map { print "$_ " } @argv;
+# print "\n";
+
 system @argv;
index 3fbabd3..6eb8602 100644 (file)
@@ -1,25 +1,23 @@
 
-$ cmake -E remove_directory temp_testdir_background
-$ mkdir temp_testdir_background
-$ cd temp_testdir_background
+$ cmake -E remove bgtesh.pl bgtesh.data
 
 < use strict; 
-< sleep(2);
-< open (FILE, "<tmp_fich") || die "Cannot open tmp_fich: $!\n";
+< sleep(1);
+< open (FILE, "<bgtesh.data") || die "Cannot open bgtesh.data: $!\n";
 < 
 < while (<FILE>) {
 <   print;
 < }
+< close(FILE);
 < exit 0;
 <
-$ mkfile delayed_cat.pl
+$ mkfile bgtesh.pl
 
-& perl delayed_cat.pl
+& perl bgtesh.pl
 > TOTO
 
 < TOTO
-$ mkfile tmp_fich
+$ mkfile bgtesh.data
 
 $ sleep 2
-$ cd ..
-$ cmake -E remove_directory temp_testdir_background
+$ cmake -E remove bgtesh.pl bgtesh.data
index c8a0d8a..7f3aca4 100755 (executable)
@@ -24,6 +24,17 @@ under the terms of the license (GNU LGPL) which comes with this package.
 # then, even better:
 # ! expect (\1 > 500)
 
+# TODO: If the output is sorted, we should report it to the users. Corresponding perl chunk
+# print "WARNING: Both the observed output and expected output were sorted as requested.\n";
+# print "WARNING: Output were only sorted using the $sort_prefix first chars.\n"
+#    if ( $sort_prefix > 0 );
+# print "WARNING: Use <! output sort 19> to sort by simulated date and process ID only.\n";
+#    
+# print "----8<---------------  Begin of unprocessed observed output (as it should appear in file):\n";
+# map {print "> $_\n"} @{$cmd{'unsorted got'}};
+# print "--------------->8----  End of the unprocessed observed output.\n";
+
+
 """
 
 
@@ -37,11 +48,8 @@ import argparse
 if sys.version_info[0] == 3:
     import subprocess
     import _thread
-elif sys.version_info[0] < 3:
-    import subprocess32 as subprocess
-    import thread as _thread
 else:
-    raise "This program has not been made to exist this long"
+    raise "This program is expected to run with Python3 only"
 
 
 
@@ -154,6 +162,7 @@ class TeshState(Singleton):
         self.threads = []
         self.args_suffix = ""
         self.ignore_regexps_common = []
+        self.wrapper = None
     
     def add_thread(self, thread):
         self.threads.append(thread)
@@ -163,9 +172,6 @@ class TeshState(Singleton):
             t.acquire()
             t.release()
 
-
-
-
 #Command line object
 class Cmd(object):
     def __init__(self):
@@ -216,6 +222,7 @@ class Cmd(object):
         if file is None:
             fatal_error("Unable to create file "+filename)
         file.write("\n".join(self.input_pipe))
+        file.write("\n")
         file.close()
 
     def _cmd_cd(self, argline):
@@ -278,10 +285,14 @@ class Cmd(object):
             if lock is not None: lock.release()
             return
         
+        if TeshState().wrapper is not None:
+            self.timeout *= 20
+            self.args = TeshState().wrapper + self.args
+            
         self.args += TeshState().args_suffix
         
         print("["+FileReader().filename+":"+str(self.linenumber)+"] "+self.args)
-        
+                
         args = shlex.split(self.args)
         #print (args)
         try:
@@ -354,12 +365,6 @@ class Cmd(object):
 
 
 
-
-
-
-
-
-
 ##############
 #
 # Main
@@ -378,6 +383,7 @@ if __name__ == '__main__':
     group1.add_argument('--cfg', metavar='arg', help='add parameter --cfg=arg to each command line')
     group1.add_argument('--log', metavar='arg', help='add parameter --log=arg to each command line')
     group1.add_argument('--enable-coverage', action='store_true', help='ignore output lines starting with "profiling:"')
+    group1.add_argument('--wrapper', metavar='arg', help='Run each command in the provided wrapper (eg valgrind)')
 
     try:
         options = parser.parse_args()
@@ -406,7 +412,9 @@ if __name__ == '__main__':
         TeshState().args_suffix += " --cfg="+options.cfg
     if options.log is not None:
         TeshState().args_suffix += " --log="+options.log
-    
+
+    if options.wrapper is not None:
+        TeshState().wrapper = options.wrapper
     
     #cmd holds the current command line
     # tech commands will add some parameters to it
@@ -497,8 +505,3 @@ if __name__ == '__main__':
         print("Test suite from stdin OK")
     else:
         print("Test suite `"+f.filename+"' OK")
-
-
-
-
-