Skip to content

Commit

Permalink
fixes to adapt to margo 0.18.1 and thallium 0.14.3
Browse files Browse the repository at this point in the history
  • Loading branch information
mdorier committed Aug 28, 2024
1 parent d57685b commit 43a4044
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 8 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ option (ENABLE_PYTHON "Enable Python support" OFF)
# library version set here (e.g. for shared libs).
set (BEDROCK_VERSION_MAJOR 0)
set (BEDROCK_VERSION_MINOR 14)
set (BEDROCK_VERSION_PATCH 0)
set (BEDROCK_VERSION_PATCH 1)
set (BEDROCK_VERSION
"${BEDROCK_VERSION_MAJOR}.${BEDROCK_VERSION_MINOR}.${BEDROCK_VERSION_PATCH}")
add_definitions ("-DBEDROCK_VERSION=${BEDROCK_VERSION}")
Expand Down
6 changes: 1 addition & 5 deletions src/Server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -210,9 +210,7 @@ Server::Server(const std::string& address, const std::string& configString,
static_cast<std::string>(margoMgr.getThalliumEngine().self()));
}

Server::~Server() {
if(self) finalize();
}
Server::~Server() {}

MargoManager Server::getMargoManager() const { return self->m_margo_manager; }

Expand All @@ -237,8 +235,6 @@ void Server::onPreFinalize(void* uargs) {

void Server::onFinalize(void* uargs) {
spdlog::trace("Calling Server's finalize callback");
auto server = reinterpret_cast<Server*>(uargs);
server->self.reset();
}

std::string Server::getCurrentConfig() const {
Expand Down
2 changes: 2 additions & 0 deletions tests/InitJx9.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ TEST_CASE("Tests Server initialization with JX9", "[init-jx9]") {
auto output_config = json::parse(server.getCurrentConfig());
cleanupOutputConfig(output_config);
REQUIRE(output_config == expected_config);
server.finalize();
} catch(bedrock::Exception& ex) {
INFO("Details: " << ex.details());
throw;
Expand All @@ -63,5 +64,6 @@ TEST_CASE("Tests Server initialization with JX9", "[init-jx9]") {
bedrock::Server("na+sm", input_jx9, bedrock::ConfigType::JX9),
bedrock::Exception,
Catch::Matchers::Message("Jx9 script failed to compile: 1 Error: '&': Missing operand"));

}
}
11 changes: 9 additions & 2 deletions tests/InitValid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,23 +39,29 @@ TEST_CASE("Tests Server initialization", "[init-json]") {
auto input_config = jf[i]["input"].dump();
auto expected_config = jf[i]["output"];
try {
bedrock::Server server("na+sm", input_config);
auto engine = server.getMargoManager().getThalliumEngine();
SECTION("Get configuration directly from Server object") {
bedrock::Server server("na+sm", input_config);
auto engine = server.getMargoManager().getThalliumEngine();
auto output_config = json::parse(server.getCurrentConfig());
cleanupOutputConfig(output_config);
REQUIRE(output_config == expected_config);
server.finalize();
}
SECTION("Get configuration synchronously using a Client") {
bedrock::Server server("na+sm", input_config);
auto engine = server.getMargoManager().getThalliumEngine();
bedrock::Client client(engine);
auto service_handle = client.makeServiceHandle(engine.self(), 0);
std::string output_config_str;
service_handle.getConfig(&output_config_str);
auto output_config = json::parse(output_config_str);
cleanupOutputConfig(output_config);
REQUIRE(output_config == expected_config);
server.finalize();
}
SECTION("Get configuration asynchronously using a Client") {
bedrock::Server server("na+sm", input_config);
auto engine = server.getMargoManager().getThalliumEngine();
bedrock::Client client(engine);
auto service_handle = client.makeServiceHandle(engine.self(), 0);
std::string output_config_str;
Expand All @@ -65,6 +71,7 @@ TEST_CASE("Tests Server initialization", "[init-json]") {
auto output_config = json::parse(output_config_str);
cleanupOutputConfig(output_config);
REQUIRE(output_config == expected_config);
server.finalize();
}
} catch(bedrock::Exception& ex) {
INFO("Details: " << ex.details());
Expand Down

0 comments on commit 43a4044

Please sign in to comment.