Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Prefer emplace_back.
[simgrid.git] / src / kernel / resource / NetworkModelIntf_test.cpp
index e7c8460..418cc54 100644 (file)
@@ -8,6 +8,7 @@
 #include "simgrid/kernel/resource/NetworkModelIntf.hpp"
 #include "simgrid/s4u/Engine.hpp"
 #include "simgrid/sg_config.hpp"
+#include "src/internal_config.h" // HAVE_SMPI
 
 static double factor_cb(double, const simgrid::s4u::Host*, const simgrid::s4u::Host*,
                         const std::vector<simgrid::s4u::Link*>&, const std::unordered_set<simgrid::s4u::NetZone*>&)
@@ -17,7 +18,13 @@ static double factor_cb(double, const simgrid::s4u::Host*, const simgrid::s4u::H
 
 TEST_CASE("kernel::resource::NetworkModelIntf: Factors invalid callbacks: exception", "")
 {
-  for (const auto& model : std::vector<std::string>{"LV08", "SMPI", "IB", "CM02"}) {
+  std::vector<std::string> models{"LV08", "CM02"};
+#if HAVE_SMPI
+  models.emplace_back("SMPI");
+  models.emplace_back("IB");
+#endif
+
+  for (const auto& model : models) {
     _sg_cfg_init_status = 0; /* HACK: clear config global to be able to do set_config in UTs */
     simgrid::s4u::Engine e("test");
     simgrid::s4u::Engine::set_config("network/model:" + model);
@@ -53,6 +60,7 @@ TEST_CASE("kernel::resource::NetworkModelIntf: Invalid network/latency-factor an
   }
 }
 
+#if HAVE_SMPI
 TEST_CASE("kernel::resource::NetworkModelIntf: Invalid smpi/lat-factor and smpi/bw-factor", "")
 {
   for (const auto& model : std::vector<std::string>{"SMPI", "IB"}) {
@@ -72,3 +80,4 @@ TEST_CASE("kernel::resource::NetworkModelIntf: Invalid smpi/lat-factor and smpi/
     }
   }
 }
+#endif