Test: Add new testsuite SDK

This commit is contained in:
Dennis Klein 2019-07-16 00:07:30 +02:00 committed by Dennis Klein
parent 1a93da5be0
commit 90496c89fe
16 changed files with 739 additions and 6 deletions

View File

@ -74,9 +74,14 @@ if(BUILD_NANOMSG_TRANSPORT)
)
endif()
if(BUILD_SDK)
set(required_dds_version 2.5.4)
else()
set(required_dds_version 2.4)
endif()
if(BUILD_DDS_PLUGIN OR BUILD_SDK)
find_package2(PRIVATE DDS REQUIRED
VERSION 2.4
VERSION ${required_dds_version}
)
set(DDS_Boost_COMPONENTS system log log_setup)
set(DDS_Boost_VERSION 1.67)

View File

@ -6,12 +6,17 @@
# copied verbatim in the file "LICENSE" #
################################################################################
################
# libFairMQSDK #
################
#################
# libFairMQ_SDK #
#################
configure_file(DDSInfo.h.in ${CMAKE_CURRENT_BINARY_DIR}/DDSInfo.h @ONLY)
set(target SDK)
set(SDK_PUBLIC_HEADER_FILES
DDSEnvironment.h
${CMAKE_CURRENT_BINARY_DIR}/DDSInfo.h
DDSSession.h
Topology.h
)
@ -19,6 +24,8 @@ set(SDK_PRIVATE_HEADER_FILES
)
set(SDK_SOURCE_FILES
DDSEnvironment.cxx
DDSSession.cxx
Topology.cxx
)
@ -32,17 +39,21 @@ target_compile_definitions(${target} PUBLIC BOOST_ERROR_CODE_HEADER_ONLY)
target_include_directories(${target}
PUBLIC
$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}>
$<BUILD_INTERFACE:${CMAKE_BINARY_DIR}>
$<INSTALL_INTERFACE:include>
)
target_link_libraries(${target}
PUBLIC
Boost::filesystem
FairLogger::FairLogger
StateMachine
PRIVATE
Tools
Boost::boost
DDS::dds_intercom_lib
DDS::dds_protocol_lib
DDS::dds_tools_lib
DDS::dds_topology_lib
Tools
)
set_target_properties(${target} PROPERTIES
VERSION ${PROJECT_GIT_VERSION}

View File

@ -0,0 +1,73 @@
/********************************************************************************
* Copyright (C) 2019 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
* *
* This software is distributed under the terms of the *
* GNU Lesser General Public Licence (LGPL) version 3, *
* copied verbatim in the file "LICENSE" *
********************************************************************************/
#include "DDSEnvironment.h"
#include <DDS/Tools.h>
#include <cstdlib>
#include <fairmq/Tools.h>
#include <sstream>
#include <stdlib.h>
#include <utility>
namespace fair {
namespace mq {
namespace sdk {
// TODO https://github.com/FairRootGroup/DDS/issues/224
auto LoadDDSEnv(const boost::filesystem::path& config_home, const boost::filesystem::path& prefix)
-> void
{
setenv("DDS_LOCATION", prefix.c_str(), 1);
if (!config_home.empty()) {
setenv("HOME", config_home.c_str(), 1);
}
std::string path(std::getenv("PATH"));
path = DDSExecutableDir + std::string(":") + path;
setenv("PATH", path.c_str(), 1);
std::istringstream cmd;
cmd.str("DDS_CFG=`dds-user-defaults --ignore-default-sid -p`\n"
"if [ -z \"$DDS_CFG\" ]; then\n"
" dds-user-defaults --ignore-default-sid -d -c \"$HOME/.DDS/DDS.cfg\"\n"
"fi");
std::system(cmd.str().c_str());
}
struct DDSEnvironment::Impl
{
Impl(Path config_home, Path prefix)
: fConfigHome(std::move(config_home))
, fInstallPrefix(std::move(prefix))
{
LoadDDSEnv(fConfigHome, fInstallPrefix);
if (fConfigHome.empty()) {
fConfigHome = std::getenv("HOME");
}
}
Path fConfigHome;
Path fInstallPrefix;
};
DDSEnvironment::DDSEnvironment(Path config_home, Path prefix)
: fImpl(std::make_shared<Impl>(std::move(config_home), std::move(prefix)))
{}
auto DDSEnvironment::GetConfigHome() const -> Path { return fImpl->fConfigHome; }
auto DDSEnvironment::GetInstallPrefix() const -> Path { return fImpl->fInstallPrefix; }
auto operator<<(std::ostream& os, DDSEnvironment env) -> std::ostream&
{
return os << "$DDS_LOCATION: " << env.GetInstallPrefix() << ", "
<< "$DDS_CONFIG_HOME: " << env.GetConfigHome() / DDSEnvironment::Path(".DDS");
}
} // namespace sdk
} // namespace mq
} // namespace fair

View File

@ -0,0 +1,54 @@
/********************************************************************************
* Copyright (C) 2019 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
* *
* This software is distributed under the terms of the *
* GNU Lesser General Public Licence (LGPL) version 3, *
* copied verbatim in the file "LICENSE" *
********************************************************************************/
#ifndef FAIR_MQ_SDK_DDSENVIRONMENT_H
#define FAIR_MQ_SDK_DDSENVIRONMENT_H
#include <boost/filesystem.hpp>
#include <fairmq/sdk/DDSInfo.h>
#include <memory>
#include <ostream>
namespace fair {
namespace mq {
namespace sdk {
/**
* @brief Sets up the DDS environment
* @param config_home Path under which DDS creates a ".DDS" runtime directory for configuration and logs
* @param prefix Path where DDS is installed
*/
auto LoadDDSEnv(const boost::filesystem::path& config_home = "", const boost::filesystem::path& prefix = DDSInstallPrefix)
-> void;
/**
* @class DDSEnvironment DDSSession.h <fairmq/sdk/DDSSession.h>
* @brief Sets up the DDS environment (object helper)
*/
class DDSEnvironment
{
public:
using Path = boost::filesystem::path;
/// @brief See fair::mq::sdk::LoadDDSEnv
explicit DDSEnvironment(Path config_home = "", Path prefix = DDSInstallPrefix);
auto GetConfigHome() const -> Path;
auto GetInstallPrefix() const -> Path;
friend auto operator<<(std::ostream& os, DDSEnvironment env) -> std::ostream&;
private:
struct Impl;
std::shared_ptr<Impl> fImpl;
};
} // namespace sdk
} // namespace mq
} // namespace fair
#endif /* FAIR_MQ_SDK_DDSENVIRONMENT_H */

29
fairmq/sdk/DDSInfo.h.in Normal file
View File

@ -0,0 +1,29 @@
/********************************************************************************
* Copyright (C) 2019 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
* *
* This software is distributed under the terms of the *
* GNU Lesser General Public Licence (LGPL) version 3, *
* copied verbatim in the file "LICENSE" *
********************************************************************************/
#ifndef FAIR_MQ_SDK_DDSINFO_H
#define FAIR_MQ_SDK_DDSINFO_H
#include <string>
namespace fair {
namespace mq {
namespace sdk {
const std::string DDSVersion("@DDS_VERSION@");
const std::string DDSInstallPrefix("@DDS_INSTALL_PREFIX@");
const std::string DDSExecutableDir("@DDS_BINDIR@");
const std::string DDSIncludeDir("@DDS_INCDIR@");
const std::string DDSLibraryDir("@DDS_LIBDIR@");
const std::string DDSPluginDir("@DDS_PLUGINDIR@");
} // namespace sdk
} // namespace mq
} // namespace fair
#endif /* FAIR_MQ_SDK_DDSINFO_H */

146
fairmq/sdk/DDSSession.cxx Normal file
View File

@ -0,0 +1,146 @@
/********************************************************************************
* Copyright (C) 2019 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
* *
* This software is distributed under the terms of the *
* GNU Lesser General Public Licence (LGPL) version 3, *
* copied verbatim in the file "LICENSE" *
********************************************************************************/
#include "DDSSession.h"
#include <DDS/Tools.h>
#include <boost/uuid/uuid_io.hpp>
#include <cassert>
#include <cstdlib>
#include <fairlogger/Logger.h>
#include <fairmq/Tools.h>
#include <sstream>
#include <stdlib.h>
#include <utility>
namespace fair {
namespace mq {
namespace sdk {
auto operator<<(std::ostream& os, DDSRMSPlugin plugin) -> std::ostream&
{
switch (plugin) {
case DDSRMSPlugin::ssh:
return os << "ssh";
case DDSRMSPlugin::localhost:
return os << "localhost";
default:
__builtin_unreachable();
}
}
auto operator>>(std::istream& is, DDSRMSPlugin& plugin) -> std::istream&
{
std::string value;
if (is >> value) {
if (value == "ssh") {
plugin = DDSRMSPlugin::ssh;
} else if (value == "localhost") {
plugin = DDSRMSPlugin::localhost;
} else {
throw std::runtime_error("Unknown or unsupported DDSRMSPlugin");
}
}
return is;
}
struct DDSSession::Impl
{
Impl(DDSEnvironment env, DDSRMSPlugin plugin)
: fEnv(std::move(env))
, fDefaultPlugin(std::move(plugin))
, fSession()
, fId(to_string(fSession.create()))
{}
Impl(DDSEnvironment env, DDSRMSPlugin plugin, Id existing_id)
: fEnv(std::move(env))
, fDefaultPlugin(std::move(plugin))
, fSession()
, fId(std::move(existing_id))
{
fSession.attach(fId);
}
~Impl()
{
fSession.stop();
fSession.shutdown();
}
const DDSEnvironment fEnv;
const DDSRMSPlugin fDefaultPlugin;
dds::tools_api::CSession fSession;
const Id fId;
};
DDSSession::DDSSession(DDSEnvironment env, DDSRMSPlugin default_plugin)
: fImpl(std::make_shared<Impl>(std::move(env), std::move(default_plugin))) {}
DDSSession::DDSSession(DDSEnvironment env, Id existing_id)
: fImpl(std::make_shared<Impl>(std::move(env), DDSRMSPlugin::localhost, std::move(existing_id))) {}
DDSSession::DDSSession(DDSEnvironment env, DDSRMSPlugin default_plugin, Id existing_id)
: fImpl(std::make_shared<Impl>(std::move(env), std::move(default_plugin), std::move(existing_id))) {}
auto DDSSession::IsRunning() const -> bool { return fImpl->fSession.IsRunning(); }
auto DDSSession::GetId() const -> Id { return fImpl->fId; }
auto DDSSession::GetDefaultPlugin() const -> DDSRMSPlugin { return fImpl->fDefaultPlugin; }
auto DDSSession::SubmitAgents(Quantity agents) -> void
{
SubmitAgents(agents, GetDefaultPlugin(), Path());
}
auto DDSSession::SubmitAgents(Quantity agents, DDSRMSPlugin plugin) -> void
{
SubmitAgents(agents, plugin, Path());
}
auto DDSSession::SubmitAgents(Quantity agents, const Path& config) -> void
{
SubmitAgents(agents, GetDefaultPlugin(), std::move(config));
}
auto DDSSession::SubmitAgents(Quantity agents, DDSRMSPlugin plugin, const Path& config) -> void
{
// Requesting to submit 0 agents is not meaningful
assert(agents > 0);
// The config argument is required with all plugins except localhost
if (plugin != DDSRMSPlugin::localhost) {
assert(exists(config));
}
dds::tools_api::SSubmitRequestData submitInfo;
submitInfo.m_rms = tools::ToString(plugin);
submitInfo.m_instances = agents;
submitInfo.m_config = config.string();
tools::Semaphore blocker;
auto submitRequest = dds::tools_api::SSubmitRequest::makeRequest(submitInfo);
submitRequest->setMessageCallback(
[](const dds::tools_api::SMessageResponseData& message) { LOG(debug) << message; });
submitRequest->setDoneCallback([&]() {
LOG(debug) << agents << " Agents submitted";
blocker.Signal();
});
fImpl->fSession.sendRequest<dds::tools_api::SSubmitRequest>(submitRequest);
blocker.Wait();
}
auto operator<<(std::ostream& os, DDSSession session) -> std::ostream&
{
return os << "$DDS_SESSION_ID: " << session.GetId();
}
} // namespace sdk
} // namespace mq
} // namespace fair

72
fairmq/sdk/DDSSession.h Normal file
View File

@ -0,0 +1,72 @@
/********************************************************************************
* Copyright (C) 2019 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
* *
* This software is distributed under the terms of the *
* GNU Lesser General Public Licence (LGPL) version 3, *
* copied verbatim in the file "LICENSE" *
********************************************************************************/
#ifndef FAIR_MQ_SDK_DDSSESSION_H
#define FAIR_MQ_SDK_DDSSESSION_H
#include <boost/filesystem.hpp>
#include <cstdint>
#include <fairmq/sdk/DDSEnvironment.h>
#include <fairmq/sdk/DDSInfo.h>
#include <istream>
#include <memory>
#include <ostream>
#include <stdexcept>
#include <string>
namespace fair {
namespace mq {
namespace sdk {
/**
* @enum DDSRMSPlugin DDSSession.h <fairmq/sdk/DDSSession.h>
* @brief Supported DDS resource management system plugins
*/
enum class DDSRMSPlugin
{
localhost,
ssh
};
auto operator<<(std::ostream& os, DDSRMSPlugin plugin) -> std::ostream&;
auto operator>>(std::istream& is, DDSRMSPlugin& plugin) -> std::istream&;
/**
* @class DDSSession DDSSession.h <fairmq/sdk/DDSSession.h>
* @brief Represents a DDS session
*/
class DDSSession
{
public:
using Id = std::string;
using Quantity = std::uint32_t;
using Path = boost::filesystem::path;
DDSSession() = delete;
explicit DDSSession(DDSEnvironment env, DDSRMSPlugin default_plugin = DDSRMSPlugin::localhost);
explicit DDSSession(DDSEnvironment env, Id existing_id);
explicit DDSSession(DDSEnvironment env, DDSRMSPlugin default_plugin, Id existing_id);
auto GetId() const -> Id;
auto GetDefaultPlugin() const -> DDSRMSPlugin;
auto IsRunning() const -> bool;
auto SubmitAgents(Quantity agents) -> void;
auto SubmitAgents(Quantity agents, DDSRMSPlugin plugin) -> void;
auto SubmitAgents(Quantity agents, DDSRMSPlugin plugin, const Path& config) -> void;
auto SubmitAgents(Quantity agents, const Path& config) -> void;
friend auto operator<<(std::ostream& os, DDSSession session) -> std::ostream&;
private:
struct Impl;
std::shared_ptr<Impl> fImpl;
};
} // namespace sdk
} // namespace mq
} // namespace fair
#endif /* FAIR_MQ_SDK_DDSSESSION_H */

54
fairmq/sdk/DDSTopology.h Normal file
View File

@ -0,0 +1,54 @@
/********************************************************************************
* Copyright (C) 2019 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
* *
* This software is distributed under the terms of the *
* GNU Lesser General Public Licence (LGPL) version 3, *
* copied verbatim in the file "LICENSE" *
********************************************************************************/
#ifndef FAIR_MQ_SDK_DDSTOPOLOGY_H
#define FAIR_MQ_SDK_DDSTOPOLOGY_H
#include <fairmq/sdk/DDSInfo.h>
#include <memory>
#include <string>
namespace dds {
namespace topology_api {
class CTopology;
} // namespace topology_api
} // namespace dds
namespace fair {
namespace mq {
namespace sdk {
/**
* @class DDSTopology DDSTopology.h <fairmq/sdk/DDSTopology.h>
* @brief Represents a DDS topology
*/
class DDSSession
{
public:
using CSessionPtr = std::shared_ptr<dds::tools_api::CSession>;
explicit DDSSession();
explicit DDSSession(std::string existing_session_id);
auto GetId() const -> const std::string&;
auto IsRunning() const -> bool;
private:
CSessionPtr fSession;
const std::string fId;
};
auto LoadDDSEnv(const std::string& config_home = "", const std::string& prefix = DDSInstallPrefix)
-> void;
} // namespace sdk
} // namespace mq
} // namespace fair
#endif /* FAIR_MQ_SDK_DDSTOPOLOGY_H */

View File

@ -0,0 +1,22 @@
/********************************************************************************
* Copyright (C) 2019 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
* *
* This software is distributed under the terms of the *
* GNU Lesser General Public Licence (LGPL) version 3, *
* copied verbatim in the file "LICENSE" *
********************************************************************************/
#include "Topology.h"
#include <utility>
namespace fair {
namespace mq {
namespace sdk {
Topology::Topology()
{}
} // namespace sdk
} // namespace mq
} // namespace fair

View File

@ -0,0 +1,37 @@
/********************************************************************************
* Copyright (C) 2019 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
* *
* This software is distributed under the terms of the *
* GNU Lesser General Public Licence (LGPL) version 3, *
* copied verbatim in the file "LICENSE" *
********************************************************************************/
#ifndef FAIR_MQ_SDK_TOPOLOGY_H
#define FAIR_MQ_SDK_TOPOLOGY_H
#include <memory>
namespace fair {
namespace mq {
namespace sdk {
/**
* @class Topology Topology.h <fairmq/sdk/Topology.h>
* @brief Represents a FairMQ topology
*/
class Topology
{
public:
/// Construct a FairMQ topology from a existing DDS session via the dds::topology_api
/// @param topo a shared_ptr to an initialized CTopology object
explicit Topology();
private:
};
} // namespace sdk
} // namespace mq
} // namespace fair
#endif /* FAIR_MQ_SDK_TOPOLOGY_H */

View File

@ -47,6 +47,7 @@ endif()
set(MQ_CONFIG "${CMAKE_BINARY_DIR}/test/testsuite_FairMQ.IOPatterns_config.json")
set(RUN_TEST_DEVICE "${CMAKE_BINARY_DIR}/test/testhelper_runTestDevice")
set(FAIRMQ_BIN_DIR ${CMAKE_BINARY_DIR}/fairmq)
set(SDK_TESTSUITE_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/sdk)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/protocols/config.json.in ${MQ_CONFIG})
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/runner.cxx.in ${CMAKE_CURRENT_BINARY_DIR}/runner.cxx)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/TestEnvironment.h.in ${CMAKE_CURRENT_BINARY_DIR}/TestEnvironment.h)
@ -280,3 +281,23 @@ add_testsuite(MemoryResources
${definitions}
)
if(BUILD_SDK)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/sdk/test_topo.xml
${CMAKE_BINARY_DIR}/test_topo.xml)
add_testsuite(SDK
SOURCES
${CMAKE_CURRENT_BINARY_DIR}/runner.cxx
sdk/_dds.cxx
sdk/_topology.cxx
sdk/TopologyFixture.h
LINKS
SDK
Tools
DDS::dds_tools_lib
INCLUDES ${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_BINARY_DIR}
TIMEOUT 15
${definitions}
)
endif()

View File

@ -10,5 +10,7 @@
#define FAIR_MQ_TEST_ENVIRONMENT_H
#define FAIRMQ_TEST_ENVIRONMENT "@FAIRMQ_BIN_DIR@"
#define SDK_TESTSUITE_SOURCE_DIR "@SDK_TESTSUITE_SOURCE_DIR@"
#define CMAKE_CURRENT_BINARY_DIR "@CMAKE_CURRENT_BINARY_DIR@"
#endif /* FAIR_MQ_TEST_ENVIRONMENT_H */

View File

@ -0,0 +1,79 @@
/********************************************************************************
* Copyright (C) 2019 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
* *
* This software is distributed under the terms of the *
* GNU Lesser General Public Licence (LGPL) version 3, *
* copied verbatim in the file "LICENSE" *
********************************************************************************/
#ifndef FAIR_MQ_TEST_TOPOLOGYFIXTURE
#define FAIR_MQ_TEST_TOPOLOGYFIXTURE
#include <DDS/Topology.h>
#include <TestEnvironment.h>
#include <fairlogger/Logger.h>
#include <fairmq/sdk/DDSSession.h>
#include <gtest/gtest.h>
namespace fair {
namespace mq {
namespace test {
struct Topology : ::testing::Test
{
Topology()
: mDDSTopologyFile(std::string(SDK_TESTSUITE_SOURCE_DIR) + "/test_topo.xml")
, mDDSEnv(CMAKE_CURRENT_BINARY_DIR)
, mDDSSession(mDDSEnv)
{
Logger::SetConsoleSeverity("debug");
Logger::DefineVerbosity("user1",
fair::VerbositySpec::Make(VerbositySpec::Info::timestamp_us,
VerbositySpec::Info::severity));
Logger::SetVerbosity("user1");
Logger::SetConsoleColor();
}
//
// auto WaitForIdleDDSAgents(int required) -> void {
// LOG(debug) << "WaitForIdleDDSAgents(" << required << ")";
//
// DDS Agent Info request
// dds::tools_api::SAgentInfoRequestData agentInfoInfo;
// auto agentInfoRequest = dds::tools_api::SAgentInfoRequest::makeRequest(agentInfoInfo);
// agentInfoRequest->setResponseCallback(
// [&](const dds::tools_api::SAgentInfoResponseData& _response) {
// LOG(debug) << "agent: " << _response.m_index << "/" << _response.m_activeAgentsCount;
// LOG(debug) << "info: " << _response.m_agentInfo;
// });
// agentInfoRequest->setMessageCallback(
// [](const dds::tools_api::SMessageResponseData& _message) { LOG(debug) << _message; });
// agentInfoRequest->setDoneCallback([&]() {
// mActiveDDSOps.Signal();
// });
// mDDSSession.sendRequest<dds::tools_api::SAgentInfoRequest>(agentInfoRequest);
// mActiveDDSOps.Wait();
// }
//
// auto ActivateDDSTopology(const std::string& topology_file) -> void {
// LOG(debug) << "ActivateDDSTopology(\"" << topology_file << "\")";
// }
auto SetUp() -> void override {
LOG(info) << mDDSEnv;
mDDSSession.SubmitAgents(1);
mDDSSession.SubmitAgents(1);
}
auto TearDown() -> void override {}
std::string mDDSTopologyFile;
sdk::DDSEnvironment mDDSEnv;
sdk::DDSSession mDDSSession;
};
} /* namespace test */
} /* namespace mq */
} /* namespace fair */
#endif /* FAIR_MQ_TEST_TOPOLOGYFIXTURE */

57
test/sdk/_dds.cxx Normal file
View File

@ -0,0 +1,57 @@
/********************************************************************************
* Copyright (C) 2019 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
* *
* This software is distributed under the terms of the *
* GNU Lesser General Public Licence (LGPL) version 3, *
* copied verbatim in the file "LICENSE" *
********************************************************************************/
#include <TestEnvironment.h>
#include <fairlogger/Logger.h>
#include <fairmq/sdk/DDSEnvironment.h>
#include <fairmq/sdk/DDSInfo.h>
#include <fairmq/sdk/DDSSession.h>
#include <gtest/gtest.h>
namespace {
auto session_test() -> void
{
fair::Logger::SetConsoleSeverity("debug");
fair::Logger::DefineVerbosity("user1",
fair::VerbositySpec::Make(fair::VerbositySpec::Info::timestamp_us,
fair::VerbositySpec::Info::severity));
fair::Logger::SetVerbosity("user1");
fair::Logger::SetConsoleColor();
fair::mq::sdk::DDSEnvironment env(CMAKE_CURRENT_BINARY_DIR);
LOG(debug) << env;
{
fair::mq::sdk::DDSSession session(env);
LOG(debug) << session;
session.SubmitAgents(5);
session.SubmitAgents(5);
}
{
fair::mq::sdk::DDSSession session(env);
LOG(debug) << session;
session.SubmitAgents(5);
}
{
fair::mq::sdk::DDSSession session(env);
LOG(debug) << session;
session.SubmitAgents(5);
}
}
TEST(DDS, Session)
{
session_test();
}
TEST(DDS, Session2)
{
session_test();
}
} // namespace

21
test/sdk/_topology.cxx Normal file
View File

@ -0,0 +1,21 @@
/********************************************************************************
* Copyright (C) 2019 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
* *
* This software is distributed under the terms of the *
* GNU Lesser General Public Licence (LGPL) version 3, *
* copied verbatim in the file "LICENSE" *
********************************************************************************/
// #include "TopologyFixture.h"
// #include <fairmq/sdk/Topology.h>
#include <fairmq/sdk/DDSSession.h>
namespace {
// TEST_F(Topology, Basic) { fair::mq::sdk::Topology topo; }
// TEST_F(Topology, Basic2) { fair::mq::sdk::Topology topo; }
} // namespace

50
test/sdk/test_topo.xml Normal file
View File

@ -0,0 +1,50 @@
<topology name="ExampleDDS">
<property name="data1" />
<property name="data2" />
<declrequirement name="SamplerWorker" type="wnname" value="sampler"/>
<declrequirement name="ProcessorWorker" type="wnname" value="processor"/>
<declrequirement name="SinkWorker" type="wnname" value="sink"/>
<decltask name="Sampler">
<exe reachable="true">@EX_BIN_DIR@/fairmq-ex-dds-sampler --id sampler --color false --channel-config name=data1,type=push,method=bind -S "&lt;@DDS_PLUGIN_LIB_DIR@/" -P dds</exe>
<requirements>
<name>SamplerWorker</name>
</requirements>
<properties>
<name access="write">data1</name>
</properties>
</decltask>
<decltask name="Processor">
<exe reachable="true">@EX_BIN_DIR@/fairmq-ex-dds-processor --id processor_%taskIndex% --config-key processor --color false --channel-config name=data1,type=pull,method=connect name=data2,type=push,method=connect -S "&lt;@DDS_PLUGIN_LIB_DIR@/" -P dds</exe>
<requirements>
<name>ProcessorWorker</name>
</requirements>
<properties>
<name access="read">data1</name>
<name access="read">data2</name>
</properties>
</decltask>
<decltask name="Sink">
<exe reachable="true">@EX_BIN_DIR@/fairmq-ex-dds-sink --id sink --color false --channel-config name=data2,type=pull,method=bind -S "&lt;@DDS_PLUGIN_LIB_DIR@/" -P dds</exe>
<requirements>
<name>SinkWorker</name>
</requirements>
<properties>
<name access="write">data2</name>
</properties>
</decltask>
<main name="main">
<task>Sampler</task>
<task>Sink</task>
<group name="ProcessorGroup" n="10">
<task>Processor</task>
</group>
</main>
</topology>