* Without globals and with current surf_*_model_description init functions, we need
* the root netzone to exist when creating the models.
* This was usually done at sg_platf.cpp, during XML parsing */
- if (not s4u::Engine::get_instance()->get_netzone_root())
+ if (not s4u::Engine::get_instance()->get_netzone_root()) {
s4u::Engine::get_instance()->set_netzone_root(&piface_);
-
- static bool surf_parse_models_setup_already_called = false;
- if (not surf_parse_models_setup_already_called) {
+ /* root netzone set, initialize models */
simgrid::s4u::Engine::on_platform_creation();
/* Initialize the surf models. That must be done after we got all config, and before we need the models.
* (FIXME: check it out by creating a file beginning with one of these tags)
* but cluster and peer come down to zone creations, so putting this verification here is correct.
*/
- surf_parse_models_setup_already_called = true;
surf_config_models_setup();
}
#include "simgrid/s4u/Host.hpp"
#include "simgrid/s4u/NetZone.hpp"
#include "src/surf/network_interface.hpp"
-#include "src/surf/surf_interface.hpp" // create models
#include "src/surf/xml/platf_private.hpp" // RouteCreationArgs and friends
namespace {
// https://github.com/catchorg/Catch2/issues/853
TEST_CASE("kernel::routing::StarZone: Get routes: assert", "[.][assert]")
{
- /* workaround to initialize things, they must be done in this particular order */
EngineWrapper e("test");
auto* zone = new simgrid::kernel::routing::StarZone("test");
- surf_network_model_init_LegrandVelho();
- surf_cpu_model_init_Cas01();
const auto* host1 = zone->create_host("netpoint1", {100});
const auto* host2 = zone->create_host("netpoint2", {100});
TEST_CASE("kernel::routing::StarZone: Get routes (hosts)", "")
{
- /* workaround to initialize things, they must be done in this particular order */
EngineWrapper e("test");
auto* zone = new simgrid::kernel::routing::StarZone("test");
- surf_network_model_init_LegrandVelho();
- surf_cpu_model_init_Cas01();
const auto* host1 = zone->create_host("netpoint1", {100});
const auto* host2 = zone->create_host("netpoint2", {100});
TEST_CASE("kernel::routing::StarZone: Get routes (netzones)", "")
{
- /* workaround to initialize things, they must be done in this particular order */
EngineWrapper e("test");
auto* zone = new simgrid::kernel::routing::StarZone("test");
- surf_network_model_init_LegrandVelho();
- surf_cpu_model_init_Cas01();
auto* subzone1 =
(new simgrid::kernel::routing::NetPoint("subzone1", simgrid::kernel::routing::NetPoint::Type::NetZone))
#include "simgrid/s4u/Host.hpp"
#include "simgrid/s4u/NetZone.hpp"
#include "src/surf/network_interface.hpp"
-#include "src/surf/surf_interface.hpp" // create models
#include "src/surf/xml/platf_private.hpp" // RouteCreationArgs and friends
namespace {
public:
simgrid::s4u::Engine e;
- explicit EngineWrapper(std::string name) : argv(&name[0]), e(&argc, &argv)
- {
- simgrid::s4u::create_full_zone("root");
- surf_network_model_init_LegrandVelho();
- surf_cpu_model_init_Cas01();
- }
+ explicit EngineWrapper(std::string name) : argv(&name[0]), e(&argc, &argv) {}
};
std::pair<simgrid::kernel::routing::NetPoint*, simgrid::kernel::routing::NetPoint*>
TEST_CASE("kernel::routing::TorusZone: Invalid params", "")
{
+ using namespace simgrid::s4u;
+ EngineWrapper e("test");
+
SECTION("Empty dimensions")
{
- using namespace simgrid::s4u;
- EngineWrapper e("test");
REQUIRE_THROWS_AS(create_torus_zone("test", e.e.get_netzone_root(), {}, 1e9, 10,
simgrid::s4u::Link::SharingPolicy::SHARED, create_host),
std::invalid_argument);
}
SECTION("One 0 dimension")
{
- using namespace simgrid::s4u;
- EngineWrapper e("test");
REQUIRE_THROWS_AS(create_torus_zone("test", e.e.get_netzone_root(), {3, 0, 2}, 1e9, 10,
simgrid::s4u::Link::SharingPolicy::SHARED, create_host),
std::invalid_argument);
}
SECTION("Invalid bandwidth")
{
- using namespace simgrid::s4u;
- EngineWrapper e("test");
REQUIRE_THROWS_AS(create_torus_zone("test", e.e.get_netzone_root(), {3, 2, 2}, 0, 10,
simgrid::s4u::Link::SharingPolicy::SHARED, create_host),
std::invalid_argument);
}
SECTION("Invalid latency")
{
- using namespace simgrid::s4u;
- EngineWrapper e("test");
REQUIRE_THROWS_AS(create_torus_zone("test", e.e.get_netzone_root(), {3, 2, 2}, 1e9, -10,
simgrid::s4u::Link::SharingPolicy::SHARED, create_host),
std::invalid_argument);