mirror of
https://github.com/FairRootGroup/FairMQ.git
synced 2025-10-17 10:31:46 +00:00
Compare commits
9 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
cf9a2944c2 | ||
|
94297f9833 | ||
|
957233cf95 | ||
|
5397cef9d1 | ||
|
f6c1f5dc0f | ||
|
c4145e9ef1 | ||
|
4123ebc9d4 | ||
|
88f897536e | ||
|
e3c55a0ff8 |
@@ -220,6 +220,9 @@ if(PROJECT_PACKAGE_DEPENDENCIES)
|
|||||||
get_filename_component(prefix ${msgpack_include}/.. ABSOLUTE)
|
get_filename_component(prefix ${msgpack_include}/.. ABSOLUTE)
|
||||||
elseif(${dep} STREQUAL OFI)
|
elseif(${dep} STREQUAL OFI)
|
||||||
get_filename_component(prefix ${${dep}_INCLUDE_DIRS}/.. ABSOLUTE)
|
get_filename_component(prefix ${${dep}_INCLUDE_DIRS}/.. ABSOLUTE)
|
||||||
|
elseif(${dep} STREQUAL nanomsg)
|
||||||
|
get_target_property(nn_include nanomsg INTERFACE_INCLUDE_DIRECTORIES)
|
||||||
|
get_filename_component(prefix ${nn_include}/.. ABSOLUTE)
|
||||||
elseif(${dep} STREQUAL Doxygen)
|
elseif(${dep} STREQUAL Doxygen)
|
||||||
get_target_property(doxygen_bin Doxygen::doxygen INTERFACE_LOCATION)
|
get_target_property(doxygen_bin Doxygen::doxygen INTERFACE_LOCATION)
|
||||||
get_filename_component(prefix ${doxygen_bin} DIRECTORY)
|
get_filename_component(prefix ${doxygen_bin} DIRECTORY)
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
<!-- {#mainpage} -->
|
<!-- {#mainpage} -->
|
||||||
# FairMQ [](COPYRIGHT) [](https://alfa-ci.gsi.de/blue/organizations/jenkins/FairRootGroup%2FFairMQ/branches) [](https://codecov.io/gh/FairRootGroup/FairMQ/branch/master)
|
# FairMQ [](COPYRIGHT) [](https://alfa-ci.gsi.de/blue/organizations/jenkins/FairRootGroup%2FFairMQ/branches) [](https://codecov.io/gh/FairRootGroup/FairMQ/branch/master) [](https://www.codacy.com/app/dennisklein/FairMQ?utm_source=github.com&utm_medium=referral&utm_content=FairRootGroup/FairMQ&utm_campaign=Badge_Grade)
|
||||||
|
|
||||||
C++ Message Queuing Library and Framework
|
C++ Message Queuing Library and Framework
|
||||||
|
|
||||||
|
@@ -23,6 +23,7 @@ set_and_check(@PROJECT_NAME@_CMAKEMODDIR @PACKAGE_CMAKE_INSTALL_PREFIX@/@PROJECT
|
|||||||
set(@PROJECT_NAME@_CXX_STANDARD_REQUIRED @CMAKE_CXX_STANDARD_REQUIRED@)
|
set(@PROJECT_NAME@_CXX_STANDARD_REQUIRED @CMAKE_CXX_STANDARD_REQUIRED@)
|
||||||
set(@PROJECT_NAME@_CXX_STANDARD @CMAKE_CXX_STANDARD@)
|
set(@PROJECT_NAME@_CXX_STANDARD @CMAKE_CXX_STANDARD@)
|
||||||
set(@PROJECT_NAME@_CXX_EXTENSIONS @CMAKE_CXX_EXTENSIONS@)
|
set(@PROJECT_NAME@_CXX_EXTENSIONS @CMAKE_CXX_EXTENSIONS@)
|
||||||
|
set(@PROJECT_NAME@_VERSION_HOTFIX @PROJECT_VERSION_HOTFIX@)
|
||||||
|
|
||||||
### Import cmake modules
|
### Import cmake modules
|
||||||
set(CMAKE_MODULE_PATH ${@PROJECT_NAME@_CMAKEMODDIR} ${CMAKE_MODULE_PATH})
|
set(CMAKE_MODULE_PATH ${@PROJECT_NAME@_CMAKEMODDIR} ${CMAKE_MODULE_PATH})
|
||||||
|
@@ -180,6 +180,12 @@ macro(set_fairmq_defaults)
|
|||||||
# Rationale in https://github.com/ninja-build/ninja/issues/814
|
# Rationale in https://github.com/ninja-build/ninja/issues/814
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fdiagnostics-color=always")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fdiagnostics-color=always")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(NOT PROJECT_VERSION_TWEAK)
|
||||||
|
set(PROJECT_VERSION_HOTFIX 0)
|
||||||
|
else()
|
||||||
|
set(PROJECT_VERSION_HOTFIX ${PROJECT_VERSION_TWEAK})
|
||||||
|
endif()
|
||||||
endmacro()
|
endmacro()
|
||||||
|
|
||||||
function(join VALUES GLUE OUTPUT)
|
function(join VALUES GLUE OUTPUT)
|
||||||
|
@@ -72,6 +72,9 @@ FairMQDevice::FairMQDevice(FairMQProgOptions* config, const fair::mq::tools::Ver
|
|||||||
, fVersion(version)
|
, fVersion(version)
|
||||||
, fRate(0.)
|
, fRate(0.)
|
||||||
, fRawCmdLineArgs()
|
, fRawCmdLineArgs()
|
||||||
|
, fInterrupted(false)
|
||||||
|
, fInterruptedCV()
|
||||||
|
, fInterruptedMtx()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -491,6 +494,10 @@ void FairMQDevice::RunWrapper()
|
|||||||
thread rateLogger(&FairMQDevice::LogSocketRates, this);
|
thread rateLogger(&FairMQDevice::LogSocketRates, this);
|
||||||
|
|
||||||
// notify transports to resume transfers
|
// notify transports to resume transfers
|
||||||
|
{
|
||||||
|
lock_guard<mutex> guard(fInterruptedMtx);
|
||||||
|
fInterrupted = false;
|
||||||
|
}
|
||||||
for (auto& t : fTransports)
|
for (auto& t : fTransports)
|
||||||
{
|
{
|
||||||
t.second->Resume();
|
t.second->Resume();
|
||||||
@@ -909,6 +916,7 @@ void FairMQDevice::LogSocketRates()
|
|||||||
|
|
||||||
t0 = t1;
|
t0 = t1;
|
||||||
this_thread::sleep_for(chrono::milliseconds(1000));
|
this_thread::sleep_for(chrono::milliseconds(1000));
|
||||||
|
// WaitFor(chrono::milliseconds(1000)); TODO: enable this when nanomsg linger is fixed
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -919,6 +927,11 @@ void FairMQDevice::Unblock()
|
|||||||
{
|
{
|
||||||
t.second->Interrupt();
|
t.second->Interrupt();
|
||||||
}
|
}
|
||||||
|
{
|
||||||
|
lock_guard<mutex> guard(fInterruptedMtx);
|
||||||
|
fInterrupted = true;
|
||||||
|
}
|
||||||
|
fInterruptedCV.notify_all();
|
||||||
}
|
}
|
||||||
|
|
||||||
void FairMQDevice::ResetTaskWrapper()
|
void FairMQDevice::ResetTaskWrapper()
|
||||||
|
@@ -25,6 +25,7 @@
|
|||||||
#include <memory> // unique_ptr
|
#include <memory> // unique_ptr
|
||||||
#include <algorithm> // std::sort()
|
#include <algorithm> // std::sort()
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <chrono>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
#include <functional>
|
#include <functional>
|
||||||
@@ -433,6 +434,16 @@ class FairMQDevice : public FairMQStateMachine
|
|||||||
|
|
||||||
void RunStateMachine() { ProcessWork(); };
|
void RunStateMachine() { ProcessWork(); };
|
||||||
|
|
||||||
|
/// Wait for the supplied amount of time or for interruption.
|
||||||
|
/// If interrupted, returns false, otherwise true.
|
||||||
|
/// @param duration wait duration
|
||||||
|
template<class Rep, class Period>
|
||||||
|
bool WaitFor(std::chrono::duration<Rep, Period> const& duration)
|
||||||
|
{
|
||||||
|
std::unique_lock<std::mutex> lock(fInterruptedMtx);
|
||||||
|
return !fInterruptedCV.wait_for(lock, duration, [&] { return fInterrupted.load(); }); // return true if no interruption happened
|
||||||
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
std::shared_ptr<FairMQTransportFactory> fTransportFactory; ///< Default transport factory
|
std::shared_ptr<FairMQTransportFactory> fTransportFactory; ///< Default transport factory
|
||||||
std::unordered_map<fair::mq::Transport, std::shared_ptr<FairMQTransportFactory>> fTransports; ///< Container for transports
|
std::unordered_map<fair::mq::Transport, std::shared_ptr<FairMQTransportFactory>> fTransports; ///< Container for transports
|
||||||
@@ -551,6 +562,10 @@ class FairMQDevice : public FairMQStateMachine
|
|||||||
const fair::mq::tools::Version fVersion;
|
const fair::mq::tools::Version fVersion;
|
||||||
float fRate; ///< Rate limiting for ConditionalRun
|
float fRate; ///< Rate limiting for ConditionalRun
|
||||||
std::vector<std::string> fRawCmdLineArgs;
|
std::vector<std::string> fRawCmdLineArgs;
|
||||||
|
|
||||||
|
std::atomic<bool> fInterrupted;
|
||||||
|
std::condition_variable fInterruptedCV;
|
||||||
|
std::mutex fInterruptedMtx;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* FAIRMQDEVICE_H_ */
|
#endif /* FAIRMQDEVICE_H_ */
|
||||||
|
@@ -9,10 +9,14 @@
|
|||||||
#ifndef FAIR_MQ_VERSION_H
|
#ifndef FAIR_MQ_VERSION_H
|
||||||
|
|
||||||
#define FAIRMQ_VERSION "@PROJECT_VERSION@"
|
#define FAIRMQ_VERSION "@PROJECT_VERSION@"
|
||||||
#define FAIRMQ_VERSION_DEC (@PROJECT_VERSION_MAJOR@ * 10000) + (@PROJECT_VERSION_MINOR@ * 100) + @PROJECT_VERSION_PATCH@
|
#define FAIRMQ_VERSION_DEC (@PROJECT_VERSION_MAJOR@ * 100000) \
|
||||||
|
+ (@PROJECT_VERSION_MINOR@ * 1000) \
|
||||||
|
+ (@PROJECT_VERSION_PATCH@ * 10) \
|
||||||
|
+ @PROJECT_VERSION_HOTFIX@
|
||||||
#define FAIRMQ_VERSION_MAJOR @PROJECT_VERSION_MAJOR@
|
#define FAIRMQ_VERSION_MAJOR @PROJECT_VERSION_MAJOR@
|
||||||
#define FAIRMQ_VERSION_MINOR @PROJECT_VERSION_MINOR@
|
#define FAIRMQ_VERSION_MINOR @PROJECT_VERSION_MINOR@
|
||||||
#define FAIRMQ_VERSION_PATCH @PROJECT_VERSION_PATCH@
|
#define FAIRMQ_VERSION_PATCH @PROJECT_VERSION_PATCH@
|
||||||
|
#define FAIRMQ_VERSION_HOTFIX @PROJECT_VERSION_HOTFIX@
|
||||||
#define FAIRMQ_GIT_VERSION "@PROJECT_GIT_VERSION@"
|
#define FAIRMQ_GIT_VERSION "@PROJECT_GIT_VERSION@"
|
||||||
#define FAIRMQ_GIT_DATE "@PROJECT_GIT_DATE@"
|
#define FAIRMQ_GIT_DATE "@PROJECT_GIT_DATE@"
|
||||||
#define FAIRMQ_REPO_URL "https://github.com/FairRootGroup/FairMQ"
|
#define FAIRMQ_REPO_URL "https://github.com/FairRootGroup/FairMQ"
|
||||||
|
@@ -12,12 +12,13 @@
|
|||||||
#include <poll.h> // for the interactive mode
|
#include <poll.h> // for the interactive mode
|
||||||
#include <csignal> // catching system signals
|
#include <csignal> // catching system signals
|
||||||
#include <functional>
|
#include <functional>
|
||||||
|
#include <atomic>
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
volatile sig_atomic_t gSignalStatus = 0;
|
std::atomic<sig_atomic_t> gSignalStatus(0);
|
||||||
|
|
||||||
extern "C" auto signal_handler(int signal) -> void
|
extern "C" auto signal_handler(int signal) -> void
|
||||||
{
|
{
|
||||||
|
@@ -10,6 +10,7 @@
|
|||||||
#define FAIR_MQ_PLUGINS_CONTROL
|
#define FAIR_MQ_PLUGINS_CONTROL
|
||||||
|
|
||||||
#include <fairmq/Plugin.h>
|
#include <fairmq/Plugin.h>
|
||||||
|
#include <fairmq/Version.h>
|
||||||
|
|
||||||
#include <condition_variable>
|
#include <condition_variable>
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
@@ -57,13 +58,16 @@ class Control : public Plugin
|
|||||||
auto ControlPluginProgramOptions() -> Plugin::ProgOptions;
|
auto ControlPluginProgramOptions() -> Plugin::ProgOptions;
|
||||||
|
|
||||||
REGISTER_FAIRMQ_PLUGIN(
|
REGISTER_FAIRMQ_PLUGIN(
|
||||||
Control, // Class name
|
Control, // Class name
|
||||||
control, // Plugin name (string, lower case chars only)
|
control, // Plugin name (string, lower case chars only)
|
||||||
(Plugin::Version{1,0,1}), // Version
|
(Plugin::Version{FAIRMQ_VERSION_MAJOR,
|
||||||
"FairRootGroup <fairroot@gsi.de>", // Maintainer
|
FAIRMQ_VERSION_MINOR,
|
||||||
"https://github.com/FairRootGroup/FairRoot", // Homepage
|
FAIRMQ_VERSION_PATCH}), // Version
|
||||||
ControlPluginProgramOptions // Free function which declares custom program options for the plugin
|
"FairRootGroup <fairroot@gsi.de>", // Maintainer
|
||||||
// signature: () -> boost::optional<boost::program_options::options_description>
|
"https://github.com/FairRootGroup/FairRoot", // Homepage
|
||||||
|
ControlPluginProgramOptions // Free function which declares custom program options for the
|
||||||
|
// plugin signature: () ->
|
||||||
|
// boost::optional<boost::program_options::options_description>
|
||||||
)
|
)
|
||||||
|
|
||||||
} /* namespace plugins */
|
} /* namespace plugins */
|
||||||
|
@@ -26,6 +26,7 @@ add_testhelper(runTestDevice
|
|||||||
helper/devices/TestReq.cxx
|
helper/devices/TestReq.cxx
|
||||||
helper/devices/TestSub.cxx
|
helper/devices/TestSub.cxx
|
||||||
helper/devices/TestTransferTimeout.cxx
|
helper/devices/TestTransferTimeout.cxx
|
||||||
|
helper/devices/TestWaitFor.cxx
|
||||||
|
|
||||||
LINKS FairMQ
|
LINKS FairMQ
|
||||||
)
|
)
|
||||||
@@ -38,23 +39,22 @@ set(MQ_CONFIG "${CMAKE_BINARY_DIR}/test/testsuite_FairMQ.IOPatterns_config.json"
|
|||||||
set(RUN_TEST_DEVICE "${CMAKE_BINARY_DIR}/test/testhelper_runTestDevice")
|
set(RUN_TEST_DEVICE "${CMAKE_BINARY_DIR}/test/testhelper_runTestDevice")
|
||||||
set(FAIRMQ_BIN_DIR ${CMAKE_BINARY_DIR}/fairmq)
|
set(FAIRMQ_BIN_DIR ${CMAKE_BINARY_DIR}/fairmq)
|
||||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/protocols/config.json.in ${MQ_CONFIG})
|
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/protocols/config.json.in ${MQ_CONFIG})
|
||||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/protocols/runner.cxx.in ${CMAKE_CURRENT_BINARY_DIR}/protocols/runner.cxx)
|
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)
|
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/TestEnvironment.h.in ${CMAKE_CURRENT_BINARY_DIR}/TestEnvironment.h)
|
||||||
|
|
||||||
add_testsuite(FairMQ.Protocols
|
add_testsuite(FairMQ.Protocols
|
||||||
SOURCES
|
SOURCES
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/protocols/runner.cxx
|
${CMAKE_CURRENT_BINARY_DIR}/runner.cxx
|
||||||
protocols/_pair.cxx
|
protocols/_pair.cxx
|
||||||
protocols/_poller.cxx
|
|
||||||
protocols/_pub_sub.cxx
|
protocols/_pub_sub.cxx
|
||||||
protocols/_push_pull.cxx
|
protocols/_push_pull.cxx
|
||||||
protocols/_req_rep.cxx
|
protocols/_req_rep.cxx
|
||||||
protocols/_transfer_timeout.cxx
|
|
||||||
protocols/_push_pull_multipart.cxx
|
protocols/_push_pull_multipart.cxx
|
||||||
|
|
||||||
LINKS FairMQ
|
LINKS FairMQ
|
||||||
DEPENDS testhelper_runTestDevice
|
DEPENDS testhelper_runTestDevice
|
||||||
INCLUDES ${CMAKE_CURRENT_SOURCE_DIR}/protocols
|
INCLUDES ${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/protocols
|
||||||
${CMAKE_CURRENT_BINARY_DIR}
|
${CMAKE_CURRENT_BINARY_DIR}
|
||||||
TIMEOUT 30
|
TIMEOUT 30
|
||||||
RUN_SERIAL ON
|
RUN_SERIAL ON
|
||||||
@@ -63,22 +63,24 @@ add_testsuite(FairMQ.Protocols
|
|||||||
|
|
||||||
add_testsuite(FairMQ.Parts
|
add_testsuite(FairMQ.Parts
|
||||||
SOURCES
|
SOURCES
|
||||||
parts/runner.cxx
|
${CMAKE_CURRENT_BINARY_DIR}/runner.cxx
|
||||||
parts/_iterator_interface.cxx
|
parts/_iterator_interface.cxx
|
||||||
|
|
||||||
LINKS FairMQ
|
LINKS FairMQ
|
||||||
INCLUDES ${CMAKE_CURRENT_SOURCE_DIR}/parts
|
INCLUDES ${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/parts
|
||||||
${CMAKE_CURRENT_BINARY_DIR}
|
${CMAKE_CURRENT_BINARY_DIR}
|
||||||
TIMEOUT 5
|
TIMEOUT 5
|
||||||
)
|
)
|
||||||
|
|
||||||
add_testsuite(FairMQ.MessageResize
|
add_testsuite(FairMQ.MessageResize
|
||||||
SOURCES
|
SOURCES
|
||||||
message_resize/runner.cxx
|
${CMAKE_CURRENT_BINARY_DIR}/runner.cxx
|
||||||
message_resize/_message_resize.cxx
|
message_resize/_message_resize.cxx
|
||||||
|
|
||||||
LINKS FairMQ
|
LINKS FairMQ
|
||||||
INCLUDES ${CMAKE_CURRENT_SOURCE_DIR}/message_resize
|
INCLUDES ${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/message_resize
|
||||||
${CMAKE_CURRENT_BINARY_DIR}
|
${CMAKE_CURRENT_BINARY_DIR}
|
||||||
TIMEOUT 5
|
TIMEOUT 5
|
||||||
${definitions}
|
${definitions}
|
||||||
@@ -86,15 +88,18 @@ add_testsuite(FairMQ.MessageResize
|
|||||||
|
|
||||||
add_testsuite(FairMQ.Device
|
add_testsuite(FairMQ.Device
|
||||||
SOURCES
|
SOURCES
|
||||||
|
${CMAKE_CURRENT_BINARY_DIR}/runner.cxx
|
||||||
device/TestSender.h
|
device/TestSender.h
|
||||||
device/TestReceiver.h
|
device/TestReceiver.h
|
||||||
device/runner.cxx
|
|
||||||
device/_multiple_devices.cxx
|
device/_multiple_devices.cxx
|
||||||
device/_device_version.cxx
|
device/_device_version.cxx
|
||||||
device/_device_config.cxx
|
device/_device_config.cxx
|
||||||
|
device/_waitfor.cxx
|
||||||
|
|
||||||
LINKS FairMQ
|
LINKS FairMQ
|
||||||
INCLUDES ${CMAKE_CURRENT_SOURCE_DIR}/device
|
DEPENDS testhelper_runTestDevice
|
||||||
|
INCLUDES ${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/device
|
||||||
${CMAKE_CURRENT_BINARY_DIR}
|
${CMAKE_CURRENT_BINARY_DIR}
|
||||||
TIMEOUT 5
|
TIMEOUT 5
|
||||||
RUN_SERIAL ON
|
RUN_SERIAL ON
|
||||||
@@ -134,54 +139,81 @@ add_testlib(FairMQPlugin_test_dummy2
|
|||||||
|
|
||||||
add_testsuite(FairMQ.Plugins
|
add_testsuite(FairMQ.Plugins
|
||||||
SOURCES
|
SOURCES
|
||||||
plugins/runner.cxx
|
${CMAKE_CURRENT_BINARY_DIR}/runner.cxx
|
||||||
plugins/_plugin.cxx
|
plugins/_plugin.cxx
|
||||||
plugins/_plugin_manager.cxx
|
plugins/_plugin_manager.cxx
|
||||||
|
|
||||||
LINKS FairMQ
|
LINKS FairMQ
|
||||||
INCLUDES ${CMAKE_CURRENT_BINARY_DIR}
|
INCLUDES ${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
|
${CMAKE_CURRENT_BINARY_DIR}
|
||||||
DEPENDS FairMQPlugin_test_dummy FairMQPlugin_test_dummy2
|
DEPENDS FairMQPlugin_test_dummy FairMQPlugin_test_dummy2
|
||||||
TIMEOUT 10
|
TIMEOUT 10
|
||||||
)
|
)
|
||||||
|
|
||||||
add_testsuite(FairMQ.PluginsPrelinked
|
add_testsuite(FairMQ.PluginsPrelinked
|
||||||
SOURCES
|
SOURCES
|
||||||
plugins/runner.cxx
|
${CMAKE_CURRENT_BINARY_DIR}/runner.cxx
|
||||||
plugins/_plugin_manager_prelink.cxx
|
plugins/_plugin_manager_prelink.cxx
|
||||||
|
|
||||||
LINKS FairMQ FairMQPlugin_test_dummy FairMQPlugin_test_dummy2
|
LINKS FairMQ FairMQPlugin_test_dummy FairMQPlugin_test_dummy2
|
||||||
INCLUDES ${CMAKE_CURRENT_BINARY_DIR}
|
INCLUDES ${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
|
${CMAKE_CURRENT_BINARY_DIR}
|
||||||
TIMEOUT 10
|
TIMEOUT 10
|
||||||
)
|
)
|
||||||
|
|
||||||
add_testsuite(FairMQ.PluginServices
|
add_testsuite(FairMQ.PluginServices
|
||||||
SOURCES
|
SOURCES
|
||||||
plugin_services/runner.cxx
|
${CMAKE_CURRENT_BINARY_DIR}/runner.cxx
|
||||||
plugin_services/_config.cxx
|
plugin_services/_config.cxx
|
||||||
plugin_services/_control.cxx
|
plugin_services/_control.cxx
|
||||||
plugin_services/Fixture.h
|
plugin_services/Fixture.h
|
||||||
|
|
||||||
LINKS FairMQ
|
LINKS FairMQ
|
||||||
INCLUDES ${CMAKE_CURRENT_BINARY_DIR}
|
INCLUDES ${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
|
${CMAKE_CURRENT_BINARY_DIR}
|
||||||
TIMEOUT 10
|
TIMEOUT 10
|
||||||
)
|
)
|
||||||
|
|
||||||
add_testsuite(FairMQ.EventManager
|
add_testsuite(FairMQ.EventManager
|
||||||
SOURCES
|
SOURCES
|
||||||
event_manager/runner.cxx
|
${CMAKE_CURRENT_BINARY_DIR}/runner.cxx
|
||||||
event_manager/_event_manager.cxx
|
event_manager/_event_manager.cxx
|
||||||
|
|
||||||
LINKS FairMQ
|
LINKS FairMQ
|
||||||
INCLUDES ${CMAKE_CURRENT_BINARY_DIR}
|
INCLUDES ${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
|
${CMAKE_CURRENT_BINARY_DIR}
|
||||||
TIMEOUT 10
|
TIMEOUT 10
|
||||||
)
|
)
|
||||||
|
|
||||||
add_testsuite(FairMQ.StateMachine
|
add_testsuite(FairMQ.StateMachine
|
||||||
SOURCES
|
SOURCES
|
||||||
state_machine/runner.cxx
|
${CMAKE_CURRENT_BINARY_DIR}/runner.cxx
|
||||||
state_machine/_state_machine.cxx
|
state_machine/_state_machine.cxx
|
||||||
|
|
||||||
LINKS FairMQ
|
LINKS FairMQ
|
||||||
INCLUDES ${CMAKE_CURRENT_BINARY_DIR}
|
INCLUDES ${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
|
${CMAKE_CURRENT_BINARY_DIR}
|
||||||
|
TIMEOUT 10
|
||||||
|
)
|
||||||
|
|
||||||
|
add_testsuite(FairMQ.Transport
|
||||||
|
SOURCES
|
||||||
|
${CMAKE_CURRENT_BINARY_DIR}/runner.cxx
|
||||||
|
transport/_transfer_timeout.cxx
|
||||||
|
|
||||||
|
LINKS FairMQ
|
||||||
|
INCLUDES ${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
|
${CMAKE_CURRENT_BINARY_DIR}
|
||||||
|
TIMEOUT 10
|
||||||
|
)
|
||||||
|
|
||||||
|
add_testsuite(FairMQ.Poller
|
||||||
|
SOURCES
|
||||||
|
${CMAKE_CURRENT_BINARY_DIR}/runner.cxx
|
||||||
|
poller/_poller.cxx
|
||||||
|
|
||||||
|
LINKS FairMQ
|
||||||
|
INCLUDES ${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
|
${CMAKE_CURRENT_BINARY_DIR}
|
||||||
TIMEOUT 10
|
TIMEOUT 10
|
||||||
)
|
)
|
||||||
|
74
test/device/_waitfor.cxx
Normal file
74
test/device/_waitfor.cxx
Normal file
@@ -0,0 +1,74 @@
|
|||||||
|
/********************************************************************************
|
||||||
|
* Copyright (C) 2014-2018 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 "runner.h"
|
||||||
|
|
||||||
|
#include <gtest/gtest.h>
|
||||||
|
#include <boost/process.hpp>
|
||||||
|
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <signal.h>
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
#include <thread>
|
||||||
|
#include <chrono>
|
||||||
|
#include <iostream>
|
||||||
|
#include <future> // std::async, std::future
|
||||||
|
|
||||||
|
namespace
|
||||||
|
{
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
using namespace fair::mq::test;
|
||||||
|
|
||||||
|
void RunWaitFor()
|
||||||
|
{
|
||||||
|
std::mutex mtx;
|
||||||
|
std::condition_variable cv;
|
||||||
|
|
||||||
|
int pid = 0;
|
||||||
|
int exit_code = 0;
|
||||||
|
|
||||||
|
thread deviceThread([&]() {
|
||||||
|
stringstream cmd;
|
||||||
|
cmd << runTestDevice << " --id waitfor_" << " --control static " << " --severity nolog";
|
||||||
|
|
||||||
|
boost::process::ipstream stdout;
|
||||||
|
boost::process::child c(cmd.str(), boost::process::std_out > stdout);
|
||||||
|
string line;
|
||||||
|
getline(stdout, line);
|
||||||
|
|
||||||
|
{
|
||||||
|
std::lock_guard<std::mutex> lock(mtx);
|
||||||
|
pid = c.id();
|
||||||
|
}
|
||||||
|
cv.notify_one();
|
||||||
|
|
||||||
|
c.wait();
|
||||||
|
|
||||||
|
exit_code = c.exit_code();
|
||||||
|
});
|
||||||
|
|
||||||
|
{
|
||||||
|
std::unique_lock<std::mutex> lock(mtx);
|
||||||
|
cv.wait(lock, [&pid]{ return pid != 0; });
|
||||||
|
}
|
||||||
|
|
||||||
|
kill(pid, SIGINT);
|
||||||
|
|
||||||
|
deviceThread.join();
|
||||||
|
|
||||||
|
exit(exit_code);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(Device, WaitFor)
|
||||||
|
{
|
||||||
|
EXPECT_EXIT(RunWaitFor(), ::testing::ExitedWithCode(0), "");
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace
|
@@ -1,19 +0,0 @@
|
|||||||
/********************************************************************************
|
|
||||||
* Copyright (C) 2017 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 <gtest/gtest.h>
|
|
||||||
|
|
||||||
auto main(int argc, char** argv) -> int
|
|
||||||
{
|
|
||||||
::testing::InitGoogleTest(&argc, argv);
|
|
||||||
::testing::FLAGS_gtest_death_test_style = "threadsafe";
|
|
||||||
setenv("FAIRMQ_PATH", FAIRMQ_TEST_ENVIRONMENT, 0);
|
|
||||||
return RUN_ALL_TESTS();
|
|
||||||
}
|
|
@@ -1,20 +1,33 @@
|
|||||||
/********************************************************************************
|
/********************************************************************************
|
||||||
* Copyright (C) 2017 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
|
* Copyright (C) 2015-2017 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
|
||||||
* *
|
* *
|
||||||
* This software is distributed under the terms of the *
|
* This software is distributed under the terms of the *
|
||||||
* GNU Lesser General Public Licence (LGPL) version 3, *
|
* GNU Lesser General Public Licence (LGPL) version 3, *
|
||||||
* copied verbatim in the file "LICENSE" *
|
* copied verbatim in the file "LICENSE" *
|
||||||
********************************************************************************/
|
********************************************************************************/
|
||||||
|
|
||||||
#include <TestEnvironment.h>
|
#include <FairMQDevice.h>
|
||||||
|
#include <FairMQLogger.h>
|
||||||
|
|
||||||
#include <gtest/gtest.h>
|
#include <iostream>
|
||||||
#include <stdlib.h>
|
|
||||||
|
|
||||||
auto main(int argc, char** argv) -> int
|
namespace fair
|
||||||
{
|
{
|
||||||
::testing::InitGoogleTest(&argc, argv);
|
namespace mq
|
||||||
::testing::FLAGS_gtest_death_test_style = "threadsafe";
|
{
|
||||||
setenv("FAIRMQ_PATH", FAIRMQ_TEST_ENVIRONMENT, 0);
|
namespace test
|
||||||
return RUN_ALL_TESTS();
|
{
|
||||||
}
|
|
||||||
|
class TestWaitFor : public FairMQDevice
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
void Run()
|
||||||
|
{
|
||||||
|
std::cout << "hello" << std::endl;
|
||||||
|
WaitFor(std::chrono::seconds(60));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace test
|
||||||
|
} // namespace mq
|
||||||
|
} // namespace fair
|
@@ -17,9 +17,12 @@
|
|||||||
#include "devices/TestReq.cxx"
|
#include "devices/TestReq.cxx"
|
||||||
#include "devices/TestSub.cxx"
|
#include "devices/TestSub.cxx"
|
||||||
#include "devices/TestTransferTimeout.cxx"
|
#include "devices/TestTransferTimeout.cxx"
|
||||||
|
#include "devices/TestWaitFor.cxx"
|
||||||
|
|
||||||
|
#include <runFairMQDevice.h>
|
||||||
|
|
||||||
#include <boost/program_options.hpp>
|
#include <boost/program_options.hpp>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <runFairMQDevice.h>
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
namespace bpo = boost::program_options;
|
namespace bpo = boost::program_options;
|
||||||
@@ -80,6 +83,10 @@ auto getDevice(const FairMQProgOptions& config) -> FairMQDevicePtr
|
|||||||
{
|
{
|
||||||
return new PairRight;
|
return new PairRight;
|
||||||
}
|
}
|
||||||
|
else if (0 == id.find("waitfor_"))
|
||||||
|
{
|
||||||
|
return new TestWaitFor;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
cerr << "Don't know id '" << id << "'" << endl;
|
cerr << "Don't know id '" << id << "'" << endl;
|
||||||
|
@@ -1,19 +0,0 @@
|
|||||||
/********************************************************************************
|
|
||||||
* Copyright (C) 2017 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 <gtest/gtest.h>
|
|
||||||
|
|
||||||
auto main(int argc, char** argv) -> int
|
|
||||||
{
|
|
||||||
::testing::InitGoogleTest(&argc, argv);
|
|
||||||
::testing::FLAGS_gtest_death_test_style = "threadsafe";
|
|
||||||
setenv("FAIRMQ_PATH", FAIRMQ_TEST_ENVIRONMENT, 0);
|
|
||||||
return RUN_ALL_TESTS();
|
|
||||||
}
|
|
@@ -1,16 +0,0 @@
|
|||||||
/********************************************************************************
|
|
||||||
* Copyright (C) 2017 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 <gtest/gtest.h>
|
|
||||||
|
|
||||||
auto main(int argc, char** argv) -> int
|
|
||||||
{
|
|
||||||
::testing::InitGoogleTest(&argc, argv);
|
|
||||||
::testing::FLAGS_gtest_death_test_style = "threadsafe";
|
|
||||||
return RUN_ALL_TESTS();
|
|
||||||
}
|
|
@@ -1,19 +0,0 @@
|
|||||||
/********************************************************************************
|
|
||||||
* Copyright (C) 2017 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 <gtest/gtest.h>
|
|
||||||
|
|
||||||
int main(int argc, char** argv)
|
|
||||||
{
|
|
||||||
::testing::InitGoogleTest(&argc, argv);
|
|
||||||
::testing::FLAGS_gtest_death_test_style = "threadsafe";
|
|
||||||
setenv("FAIRMQ_PATH", FAIRMQ_TEST_ENVIRONMENT, 0);
|
|
||||||
return RUN_ALL_TESTS();
|
|
||||||
}
|
|
@@ -1,19 +0,0 @@
|
|||||||
/********************************************************************************
|
|
||||||
* Copyright (C) 2017 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 <gtest/gtest.h>
|
|
||||||
|
|
||||||
int main(int argc, char** argv)
|
|
||||||
{
|
|
||||||
::testing::InitGoogleTest(&argc, argv);
|
|
||||||
::testing::FLAGS_gtest_death_test_style = "threadsafe";
|
|
||||||
setenv("FAIRMQ_PATH", FAIRMQ_TEST_ENVIRONMENT, 0);
|
|
||||||
return RUN_ALL_TESTS();
|
|
||||||
}
|
|
@@ -6,13 +6,12 @@
|
|||||||
* copied verbatim in the file "LICENSE" *
|
* copied verbatim in the file "LICENSE" *
|
||||||
********************************************************************************/
|
********************************************************************************/
|
||||||
|
|
||||||
#include "runner.h"
|
#include <runner.h>
|
||||||
#include <TestEnvironment.h>
|
#include <TestEnvironment.h>
|
||||||
|
|
||||||
#include <gtest/gtest.h>
|
#include <gtest/gtest.h>
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <iostream>
|
|
||||||
|
|
||||||
namespace fair
|
namespace fair
|
||||||
{
|
{
|
||||||
@@ -30,7 +29,7 @@ string mqConfig = "@MQ_CONFIG@";
|
|||||||
} /* namespace mq */
|
} /* namespace mq */
|
||||||
} /* namespace fair */
|
} /* namespace fair */
|
||||||
|
|
||||||
auto main(int argc, char** argv) -> int
|
int main(int argc, char** argv)
|
||||||
{
|
{
|
||||||
::testing::InitGoogleTest(&argc, argv);
|
::testing::InitGoogleTest(&argc, argv);
|
||||||
::testing::FLAGS_gtest_death_test_style = "threadsafe";
|
::testing::FLAGS_gtest_death_test_style = "threadsafe";
|
@@ -1,19 +0,0 @@
|
|||||||
/********************************************************************************
|
|
||||||
* Copyright (C) 2017 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 <gtest/gtest.h>
|
|
||||||
|
|
||||||
auto main(int argc, char** argv) -> int
|
|
||||||
{
|
|
||||||
::testing::InitGoogleTest(&argc, argv);
|
|
||||||
::testing::FLAGS_gtest_death_test_style = "threadsafe";
|
|
||||||
setenv("FAIRMQ_PATH", FAIRMQ_TEST_ENVIRONMENT, 0);
|
|
||||||
return RUN_ALL_TESTS();
|
|
||||||
}
|
|
Reference in New Issue
Block a user