Skip to content

Commit

Permalink
test: init flywheel in tests and try fwinit
Browse files Browse the repository at this point in the history
Signed-off-by: vsoch <vsoch@users.noreply.github.com>
  • Loading branch information
vsoch committed Apr 13, 2024
1 parent 615a5d7 commit 8458889
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 4 deletions.
3 changes: 3 additions & 0 deletions qmanager/policies/base/queue_policy_base.hpp
Expand Up @@ -24,10 +24,13 @@ extern "C" {
#include <string>
#include <memory>
#include <cstdint>
#include <boost/flyweight.hpp>

#include "resource/reapi/bindings/c++/reapi.hpp"
#include "qmanager/config/queue_system_defaults.hpp"

static boost::flyweight<std::string>::initializer fwinit;

namespace Flux {
namespace queue_manager {

Expand Down
6 changes: 3 additions & 3 deletions resource/schema/data_std.cpp
Expand Up @@ -20,6 +20,7 @@ boost::flyweight<std::string> flux_error;
boost::flyweight<std::string> flux_match_any;
boost::flyweight<std::string> flux_node;
boost::flyweight<std::string> flux_slot;
boost::flyweight<std::string> flux_core;
boost::flyweight<std::string> flux_subsystem_containment;
boost::flyweight<std::string> flux_subsystem_power;
boost::flyweight<std::string> flux_subsystem_infiniband_network;
Expand All @@ -33,13 +34,12 @@ boost::flyweight<std::string> flux_relation_in;;


void init_flyweight ()
{
// This should have a cpp file associated, but it didn't originally
// so I'm not adding it
{
flux_error = "error";
flux_match_any = "*";
flux_node = "node";
flux_slot = "slot";
flux_core = "core";
flux_subsystem_containment = "containment";
flux_subsystem_power = "power";
flux_subsystem_infiniband_network = "ibnet";
Expand Down
3 changes: 3 additions & 0 deletions resource/schema/data_std.hpp
Expand Up @@ -17,6 +17,8 @@

#include "resource/schema/data_std.hpp"

static boost::flyweight<std::string>::initializer fwinit;

namespace Flux {
namespace resource_model {

Expand All @@ -39,6 +41,7 @@ extern void init_flyweight();
// Resource types (node, slot, etc)
extern boost::flyweight<std::string> flux_node;
extern boost::flyweight<std::string> flux_slot;
extern boost::flyweight<std::string> flux_core;

// Subsystems
extern boost::flyweight<std::string> flux_match_any;
Expand Down
1 change: 1 addition & 0 deletions resource/schema/infra_data.hpp
Expand Up @@ -14,6 +14,7 @@
#include <map>
#include <cstdint>
#include <limits>
#include <boost/flyweight.hpp>
#include "resource/schema/data_std.hpp"
#include "resource/schema/ephemeral.hpp"
#include "resource/planner/c/planner_multi.h"
Expand Down
2 changes: 1 addition & 1 deletion resource/schema/test/schema_test02.cpp
Expand Up @@ -172,7 +172,7 @@ static int test_constructors_and_overload ()
int main (int argc, char *argv[])
{
plan (12);

init_flyweight();
test_constructors_and_overload ();

done_testing ();
Expand Down
1 change: 1 addition & 0 deletions resource/utilities/resource-query.cpp
Expand Up @@ -757,6 +757,7 @@ static void fini_resource_query (std::shared_ptr<resource_context_t> &ctx)

int main (int argc, char *argv[])
{
init_flyweight();
std::shared_ptr<resource_context_t> ctx = nullptr;
if ( !(ctx = init_resource_query (argc, argv))) {
std::cerr << "ERROR: resource query initialization" << std::endl;
Expand Down

0 comments on commit 8458889

Please sign in to comment.