Fix nanomsg tests

This commit is contained in:
Alexey Rybalchenko 2017-02-27 16:40:07 +01:00 committed by Mohammad Al-Turany
parent 07b760218f
commit c78b7e4cfa
7 changed files with 77 additions and 17 deletions

View File

@ -15,6 +15,9 @@
#include "FairMQLogger.h" #include "FairMQLogger.h"
#include "FairMQTestPub.h" #include "FairMQTestPub.h"
#include <chrono>
#include <thread>
int main(int argc, char** argv) int main(int argc, char** argv)
{ {
reinit_logger(false); reinit_logger(false);
@ -67,6 +70,12 @@ int main(int argc, char** argv)
testPub.ChangeState("RUN"); testPub.ChangeState("RUN");
testPub.WaitForEndOfState("RUN"); testPub.WaitForEndOfState("RUN");
// nanomsg does not implement the LINGER option. Give the sockets some time before their queues are terminated
if (transport == "nanomsg")
{
std::this_thread::sleep_for(std::chrono::seconds(1));
}
testPub.ChangeState("RESET_TASK"); testPub.ChangeState("RESET_TASK");
testPub.WaitForEndOfState("RESET_TASK"); testPub.WaitForEndOfState("RESET_TASK");

View File

@ -12,11 +12,13 @@
* @author A. Rybalchenko * @author A. Rybalchenko
*/ */
#include <string>
#include "FairMQLogger.h" #include "FairMQLogger.h"
#include "FairMQTestSub.h" #include "FairMQTestSub.h"
#include <string>
#include <chrono>
#include <thread>
int main(int argc, char** argv) int main(int argc, char** argv)
{ {
reinit_logger(false); reinit_logger(false);
@ -70,6 +72,12 @@ int main(int argc, char** argv)
testSub.ChangeState("RUN"); testSub.ChangeState("RUN");
testSub.WaitForEndOfState("RUN"); testSub.WaitForEndOfState("RUN");
// nanomsg does not implement the LINGER option. Give the sockets some time before their queues are terminated
if (transport == "nanomsg")
{
std::this_thread::sleep_for(std::chrono::seconds(1));
}
testSub.ChangeState("RESET_TASK"); testSub.ChangeState("RESET_TASK");
testSub.WaitForEndOfState("RESET_TASK"); testSub.WaitForEndOfState("RESET_TASK");

View File

@ -15,6 +15,9 @@
#include "FairMQLogger.h" #include "FairMQLogger.h"
#include "FairMQTestPull.h" #include "FairMQTestPull.h"
#include <chrono>
#include <thread>
int main(int argc, char** argv) int main(int argc, char** argv)
{ {
reinit_logger(false); reinit_logger(false);
@ -59,6 +62,12 @@ int main(int argc, char** argv)
testPull.ChangeState("RUN"); testPull.ChangeState("RUN");
testPull.WaitForEndOfState("RUN"); testPull.WaitForEndOfState("RUN");
// nanomsg does not implement the LINGER option. Give the sockets some time before their queues are terminated
if (transport == "nanomsg")
{
std::this_thread::sleep_for(std::chrono::seconds(1));
}
testPull.ChangeState("RESET_TASK"); testPull.ChangeState("RESET_TASK");
testPull.WaitForEndOfState("RESET_TASK"); testPull.WaitForEndOfState("RESET_TASK");

View File

@ -15,6 +15,9 @@
#include "FairMQLogger.h" #include "FairMQLogger.h"
#include "FairMQTestPush.h" #include "FairMQTestPush.h"
#include <chrono>
#include <thread>
int main(int argc, char** argv) int main(int argc, char** argv)
{ {
reinit_logger(false); reinit_logger(false);
@ -60,6 +63,12 @@ int main(int argc, char** argv)
testPush.ChangeState("RUN"); testPush.ChangeState("RUN");
testPush.WaitForEndOfState("RUN"); testPush.WaitForEndOfState("RUN");
// nanomsg does not implement the LINGER option. Give the sockets some time before their queues are terminated
if (transport == "nanomsg")
{
std::this_thread::sleep_for(std::chrono::seconds(1));
}
testPush.ChangeState("RESET_TASK"); testPush.ChangeState("RESET_TASK");
testPush.WaitForEndOfState("RESET_TASK"); testPush.WaitForEndOfState("RESET_TASK");

View File

@ -12,11 +12,13 @@
* @author A. Rybalchenko * @author A. Rybalchenko
*/ */
#include <iostream>
#include "FairMQLogger.h" #include "FairMQLogger.h"
#include "FairMQTestRep.h" #include "FairMQTestRep.h"
#include <iostream>
#include <chrono>
#include <thread>
int main(int argc, char** argv) int main(int argc, char** argv)
{ {
reinit_logger(false); reinit_logger(false);
@ -61,6 +63,12 @@ int main(int argc, char** argv)
testRep.ChangeState("RUN"); testRep.ChangeState("RUN");
testRep.WaitForEndOfState("RUN"); testRep.WaitForEndOfState("RUN");
// nanomsg does not implement the LINGER option. Give the sockets some time before their queues are terminated
if (transport == "nanomsg")
{
std::this_thread::sleep_for(std::chrono::seconds(1));
}
testRep.ChangeState("RESET_TASK"); testRep.ChangeState("RESET_TASK");
testRep.WaitForEndOfState("RESET_TASK"); testRep.WaitForEndOfState("RESET_TASK");

View File

@ -12,11 +12,13 @@
* @author A. Rybalchenko * @author A. Rybalchenko
*/ */
#include <iostream>
#include "FairMQLogger.h" #include "FairMQLogger.h"
#include "FairMQTestReq.h" #include "FairMQTestReq.h"
#include <iostream>
#include <chrono>
#include <thread>
int main(int argc, char** argv) int main(int argc, char** argv)
{ {
reinit_logger(false); reinit_logger(false);
@ -62,6 +64,12 @@ int main(int argc, char** argv)
testReq.ChangeState("RUN"); testReq.ChangeState("RUN");
testReq.WaitForEndOfState("RUN"); testReq.WaitForEndOfState("RUN");
// nanomsg does not implement the LINGER option. Give the sockets some time before their queues are terminated
if (transport == "nanomsg")
{
std::this_thread::sleep_for(std::chrono::seconds(1));
}
testReq.ChangeState("RESET_TASK"); testReq.ChangeState("RESET_TASK");
testReq.WaitForEndOfState("RESET_TASK"); testReq.WaitForEndOfState("RESET_TASK");

View File

@ -15,6 +15,9 @@
#include "FairMQLogger.h" #include "FairMQLogger.h"
#include "FairMQDevice.h" #include "FairMQDevice.h"
#include <chrono>
#include <thread>
class TransferTimeoutTester : public FairMQDevice class TransferTimeoutTester : public FairMQDevice
{ {
public: public:
@ -110,22 +113,28 @@ int main(int argc, char** argv)
dataInChannel.UpdateRateLogging(0); dataInChannel.UpdateRateLogging(0);
timeoutTester.fChannels["data-in"].push_back(dataInChannel); timeoutTester.fChannels["data-in"].push_back(dataInChannel);
timeoutTester.ChangeState(TransferTimeoutTester::INIT_DEVICE); timeoutTester.ChangeState("INIT_DEVICE");
timeoutTester.WaitForEndOfState(TransferTimeoutTester::INIT_DEVICE); timeoutTester.WaitForEndOfState("INIT_DEVICE");
timeoutTester.ChangeState(TransferTimeoutTester::INIT_TASK); timeoutTester.ChangeState("INIT_TASK");
timeoutTester.WaitForEndOfState(TransferTimeoutTester::INIT_TASK); timeoutTester.WaitForEndOfState("INIT_TASK");
timeoutTester.ChangeState(TransferTimeoutTester::RUN); timeoutTester.ChangeState("RUN");
timeoutTester.WaitForEndOfState(TransferTimeoutTester::RUN); timeoutTester.WaitForEndOfState("RUN");
timeoutTester.ChangeState(TransferTimeoutTester::RESET_TASK); // nanomsg does not implement the LINGER option. Give the sockets some time before their queues are terminated
timeoutTester.WaitForEndOfState(TransferTimeoutTester::RESET_TASK); if (transport == "nanomsg")
{
std::this_thread::sleep_for(std::chrono::seconds(1));
}
timeoutTester.ChangeState(TransferTimeoutTester::RESET_DEVICE); timeoutTester.ChangeState("RESET_TASK");
timeoutTester.WaitForEndOfState(TransferTimeoutTester::RESET_DEVICE); timeoutTester.WaitForEndOfState("RESET_TASK");
timeoutTester.ChangeState(TransferTimeoutTester::END); timeoutTester.ChangeState("RESET_DEVICE");
timeoutTester.WaitForEndOfState("RESET_DEVICE");
timeoutTester.ChangeState("END");
return 0; return 0;
} }