Use process tools for WaitFor test

This commit is contained in:
Alexey Rybalchenko
2019-03-19 16:34:51 +01:00
committed by Dennis Klein
parent 6809d60fad
commit 99ffb732f4
5 changed files with 70 additions and 43 deletions

View File

@@ -32,6 +32,7 @@ class ErrorState : public FairMQDevice
ChangeState(fair::mq::Transition::ErrorFound);
}
}
void Bind() override
{
std::string state("Bind");
@@ -40,6 +41,7 @@ class ErrorState : public FairMQDevice
ChangeState(fair::mq::Transition::ErrorFound);
}
}
void Connect() override
{
std::string state("Connect");

View File

@@ -32,6 +32,7 @@ class Exceptions : public FairMQDevice
throw std::runtime_error("exception in " + state + "()");
}
}
auto Bind() -> void override
{
std::string state("Bind");
@@ -39,6 +40,7 @@ class Exceptions : public FairMQDevice
throw std::runtime_error("exception in " + state + "()");
}
}
auto Connect() -> void override
{
std::string state("Connect");

View File

@@ -24,10 +24,34 @@ namespace test
class TestWaitFor : public FairMQDevice
{
public:
void Run()
void PreRun() override
{
std::cout << "hello" << std::endl;
WaitFor(std::chrono::seconds(60));
std::string state("PreRun");
if (std::string::npos != GetId().find("_" + state)) {
LOG(info) << "Going to sleep via WaitFor() in " << state << "...";
bool result = WaitFor(std::chrono::seconds(60));
LOG(info) << (result == true ? "Sleeping Done. Not interrupted." : "Sleeping Done. Interrupted.");
}
}
void Run() override
{
std::string state("Run");
if (std::string::npos != GetId().find("_" + state)) {
LOG(info) << "Going to sleep via WaitFor() in " << state << "...";
bool result = WaitFor(std::chrono::seconds(60));
LOG(info) << (result == true ? "Sleeping Done. Not interrupted." : "Sleeping Done. Interrupted.");
}
}
void PostRun() override
{
std::string state("PostRun");
if (std::string::npos != GetId().find("_" + state)) {
LOG(info) << "Going to sleep via WaitFor() in " << state << "...";
bool result = WaitFor(std::chrono::seconds(60));
LOG(info) << (result == true ? "Sleeping Done. Not interrupted." : "Sleeping Done. Interrupted.");
}
}
};