Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge branch 'master' of https://framagit.org/simgrid/simgrid
authorFrederic Suter <frederic.suter@cc.in2p3.fr>
Thu, 14 Mar 2019 15:57:45 +0000 (16:57 +0100)
committerFrederic Suter <frederic.suter@cc.in2p3.fr>
Thu, 14 Mar 2019 15:57:45 +0000 (16:57 +0100)
15 files changed:
examples/deprecated/msg/mc/CMakeLists.txt
examples/deprecated/msg/mc/bugged1_liveness_visited.tesh
include/simgrid/kernel/resource/Resource.hpp
include/simgrid/simix.hpp
include/xbt/functional.hpp
src/kernel/lmm/lagrange.cpp
src/kernel/lmm/maxmin.hpp
src/kernel/resource/Resource.cpp
src/mc/mc_request.cpp
src/simix/smx_global.cpp
teshsuite/lua/CMakeLists.txt [new file with mode: 0644]
teshsuite/smpi/mpich3-test/CMakeLists.txt
teshsuite/surf/lmm_usage/lmm_usage.cpp
tools/cmake/DefinePackages.cmake
tools/cmake/Tests.cmake

index c97451b..c9cc7ed 100644 (file)
@@ -20,6 +20,23 @@ if(SIMGRID_HAVE_MC)
     set_target_properties(bugged1_liveness_cleaner_off PROPERTIES COMPILE_FLAGS "-DGARBAGE_STACK -fno-stack-cleaner")
     add_dependencies(tests bugged1_liveness_cleaner_off)
   endif()
+
+  ADD_TESH_FACTORIES(mc-bugged1                "ucontext;raw" --setenv bindir=${CMAKE_BINARY_DIR}/examples/deprecated/msg/mc --cd ${CMAKE_HOME_DIRECTORY}/examples/deprecated/msg/mc bugged1.tesh)
+  ADD_TESH_FACTORIES(mc-bugged2                "ucontext;raw" --setenv bindir=${CMAKE_BINARY_DIR}/examples/deprecated/msg/mc --cd ${CMAKE_HOME_DIRECTORY}/examples/deprecated/msg/mc bugged2.tesh)
+  IF(HAVE_UCONTEXT_CONTEXTS AND SIMGRID_PROCESSOR_x86_64) # liveness model-checking works only on 64bits (for now ...)
+    ADD_TESH(mc-bugged1-liveness-ucontext         --setenv bindir=${CMAKE_BINARY_DIR}/examples/deprecated/msg/mc --cd ${CMAKE_HOME_DIRECTORY}/examples/deprecated/msg/mc bugged1_liveness.tesh)
+    ADD_TESH(mc-bugged1-liveness-ucontext-sparse  --setenv bindir=${CMAKE_BINARY_DIR}/examples/deprecated/msg/mc --cd ${CMAKE_HOME_DIRECTORY}/examples/deprecated/msg/mc bugged1_liveness_sparse.tesh)
+    ADD_TESH(mc-bugged1-liveness-visited-ucontext --setenv bindir=${CMAKE_BINARY_DIR}/examples/deprecated/msg/mc --cd ${CMAKE_HOME_DIRECTORY}/examples/deprecated/msg/mc bugged1_liveness_visited.tesh)
+    ADD_TESH(mc-bugged1-liveness-visited-ucontext-sparse --setenv bindir=${CMAKE_BINARY_DIR}/examples/deprecated/msg/mc --cd ${CMAKE_HOME_DIRECTORY}/examples/deprecated/msg/mc bugged1_liveness_visited_sparse.tesh)
+    IF(HAVE_C_STACK_CLEANER)
+      # This test checks if the stack cleaner is making a difference:
+      ADD_TEST(mc-bugged1-liveness-stack-cleaner ${CMAKE_HOME_DIRECTORY}/examples/deprecated/msg/mc/bugged1_liveness_stack_cleaner ${CMAKE_HOME_DIRECTORY}/examples/deprecated/msg/mc/ ${CMAKE_BINARY_DIR}/examples/deprecated/msg/mc/)
+    ENDIF()
+  ENDIF()
+
+  if (enable_coverage)
+    SET_TESTS_PROPERTIES(mc-bugged1-liveness-visited-ucontext PROPERTIES RUN_SERIAL "TRUE")
+  endif()
 endif()
 
 set(tesh_files   ${tesh_files}    ${CMAKE_CURRENT_SOURCE_DIR}/bugged1.tesh
index 971ad4c..f8c4584 100644 (file)
@@ -1,7 +1,7 @@
 #!/usr/bin/env tesh
 
 ! expect return 2
-! timeout 20
+! timeout 30
 ! output ignore
 $ ${bindir:=.}/../../../../bin/simgrid-mc ${bindir:=.}/bugged1_liveness ${srcdir:=.}/../../../platforms/small_platform.xml ${srcdir:=.}/deploy_bugged1_liveness_visited.xml --log=xbt_cfg.thresh:warning "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n" --cfg=contexts/factory:ucontext --cfg=model-check/visited:100 --cfg=contexts/stack-size:256  --cfg=model-check/property:promela_bugged1_liveness
 > [  0.000000] (0:maestro@) Check the liveness property promela_bugged1_liveness
index 2ab078f..ebab496 100644 (file)
@@ -30,19 +30,22 @@ public:
    * @param name The name of the Resource
    * @param constraint The lmm constraint associated to this Resource if it is part of a LMM component
    */
-  Resource(Model* model, const std::string& name, lmm::Constraint* constraint);
+  Resource(Model* model, const std::string& name, lmm::Constraint* constraint)
+      : name_(name), model_(model), constraint_(constraint)
+  {
+  }
 
   virtual ~Resource();
 
   /** @brief Get the Model of the current Resource */
-  Model* get_model() const;
+  Model* get_model() const { return model_; }
 
   /** @brief Get the name of the current Resource */
-  const std::string& get_name() const;
+  const std::string& get_name() const { return name_; }
   /** @brief Get the name of the current Resource */
-  const char* get_cname() const;
+  const char* get_cname() const { return name_.c_str(); }
 
-  bool operator==(const Resource& other) const;
+  bool operator==(const Resource& other) const { return name_ == other.name_; }
 
   /** @brief Apply an event of external load event to that resource */
   virtual void apply_event(profile::Event* event, double value) = 0;
@@ -53,16 +56,16 @@ public:
   /** @brief returns the current load due to activities (in flops per second, byte per second or similar)
    *
    * The load due to external usages modeled by profile files is ignored.*/
-  virtual double get_load();
+  virtual double get_load() const;
 
   /** @brief Check if the current Resource is active */
-  virtual bool is_on() const;
+  virtual bool is_on() const { return is_on_; }
   /** @brief Check if the current Resource is shut down */
-  XBT_ATTRIB_DEPRECATED_v325("Please use !is_on()") virtual bool is_off() const;
+  XBT_ATTRIB_DEPRECATED_v325("Please use !is_on()") virtual bool is_off() const { return not is_on_; }
   /** @brief Turn on the current Resource */
-  virtual void turn_on();
+  virtual void turn_on() { is_on_ = true; }
   /** @brief Turn off the current Resource */
-  virtual void turn_off();
+  virtual void turn_off() { is_on_ = false; }
   /** @brief setup the profile file with states events (ON or OFF). The profile must contain boolean values. */
   virtual void set_state_profile(profile::Profile* profile);
 
@@ -78,7 +81,7 @@ private:
 
 public: /* LMM */
   /** @brief Get the lmm constraint associated to this Resource if it is part of a LMM component (or null if none) */
-  lmm::Constraint* get_constraint() const;
+  lmm::Constraint* get_constraint() const { return constraint_; }
 
 private:
   kernel::lmm::Constraint* const constraint_;
index aa52f47..9b48080 100644 (file)
@@ -86,7 +86,7 @@ class Timer {
 public:
   decltype(simix_timers)::handle_type handle_;
 
-  Timer(double date, simgrid::xbt::Task<void()> callback) : date(date), callback(std::move(callback)) {}
+  Timer(double date, simgrid::xbt::Task<void()>&& callback) : date(date), callback(std::move(callback)) {}
 
   simgrid::xbt::Task<void()> callback;
   double get_date() { return date; }
@@ -97,13 +97,19 @@ public:
     return set(date, simgrid::xbt::Task<void()>(std::move(callback)));
   }
 
-  template <class R, class T> static inline Timer* set(double date, R (*callback)(T*), T* arg)
+  template <class R, class T>
+  XBT_ATTRIB_DEPRECATED_v325("Please use a lambda or std::bind") static inline Timer* set(double date,
+                                                                                          R (*callback)(T*), T* arg)
   {
-    return set(date, [callback, arg]() { callback(arg); });
+    return set(date, std::bind(callback, arg));
   }
 
-  static Timer* set(double date, void (*callback)(void*), void* arg);
-  static Timer* set(double date, simgrid::xbt::Task<void()> callback);
+  XBT_ATTRIB_DEPRECATED_v325("Please use a lambda or std::bind") static Timer* set(double date, void (*callback)(void*),
+                                                                                   void* arg)
+  {
+    return set(date, std::bind(callback, arg));
+  }
+  static Timer* set(double date, simgrid::xbt::Task<void()>&& callback);
   static double next() { return simix_timers.empty() ? -1.0 : simix_timers.top().first; }
 };
 
@@ -114,7 +120,7 @@ XBT_PUBLIC smx_actor_t simcall_process_create(const std::string& name, const sim
                                               void* data, sg_host_t host,
                                               std::unordered_map<std::string, std::string>* properties);
 
-XBT_PUBLIC smx_timer_t SIMIX_timer_set(double date, simgrid::xbt::Task<void()> callback);
-
+XBT_ATTRIB_DEPRECATED_v325("Please use simgrid::xbt::Timer::set") XBT_PUBLIC smx_timer_t
+    SIMIX_timer_set(double date, simgrid::xbt::Task<void()>&& callback);
 
 #endif
index 608d372..9ca66f8 100644 (file)
@@ -175,7 +175,8 @@ public:
     vtable_ = that.vtable_;
     that.vtable_ = nullptr;
   }
-  Task& operator=(Task that)
+  Task& operator=(Task const& that) = delete;
+  Task& operator=(Task&& that)
   {
     this->clear();
     if (that.vtable_ && that.vtable_->move)
index 9df8fb4..fdab111 100644 (file)
@@ -207,7 +207,7 @@ void Lagrange::lagrange_solve()
     /* Improve the value of lambda_i */
     for (Constraint& cnst : active_constraint_set) {
       XBT_DEBUG("Working on cnst (%p)", &cnst);
-      cnst.new_lambda = dichotomy(cnst.lambda, partial_diff_lambda, cnst, dichotomy_min_error);
+      cnst.new_lambda = dichotomy(cnst.lambda, cnst, dichotomy_min_error);
       XBT_DEBUG("Updating lambda : cnst->lambda (%p) : %1.20f -> %1.20f", &cnst, cnst.lambda, cnst.new_lambda);
       cnst.lambda = cnst.new_lambda;
 
@@ -264,8 +264,7 @@ void Lagrange::lagrange_solve()
  *
  * @return a double corresponding to the result of the dichotomy process
  */
-double Lagrange::dichotomy(double init, double diff(double, const Constraint&), const Constraint& cnst,
-                           double min_error)
+double Lagrange::dichotomy(double init, const Constraint& cnst, double min_error)
 {
   double min = init;
   double max = init;
@@ -283,15 +282,15 @@ double Lagrange::dichotomy(double init, double diff(double, const Constraint&),
 
   overall_error = 1;
 
-  diff_0 = diff(1e-16, cnst);
+  diff_0 = partial_diff_lambda(1e-16, cnst);
   if (diff_0 >= 0) {
     XBT_CDEBUG(surf_lagrange_dichotomy, "returning 0.0 (diff = %e)", diff_0);
     XBT_OUT();
     return 0.0;
   }
 
-  double min_diff = diff(min, cnst);
-  double max_diff = diff(max, cnst);
+  double min_diff = partial_diff_lambda(min, cnst);
+  double max_diff = partial_diff_lambda(max, cnst);
 
   while (overall_error > min_error) {
     XBT_CDEBUG(surf_lagrange_dichotomy, "[min, max] = [%1.20f, %1.20f] || diffmin, diffmax = %1.20f, %1.20f", min, max,
@@ -301,7 +300,7 @@ double Lagrange::dichotomy(double init, double diff(double, const Constraint&),
       if (min == max) {
         XBT_CDEBUG(surf_lagrange_dichotomy, "Decreasing min");
         min      = min / 2.0;
-        min_diff = diff(min, cnst);
+        min_diff = partial_diff_lambda(min, cnst);
       } else {
         XBT_CDEBUG(surf_lagrange_dichotomy, "Decreasing max");
         max      = min;
@@ -311,7 +310,7 @@ double Lagrange::dichotomy(double init, double diff(double, const Constraint&),
       if (min == max) {
         XBT_CDEBUG(surf_lagrange_dichotomy, "Increasing max");
         max      = max * 2.0;
-        max_diff = diff(max, cnst);
+        max_diff = partial_diff_lambda(max, cnst);
       } else {
         XBT_CDEBUG(surf_lagrange_dichotomy, "Increasing min");
         min      = max;
@@ -328,7 +327,7 @@ double Lagrange::dichotomy(double init, double diff(double, const Constraint&),
                   min, max - min, min_diff, max_diff);
         break;
       }
-      middle_diff = diff(middle, cnst);
+      middle_diff = partial_diff_lambda(middle, cnst);
 
       if (middle_diff < 0) {
         XBT_CDEBUG(surf_lagrange_dichotomy, "Increasing min");
index 1e3b0d3..123169d 100644 (file)
@@ -633,8 +633,7 @@ private:
    * Local prototypes to implement the Lagrangian optimization with optimal step, also called dichotomy.
    */
   // computes the value of the dichotomy using a initial values, init, with a specific variable or constraint
-  static double dichotomy(double init, double diff(double, const Constraint&), const Constraint& cnst,
-                          double min_error);
+  static double dichotomy(double init, const Constraint& cnst, double min_error);
   // computes the value of the differential of constraint cnst applied to lambda
   static double partial_diff_lambda(double lambda, const Constraint& cnst);
 
index 28d84cf..16851b2 100644 (file)
@@ -12,69 +12,19 @@ namespace simgrid {
 namespace kernel {
 namespace resource {
 
-Resource::Resource(Model* model, const std::string& name, lmm::Constraint* constraint)
-    : name_(name), model_(model), constraint_(constraint)
-{
-}
-
 Resource::~Resource() = default;
 
-bool Resource::is_on() const
-{
-  return is_on_;
-}
-bool Resource::is_off() const // deprecated
-{
-  return not is_on_;
-}
-
-void Resource::turn_on()
-{
-  is_on_ = true;
-}
-
-void Resource::turn_off()
-{
-  is_on_ = false;
-}
-
-double Resource::get_load()
+double Resource::get_load() const
 {
   return constraint_->get_usage();
 }
 
-Model* Resource::get_model() const
-{
-  return model_;
-}
-
-const std::string& Resource::get_name() const
-{
-  return name_;
-}
-
-const char* Resource::get_cname() const
-{
-  return name_.c_str();
-}
-
-bool Resource::operator==(const Resource& other) const
-{
-  return name_ == other.name_;
-}
-
 void Resource::set_state_profile(profile::Profile* profile)
 {
   xbt_assert(state_event_ == nullptr, "Cannot set a second state profile to %s", get_cname());
-
   state_event_ = profile->schedule(&future_evt_set, this);
 }
 
-kernel::lmm::Constraint* Resource::get_constraint() const
-{
-  return constraint_;
-}
-
 } // namespace resource
 } // namespace kernel
 } // namespace simgrid
index c1bd140..a75a3ec 100644 (file)
@@ -114,43 +114,39 @@ bool request_depend_asymmetric(smx_simcall_t r1, smx_simcall_t r2)
 }
 
 // Those are internal_req
-bool request_depend(smx_simcall_t r1, smx_simcall_t r2)
+bool request_depend(smx_simcall_t req1, smx_simcall_t req2)
 {
-  if (r1->issuer == r2->issuer)
+  if (req1->issuer == req2->issuer)
     return false;
 
   /* Wait with timeout transitions are not considered by the independence theorem, thus we consider them as dependent with all other transitions */
-  if ((r1->call == SIMCALL_COMM_WAIT && simcall_comm_wait__get__timeout(r1) > 0)
-      || (r2->call == SIMCALL_COMM_WAIT
-          && simcall_comm_wait__get__timeout(r2) > 0))
+  if ((req1->call == SIMCALL_COMM_WAIT && simcall_comm_wait__get__timeout(req1) > 0) ||
+      (req2->call == SIMCALL_COMM_WAIT && simcall_comm_wait__get__timeout(req2) > 0))
     return true;
 
-  if (r1->call != r2->call)
-    return request_depend_asymmetric(r1, r2)
-      && request_depend_asymmetric(r2, r1);
+  if (req1->call != req2->call)
+    return request_depend_asymmetric(req1, req2) && request_depend_asymmetric(req2, req1);
 
   // Those are internal requests, we do not need indirection
   // because those objects are copies:
-  simgrid::kernel::activity::CommImpl* synchro1 = MC_get_comm(r1);
-  simgrid::kernel::activity::CommImpl* synchro2 = MC_get_comm(r2);
-
-  switch(r1->call) {
-  case SIMCALL_COMM_ISEND:
-    return simcall_comm_isend__get__mbox(r1)
-      == simcall_comm_isend__get__mbox(r2);
-  case SIMCALL_COMM_IRECV:
-    return simcall_comm_irecv__get__mbox(r1)
-      == simcall_comm_irecv__get__mbox(r2);
-  case SIMCALL_COMM_WAIT:
-    if (synchro1->src_buff_ == synchro2->src_buff_ && synchro1->dst_buff_ == synchro2->dst_buff_)
-      return false;
-    if (synchro1->src_buff_ != nullptr && synchro1->dst_buff_ != nullptr && synchro2->src_buff_ != nullptr &&
-        synchro2->dst_buff_ != nullptr && synchro1->dst_buff_ != synchro2->src_buff_ &&
-        synchro1->dst_buff_ != synchro2->dst_buff_ && synchro2->dst_buff_ != synchro1->src_buff_)
-      return false;
-    return true;
-  default:
-    return true;
+  simgrid::kernel::activity::CommImpl* synchro1 = MC_get_comm(req1);
+  simgrid::kernel::activity::CommImpl* synchro2 = MC_get_comm(req2);
+
+  switch (req1->call) {
+    case SIMCALL_COMM_ISEND:
+      return simcall_comm_isend__get__mbox(req1) == simcall_comm_isend__get__mbox(req2);
+    case SIMCALL_COMM_IRECV:
+      return simcall_comm_irecv__get__mbox(req1) == simcall_comm_irecv__get__mbox(req2);
+    case SIMCALL_COMM_WAIT:
+      if (synchro1->src_buff_ == synchro2->src_buff_ && synchro1->dst_buff_ == synchro2->dst_buff_)
+        return false;
+      if (synchro1->src_buff_ != nullptr && synchro1->dst_buff_ != nullptr && synchro2->src_buff_ != nullptr &&
+          synchro2->dst_buff_ != nullptr && synchro1->dst_buff_ != synchro2->src_buff_ &&
+          synchro1->dst_buff_ != synchro2->dst_buff_ && synchro2->dst_buff_ != synchro1->src_buff_)
+        return false;
+      return true;
+    default:
+      return true;
   }
 }
 
index 2485979..108ba80 100644 (file)
@@ -124,14 +124,7 @@ static void install_segvhandler()
 namespace simgrid {
 namespace simix {
 
-Timer* Timer::set(double date, void (*callback)(void*), void* arg)
-{
-  Timer* timer   = new Timer(date, simgrid::xbt::make_task([callback, arg]() { callback(arg); }));
-  timer->handle_ = simix_timers.emplace(std::make_pair(date, timer));
-  return timer;
-}
-
-Timer* Timer::set(double date, simgrid::xbt::Task<void()> callback)
+Timer* Timer::set(double date, simgrid::xbt::Task<void()>&& callback)
 {
   Timer* timer   = new Timer(date, std::move(callback));
   timer->handle_ = simix_timers.emplace(std::make_pair(date, timer));
@@ -545,14 +538,12 @@ double SIMIX_timer_next()
 
 smx_timer_t SIMIX_timer_set(double date, void (*callback)(void*), void *arg)
 {
-  return simgrid::simix::Timer::set(date, callback, arg);
+  return simgrid::simix::Timer::set(date, std::bind(callback, arg));
 }
 
-smx_timer_t SIMIX_timer_set(double date, simgrid::xbt::Task<void()> callback)
+smx_timer_t SIMIX_timer_set(double date, simgrid::xbt::Task<void()>&& callback) // deprecated
 {
-  smx_timer_t timer = new simgrid::simix::Timer(date, std::move(callback));
-  timer->handle_    = simgrid::simix::simix_timers.emplace(std::make_pair(date, timer));
-  return timer;
+  return simgrid::simix::Timer::set(date, std::move(callback));
 }
 
 /** @brief cancels a timer that was added earlier */
diff --git a/teshsuite/lua/CMakeLists.txt b/teshsuite/lua/CMakeLists.txt
new file mode 100644 (file)
index 0000000..a213e80
--- /dev/null
@@ -0,0 +1,6 @@
+IF(SIMGRID_HAVE_LUA)
+  # Tests testing simulation from C but using lua for platform files. Executed like this
+  # ~$ ./masterslave platform.lua deploy.lua
+  ADD_TESH(lua-platform-masterslave                --setenv srcdir=${CMAKE_HOME_DIRECTORY} --setenv bindir=${CMAKE_BINARY_DIR} --cd ${CMAKE_BINARY_DIR} ${CMAKE_HOME_DIRECTORY}/teshsuite/lua/lua_platforms.tesh)
+  SET_TESTS_PROPERTIES(lua-platform-masterslave    PROPERTIES ENVIRONMENT "LUA_CPATH=${CMAKE_BINARY_DIR}/lib/lib?.${LIB_EXE}")
+ENDIF()
index e8a01ba..140fedb 100644 (file)
@@ -54,3 +54,10 @@ if(enable_smpi AND enable_smpi_MPICH3_testsuite)
     add_library(mtest_c STATIC util/mtest_manual.c util/dtypes_manual.c util/mtestcheck.c util/mtest_datatype.c util/mtest_datatype_gen_manual.c)
   endif()
 endif()
+
+IF(enable_smpi_MPICH3_testsuite AND SMPI_FORTRAN)
+  ADD_TEST(test-smpi-mpich3-thread-f77     ${CMAKE_COMMAND} -E chdir ${CMAKE_BINARY_DIR}/teshsuite/smpi/mpich3-test/f77/ ${PERL_EXECUTABLE} ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/runtests "-wrapper=${TESH_WRAPPER}" -mpiexec=${CMAKE_BINARY_DIR}/smpi_script/bin/smpirun -srcdir=${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/f77/ -tests=testlist -privatization=${HAVE_PRIVATIZATION} -execarg=--cfg=contexts/stack-size:8000 -execarg=--cfg=contexts/factory:thread -execarg=--cfg=smpi/privatization:${HAVE_PRIVATIZATION})
+  SET_TESTS_PROPERTIES(test-smpi-mpich3-thread-f77 PROPERTIES PASS_REGULAR_EXPRESSION "tests passed!")
+  ADD_TEST(test-smpi-mpich3-thread-f90     ${CMAKE_COMMAND} -E chdir ${CMAKE_BINARY_DIR}/teshsuite/smpi/mpich3-test/f90/ ${PERL_EXECUTABLE} ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/runtests "-wrapper=${TESH_WRAPPER}" -mpiexec=${CMAKE_BINARY_DIR}/smpi_script/bin/smpirun -srcdir=${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/f90/ -tests=testlist -privatization=${HAVE_PRIVATIZATION} -execarg=--cfg=smpi/privatization:${HAVE_PRIVATIZATION} -execarg=--cfg=contexts/factory:thread)
+  SET_TESTS_PROPERTIES(test-smpi-mpich3-thread-f90 PROPERTIES PASS_REGULAR_EXPRESSION "tests passed!")
+ENDIF()
index ff7a329..7c7c8c6 100644 (file)
@@ -41,12 +41,20 @@ static lmm::System* new_system(method_t method)
   }
 }
 
-static double dichotomy(double func(double), double min, double max, double min_error)
+double a_test_1 = 0;
+double b_test_1 = 0;
+static double diff_lagrange_test_1(double x)
+{
+  return -(3 / (1 + 3 * x * x / 2) - 3 / (2 * (3 * (a_test_1 - x) * (a_test_1 - x) / 2 + 1)) +
+           3 / (2 * (3 * (b_test_1 - a_test_1 + x) * (b_test_1 - a_test_1 + x) / 2 + 1)));
+}
+
+static double dichotomy(double min, double max, double min_error)
 {
   double overall_error = 2 * min_error;
 
-  double min_func = func(min);
-  double max_func = func(max);
+  double min_func = diff_lagrange_test_1(min);
+  double max_func = diff_lagrange_test_1(max);
 
   if (min_func > 0 && max_func > 0)
     return min - 1.0;
@@ -72,7 +80,7 @@ static double dichotomy(double func(double), double min, double max, double min_
     if (fabs(min - middle) < 1e-12 || fabs(max - middle) < 1e-12) {
       break;
     }
-    double middle_func = func(middle);
+    double middle_func = diff_lagrange_test_1(middle);
     SHOW_EXPR(middle);
     SHOW_EXPR(middle_func);
 
@@ -91,14 +99,6 @@ static double dichotomy(double func(double), double min, double max, double min_
   return ((min + max) / 2.0);
 }
 
-double a_test_1 = 0;
-double b_test_1 = 0;
-static double diff_lagrange_test_1(double x)
-{
-  return -(3 / (1 + 3 * x * x / 2) - 3 / (2 * (3 * (a_test_1 - x) * (a_test_1 - x) / 2 + 1)) +
-           3 / (2 * (3 * (b_test_1 - a_test_1 + x) * (b_test_1 - a_test_1 + x) / 2 + 1)));
-}
-
 static void test1(method_t method)
 {
   double a = 1.0;
@@ -148,7 +148,7 @@ static void test1(method_t method)
     } else if (method == LAGRANGE_RENO) {
       a_test_1 = a;
       b_test_1 = b;
-      x = dichotomy(diff_lagrange_test_1, 0, a, 1e-13);
+      x        = dichotomy(0, a, 1e-13);
 
       if (x < 0)
         x = 0;
index 92ef0dd..72d4e86 100644 (file)
@@ -973,19 +973,20 @@ set(txt_files
 set(CMAKEFILES_TXT
   examples/s4u/CMakeLists.txt
   examples/smpi/CMakeLists.txt
-    examples/smpi/NAS/CMakeLists.txt
-    examples/smpi/smpi_msg_masterslave/CMakeLists.txt
-    examples/smpi/replay_multiple/CMakeLists.txt
-    examples/smpi/replay_multiple_manual_deploy/CMakeLists.txt
-    examples/smpi/energy/f77/CMakeLists.txt
-    examples/smpi/energy/f90/CMakeLists.txt
+  examples/smpi/NAS/CMakeLists.txt
+  examples/smpi/smpi_msg_masterslave/CMakeLists.txt
+  examples/smpi/replay_multiple/CMakeLists.txt
+  examples/smpi/replay_multiple_manual_deploy/CMakeLists.txt
+  examples/smpi/energy/f77/CMakeLists.txt
+  examples/smpi/energy/f90/CMakeLists.txt
   examples/python/CMakeLists.txt
   examples/deprecated/java/CMakeLists.txt
   examples/deprecated/msg/CMakeLists.txt
-    examples/deprecated/msg/mc/CMakeLists.txt
+  examples/deprecated/msg/mc/CMakeLists.txt
   examples/deprecated/simdag/CMakeLists.txt
 
   teshsuite/java/CMakeLists.txt
+  teshsuite/lua/CMakeLists.txt
   teshsuite/mc/CMakeLists.txt
   teshsuite/msg/CMakeLists.txt
   teshsuite/s4u/CMakeLists.txt
index 107579e..c175f19 100644 (file)
@@ -91,35 +91,6 @@ IF(enable_java)
   ENDIF()
 ENDIF()
 
-IF(SIMGRID_HAVE_MC)
-  ADD_TESH_FACTORIES(mc-bugged1                "ucontext;raw" --setenv bindir=${CMAKE_BINARY_DIR}/examples/deprecated/msg/mc --cd ${CMAKE_HOME_DIRECTORY}/examples/deprecated/msg/mc bugged1.tesh)
-  ADD_TESH_FACTORIES(mc-bugged2                "ucontext;raw" --setenv bindir=${CMAKE_BINARY_DIR}/examples/deprecated/msg/mc --cd ${CMAKE_HOME_DIRECTORY}/examples/deprecated/msg/mc bugged2.tesh)
-  IF(HAVE_UCONTEXT_CONTEXTS AND SIMGRID_PROCESSOR_x86_64) # liveness model-checking works only on 64bits (for now ...)
-    ADD_TESH(mc-bugged1-liveness-ucontext         --setenv bindir=${CMAKE_BINARY_DIR}/examples/deprecated/msg/mc --cd ${CMAKE_HOME_DIRECTORY}/examples/deprecated/msg/mc bugged1_liveness.tesh)
-    ADD_TESH(mc-bugged1-liveness-ucontext-sparse  --setenv bindir=${CMAKE_BINARY_DIR}/examples/deprecated/msg/mc --cd ${CMAKE_HOME_DIRECTORY}/examples/deprecated/msg/mc bugged1_liveness_sparse.tesh)
-    ADD_TESH(mc-bugged1-liveness-visited-ucontext --setenv bindir=${CMAKE_BINARY_DIR}/examples/deprecated/msg/mc --cd ${CMAKE_HOME_DIRECTORY}/examples/deprecated/msg/mc bugged1_liveness_visited.tesh)
-    ADD_TESH(mc-bugged1-liveness-visited-ucontext-sparse --setenv bindir=${CMAKE_BINARY_DIR}/examples/deprecated/msg/mc --cd ${CMAKE_HOME_DIRECTORY}/examples/deprecated/msg/mc bugged1_liveness_visited_sparse.tesh)
-    IF(HAVE_C_STACK_CLEANER)
-      # This test checks if the stack cleaner is making a difference:
-      ADD_TEST(mc-bugged1-liveness-stack-cleaner ${CMAKE_HOME_DIRECTORY}/examples/deprecated/msg/mc/bugged1_liveness_stack_cleaner ${CMAKE_HOME_DIRECTORY}/examples/deprecated/msg/mc/ ${CMAKE_BINARY_DIR}/examples/deprecated/msg/mc/)
-    ENDIF()
-  ENDIF()
-ENDIF()
-
-IF(enable_smpi_MPICH3_testsuite AND SMPI_FORTRAN)
-  ADD_TEST(test-smpi-mpich3-thread-f77     ${CMAKE_COMMAND} -E chdir ${CMAKE_BINARY_DIR}/teshsuite/smpi/mpich3-test/f77/ ${PERL_EXECUTABLE} ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/runtests "-wrapper=${TESH_WRAPPER}" -mpiexec=${CMAKE_BINARY_DIR}/smpi_script/bin/smpirun -srcdir=${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/f77/ -tests=testlist -privatization=${HAVE_PRIVATIZATION} -execarg=--cfg=contexts/stack-size:8000 -execarg=--cfg=contexts/factory:thread -execarg=--cfg=smpi/privatization:${HAVE_PRIVATIZATION})
-  SET_TESTS_PROPERTIES(test-smpi-mpich3-thread-f77 PROPERTIES PASS_REGULAR_EXPRESSION "tests passed!")
-  ADD_TEST(test-smpi-mpich3-thread-f90     ${CMAKE_COMMAND} -E chdir ${CMAKE_BINARY_DIR}/teshsuite/smpi/mpich3-test/f90/ ${PERL_EXECUTABLE} ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/runtests "-wrapper=${TESH_WRAPPER}" -mpiexec=${CMAKE_BINARY_DIR}/smpi_script/bin/smpirun -srcdir=${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/f90/ -tests=testlist -privatization=${HAVE_PRIVATIZATION} -execarg=--cfg=smpi/privatization:${HAVE_PRIVATIZATION} -execarg=--cfg=contexts/factory:thread)
-  SET_TESTS_PROPERTIES(test-smpi-mpich3-thread-f90 PROPERTIES PASS_REGULAR_EXPRESSION "tests passed!")
-ENDIF()
-
-IF(SIMGRID_HAVE_LUA)
-  # Tests testing simulation from C but using lua for platform files. Executed like this
-  # ~$ ./masterslave platform.lua deploy.lua
-  ADD_TESH(lua-platform-masterslave                --setenv srcdir=${CMAKE_HOME_DIRECTORY} --setenv bindir=${CMAKE_BINARY_DIR} --cd ${CMAKE_BINARY_DIR} ${CMAKE_HOME_DIRECTORY}/teshsuite/lua/lua_platforms.tesh)
-  SET_TESTS_PROPERTIES(lua-platform-masterslave    PROPERTIES ENVIRONMENT "LUA_CPATH=${CMAKE_BINARY_DIR}/lib/lib?.${LIB_EXE}")
-ENDIF()
-
 # New tests should use the Catch Framework
 set(UNIT_TESTS  src/xbt/unit-tests_main.cpp
                 src/kernel/resource/profile/trace_mgr_test.cpp