Skip to content
Snippets Groups Projects
Commit 82b9414b authored by Martin Killenberg's avatar Martin Killenberg
Browse files

Merge branch 'master' of github.com:ChimeraTK/ApplicationCore

parents 79f55e69 1e69e6a9
No related branches found
No related tags found
No related merge requests found
......@@ -161,6 +161,8 @@ namespace ChimeraTK {
pthread_setname_np(pthread_self(), name.substr(0, std::min<std::string::size_type>(name.length(), 15)).c_str());
}
void debugMakeConnections(){ enableDebugMakeConnections = true; };
ModuleType getModuleType() const override { return ModuleType::ModuleGroup; }
std::string getQualifiedName() const override { return "/" + _name; }
......@@ -362,6 +364,9 @@ namespace ChimeraTK {
/** Flag whether to warn about unconnected variables or not */
bool enableUnconnectedVariablesWarning{false};
/** Flag if debug output is enabled for creation of the varible connections */
bool enableDebugMakeConnections{false};
/** Map from ProcessArray uniqueId to the variable ID for control system
* variables. This is required for the TestFacility. */
std::map<size_t, size_t> pvIdMap;
......
......@@ -30,8 +30,6 @@ namespace ChimeraTK {
/** value of validity flag from last read operation */
DataValidity lastValidity{DataValidity::ok};
/** value of validity flag from user */
DataValidity localValidity{DataValidity::ok};
};
DECLARE_TEMPLATE_FOR_CHIMERATK_USER_TYPES(MetaDataPropagatingRegisterDecorator);
......
......@@ -706,13 +706,11 @@ void Application::makeConnectionsForNetwork(VariableNetwork& network) {
template<typename UserType>
void Application::typedMakeConnection(VariableNetwork& network) {
#define DEBUG_TYPED_MAKE_CONNECTIONS 0
#if DEBUG_TYPED_MAKE_CONNECTIONS
std::cout << std::endl << "Executing typedMakeConnections for network:" << std::endl;
network.dump("", std::cout);
std::cout << std::endl;
#endif
if(enableDebugMakeConnections) {
std::cout << std::endl << "Executing typedMakeConnections for network:" << std::endl;
network.dump("", std::cout);
std::cout << std::endl;
}
try { // catch exceptions to add information about the failed network
bool connectionMade = false; // to check the logic...
......@@ -725,9 +723,9 @@ void Application::typedMakeConnection(VariableNetwork& network) {
// 1st case: the feeder requires a fixed implementation
if(feeder.hasImplementation() && !constantFeeder) {
#if DEBUG_TYPED_MAKE_CONNECTIONS
std::cout << " Creating fixed implementation for feeder '" << feeder.getName() << "'..." << std::endl;
#endif
if(enableDebugMakeConnections) {
std::cout << " Creating fixed implementation for feeder '" << feeder.getName() << "'..." << std::endl;
}
// Create feeding implementation.
boost::shared_ptr<ChimeraTK::NDRegisterAccessor<UserType>> feedingImpl;
......@@ -743,9 +741,9 @@ void Application::typedMakeConnection(VariableNetwork& network) {
// if we just have two nodes, directly connect them
if(nNodes == 2 && !useExternalTrigger) {
#if DEBUG_TYPED_MAKE_CONNECTIONS
std::cout << " Setting up direct connection without external trigger." << std::endl;
#endif
if(enableDebugMakeConnections) {
std::cout << " Setting up direct connection without external trigger." << std::endl;
}
bool needsFanOut{false};
boost::shared_ptr<ChimeraTK::NDRegisterAccessor<UserType>> consumingImpl;
......@@ -784,9 +782,9 @@ void Application::typedMakeConnection(VariableNetwork& network) {
connectionMade = true;
}
else { /* !(nNodes == 2 && !useExternalTrigger) */
#if DEBUG_TYPED_MAKE_CONNECTIONS
std::cout << " Setting up triggered connection." << std::endl;
#endif
if(enableDebugMakeConnections) {
std::cout << " Setting up triggered connection." << std::endl;
}
// create the right FanOut type
boost::shared_ptr<FanOut<UserType>> fanOut;
......@@ -796,9 +794,10 @@ void Application::typedMakeConnection(VariableNetwork& network) {
auto consumerImplementationPairs = setConsumerImplementations<UserType>(feeder, consumers);
if(useExternalTrigger) {
#if DEBUG_TYPED_MAKE_CONNECTIONS
std::cout << " Using external trigger." << std::endl;
#endif
if(enableDebugMakeConnections) {
std::cout << " Using external trigger." << std::endl;
}
// if external trigger is enabled, use externally triggered threaded
// FanOut. Create one per external trigger impl.
void* triggerImplId = network.getExternalTriggerImpl().get();
......@@ -815,9 +814,10 @@ void Application::typedMakeConnection(VariableNetwork& network) {
fanOut = triggerFanOut->addNetwork(feedingImpl, consumerImplementationPairs);
}
else if(useFeederTrigger) {
#if DEBUG_TYPED_MAKE_CONNECTIONS
std::cout << " Using trigger provided by the feeder." << std::endl;
#endif
if(enableDebugMakeConnections) {
std::cout << " Using trigger provided by the feeder." << std::endl;
}
// if the trigger is provided by the pushing feeder, use the treaded
// version of the FanOut to distribute new values immediately to all
// consumers. Depending on whether we have a return channel or not, pick
......@@ -835,9 +835,9 @@ void Application::typedMakeConnection(VariableNetwork& network) {
fanOut = threadedFanOut;
}
else {
#if DEBUG_TYPED_MAKE_CONNECTIONS
std::cout << " No trigger, using consuming fanout." << std::endl;
#endif
if(enableDebugMakeConnections) {
std::cout << " No trigger, using consuming fanout." << std::endl;
}
assert(network.hasApplicationConsumer()); // checkConnections should
// catch this
consumingFanOut = boost::make_shared<ConsumingFanOut<UserType>>(feedingImpl, consumerImplementationPairs);
......@@ -858,9 +858,9 @@ void Application::typedMakeConnection(VariableNetwork& network) {
// 2nd case: the feeder does not require a fixed implementation
else if(!constantFeeder) { /* !feeder.hasImplementation() */
#if DEBUG_TYPED_MAKE_CONNECTIONS
std::cout << " Feeder '" << feeder.getName() << "' does not require a fixed implementation." << std::endl;
#endif
if(enableDebugMakeConnections) {
std::cout << " Feeder '" << feeder.getName() << "' does not require a fixed implementation." << std::endl;
}
// we should be left with an application feeder node
if(feeder.getType() != NodeType::Application) {
......@@ -911,9 +911,9 @@ void Application::typedMakeConnection(VariableNetwork& network) {
}
else { /* constantFeeder */
#if DEBUG_TYPED_MAKE_CONNECTIONS
std::cout << " Using constant feeder '" << feeder.getName() << "'..." << std::endl;
#endif
if(enableDebugMakeConnections) {
std::cout << " Using constant feeder '" << feeder.getName() << "'..." << std::endl;
}
assert(feeder.getType() == NodeType::Constant);
auto feedingImpl = feeder.getConstAccessor<UserType>();
assert(feedingImpl != nullptr);
......
......@@ -25,13 +25,7 @@ namespace ChimeraTK {
template<typename T>
void MetaDataPropagatingRegisterDecorator<T>::doPreWrite(TransferType type, VersionNumber versionNumber) {
if(localValidity == DataValidity::faulty) {
ChimeraTK::NDRegisterAccessorDecorator<T>::setDataValidity(DataValidity::faulty);
}
else {
ChimeraTK::NDRegisterAccessorDecorator<T>::setDataValidity(_owner->getDataValidity());
}
ChimeraTK::NDRegisterAccessorDecorator<T>::setDataValidity(_owner->getDataValidity());
NDRegisterAccessorDecorator<T, T>::doPreWrite(type, versionNumber);
}
......
......@@ -59,14 +59,14 @@ struct TestApplication : ctk::Application {
case 1:
vars.read.readLatest();
break;
case 3:
case 2:
vars.read.read();
break;
case 5:
case 3:
vars.set.write();
break;
case 6:
vars.set.write();
case 4:
vars.set.write(); //FIXME should be wrtDestructively?
break;
default:
break;
......@@ -83,8 +83,10 @@ struct TestApplication : ctk::Application {
};
BOOST_AUTO_TEST_CASE(testDirectConnectOpen) {
for(int readMode = 0; readMode < 3; ++readMode) {
for(int readMode = 0; readMode < 1; ++readMode) { //FIXME set to 1
TestApplication app;
//app.debugMakeConnections();
boost::shared_ptr<ctk::ExceptionDummy> dummyBackend1 = boost::dynamic_pointer_cast<ctk::ExceptionDummy>(
ChimeraTK::BackendFactory::getInstance().createBackend(ExceptionDummyCDD1));
......@@ -92,15 +94,22 @@ BOOST_AUTO_TEST_CASE(testDirectConnectOpen) {
app.module.vars.set >> app.dev("/MyModule/actuator", typeid(int), 1);
app.name.name.tick >> app.module.vars.tick;
// Open and put device in an error state
dummyBackend1->throwExceptionOpen = true;
ctk::TestFacility test(false);
// Open and put device in an error state
// FIXME Move this further down. It makes the sequence confusing, the check below should be faulty,
// because the receiving end of all accessor implementations should be constructed with faulty (Initial value propagation spec, D.1)
//dummyBackend1->throwExceptionOpen = true;
BOOST_CHECK(app.module.vars.read.dataValidity() == ctk::DataValidity::faulty);
// Throw on device open and check if DataValidity::faulty gets propagated
dummyBackend1->throwExceptionOpen = true;
// set the read mode
app.module.readMode = readMode;
std::cout << "Read mode is: " << app.module.readMode << ". Run application.\n";
app.run();
CHECK_EQUAL_TIMEOUT(test.readScalar<int>("Devices/" + std::string(ExceptionDummyCDD1) + "/status"), 1, 10000);
// Trigger and check
app.name.name.tick.write();
......@@ -126,7 +135,7 @@ BOOST_AUTO_TEST_CASE(testDirectConnectRead) {
test.runApplication();
// Advance through all non-blocking read methods
while(app.module.readMode < 4) {
while(app.module.readMode < 2) {
// Check
app.trigger.sendTrigger();
test.stepApplication();
......@@ -142,9 +151,6 @@ BOOST_AUTO_TEST_CASE(testDirectConnectRead) {
// advance to the next read
dummyBackend1->throwExceptionRead = false;
app.module.readMode++;
// Skip readAsync(). See https://github.com/ChimeraTK/ApplicationCore/issues/48
if(app.module.readMode == 2) app.module.readMode++;
}
}
......@@ -155,14 +161,14 @@ BOOST_AUTO_TEST_CASE(testDirectConnectWrite) {
app.dev("/MyModule/readBack", typeid(int), 1) >> app.module.vars.read;
app.module.vars.set >> app.dev("/MyModule/actuator", typeid(int), 1);
app.module.readMode = 5;
app.module.readMode = 3;
app.trigger.tick >> app.module.vars.tick;
ctk::TestFacility test(true);
test.runApplication();
// Advance through all non-blocking read methods
while(app.module.readMode < 7) {
while(app.module.readMode < 5) {
// Check
app.trigger.sendTrigger();
test.stepApplication();
......
......@@ -208,7 +208,6 @@ struct TestApplication : public ctk::Application {
ctk::ControlSystemModule cs;
ctk::DeviceModule dev{this, dummySdm};
BlockingReadTestModule<T> blockingReadTestModule{this, "blockingReadTestModule", "Module for testing blocking read"};
//AsyncReadTestModule<T> asyncReadTestModule{this, "asyncReadTestModule", "Module for testing async read"};
ReadAnyTestModule<T> readAnyTestModule{this, "readAnyTestModule", "Module for testing readAny()"};
};
......@@ -230,8 +229,6 @@ struct PollingTestApplication : public ctk::Application {
/* test that no TestableModeAccessorDecorator is used if the testable mode is
* not enabled */
#if 0
BOOST_AUTO_TEST_CASE_TEMPLATE(testNoDecorator, T, test_types) {
std::cout << "***************************************************************"
"******************************************************"
......@@ -244,7 +241,6 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(testNoDecorator, T, test_types) {
app.setPVManager(pvManagers.second);
app.blockingReadTestModule.connectTo(app.cs["blocking"]);
//app.asyncReadTestModule.connectTo(app.cs["async"]);
app.readAnyTestModule.connectTo(app.cs["readAny"]);
app.initialise();
......@@ -259,8 +255,6 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(testNoDecorator, T, test_types) {
BOOST_CHECK(boost::dynamic_pointer_cast<ctk::TestableModeAccessorDecorator<T>>(hloutput) == nullptr);
}
#endif
/*********************************************************************************************************************/
/* test blocking read in test mode */
......@@ -274,7 +268,6 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(testBlockingRead, T, test_types) {
app.cs("input") >> app.blockingReadTestModule.someInput;
app.blockingReadTestModule.someOutput >> app.cs("output");
//app.asyncReadTestModule.connectTo(app.cs["async"]); // avoid runtime warning
app.readAnyTestModule.connectTo(app.cs["readAny"]); // avoid runtime warning
ctk::TestFacility test;
......@@ -296,48 +289,6 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(testBlockingRead, T, test_types) {
}
}
/*********************************************************************************************************************/
/* test async read in test mode */
#if 0
BOOST_AUTO_TEST_CASE_TEMPLATE(testAsyncRead, T, test_types) {
std::cout << "***************************************************************"
"******************************************************"
<< std::endl;
std::cout << "==> testAsyncRead<" << typeid(T).name() << ">" << std::endl;
TestApplication<T> app;
// app.cs("input") >> app.asyncReadTestModule.someInput;
// app.asyncReadTestModule.someOutput >> app.cs("output");
app.blockingReadTestModule.connectTo(app.cs["blocking"]); // avoid runtime warning
app.readAnyTestModule.connectTo(app.cs["readAny"]); // avoid runtime warning
ctk::TestFacility test;
auto pvInput = test.getScalar<T>("input");
auto pvOutput = test.getScalar<T>("output");
test.runApplication();
// test blocking read when taking control in the test thread
for(int i = 0; i < 5; ++i) {
pvInput = 120 + i;
pvInput.write();
usleep(10000);
BOOST_CHECK(pvOutput.readNonBlocking() == false);
test.stepApplication();
bool ret = pvOutput.readNonBlocking();
BOOST_CHECK(ret == true);
if(!ret) {
CHECK_TIMEOUT(pvOutput.readNonBlocking() == true, 10000);
}
int val = pvOutput;
BOOST_CHECK(val == 120 + i);
}
}
/*********************************************************************************************************************/
/* test testReadAny in test mode */
......@@ -353,7 +304,6 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(testReadAny, T, test_types) {
app.readAnyTestModule.value >> app.cs("value");
app.readAnyTestModule.index >> app.cs("index");
app.blockingReadTestModule.connectTo(app.cs["blocking"]); // avoid runtime warning
//app.asyncReadTestModule.connectTo(app.cs["async"]); // avoid runtime warning
ctk::TestFacility test;
auto value = test.getScalar<T>("value");
......@@ -495,8 +445,7 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(testChainedModules, T, test_types) {
// put everything we got into one chain
app.readAnyTestModule.inputs.connectTo(app.cs["input"]);
app.readAnyTestModule.value >> app.blockingReadTestModule.someInput;
// app.blockingReadTestModule.someOutput >> app.asyncReadTestModule.someInput;
// app.asyncReadTestModule.someOutput >> app.cs("value");
app.blockingReadTestModule.someOutput >> app.cs("value");
app.readAnyTestModule.index >> app.cs("index");
ctk::TestFacility test;
......@@ -589,14 +538,12 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(testWithFanOut, T, test_types) {
// distribute a value to multiple inputs
app.readAnyTestModule.inputs.connectTo(app.cs["input"]);
//app.readAnyTestModule.value >> app.blockingReadTestModule.someInput >> app.asyncReadTestModule.someInput;
app.readAnyTestModule.value >> app.blockingReadTestModule.someInput;
app.blockingReadTestModule.someOutput >> app.cs("valueFromBlocking");
//app.asyncReadTestModule.someOutput >> app.cs("valueFromAsync");
app.readAnyTestModule.index >> app.cs("index");
ctk::TestFacility test;
auto valueFromBlocking = test.getScalar<T>("valueFromBlocking");
auto valueFromAsync = test.getScalar<T>("valueFromAsync");
auto index = test.getScalar<uint32_t>("index");
auto v1 = test.getScalar<T>("input/v1");
auto v2 = test.getScalar<T>("input/v2");
......@@ -607,7 +554,6 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(testWithFanOut, T, test_types) {
// check that we don't receive anything yet
usleep(10000);
BOOST_CHECK(valueFromBlocking.readNonBlocking() == false);
BOOST_CHECK(valueFromAsync.readNonBlocking() == false);
BOOST_CHECK(index.readNonBlocking() == false);
// send something to v2
......@@ -617,16 +563,13 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(testWithFanOut, T, test_types) {
// check that we still don't receive anything yet
usleep(10000);
BOOST_CHECK(valueFromBlocking.readNonBlocking() == false);
BOOST_CHECK(valueFromAsync.readNonBlocking() == false);
BOOST_CHECK(index.readNonBlocking() == false);
// run the application and check that we got the expected result
test.stepApplication();
BOOST_CHECK(valueFromBlocking.readNonBlocking() == true);
BOOST_CHECK(valueFromAsync.readNonBlocking() == true);
BOOST_CHECK(index.readNonBlocking() == true);
BOOST_CHECK_EQUAL((T)valueFromBlocking, 11);
BOOST_CHECK_EQUAL((T)valueFromAsync, 11);
BOOST_CHECK_EQUAL((unsigned int)index, 2);
// send something to v3
......@@ -636,16 +579,13 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(testWithFanOut, T, test_types) {
// check that we still don't receive anything yet
usleep(10000);
BOOST_CHECK(valueFromBlocking.readNonBlocking() == false);
BOOST_CHECK(valueFromAsync.readNonBlocking() == false);
BOOST_CHECK(index.readNonBlocking() == false);
// run the application and check that we got the expected result
test.stepApplication();
BOOST_CHECK(valueFromBlocking.readNonBlocking() == true);
BOOST_CHECK(valueFromAsync.readNonBlocking() == true);
BOOST_CHECK(index.readNonBlocking() == true);
BOOST_CHECK_EQUAL((T)valueFromBlocking, 12);
BOOST_CHECK_EQUAL((T)valueFromAsync, 12);
BOOST_CHECK_EQUAL((unsigned int)index, 3);
// send something to v3 again
......@@ -655,16 +595,13 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(testWithFanOut, T, test_types) {
// check that we still don't receive anything yet
usleep(10000);
BOOST_CHECK(valueFromBlocking.readNonBlocking() == false);
BOOST_CHECK(valueFromAsync.readNonBlocking() == false);
BOOST_CHECK(index.readNonBlocking() == false);
// run the application and check that we got the expected result
test.stepApplication();
BOOST_CHECK(valueFromBlocking.readNonBlocking() == true);
BOOST_CHECK(valueFromAsync.readNonBlocking() == true);
BOOST_CHECK(index.readNonBlocking() == true);
BOOST_CHECK_EQUAL((T)valueFromBlocking, 13);
BOOST_CHECK_EQUAL((T)valueFromAsync, 13);
BOOST_CHECK_EQUAL((unsigned int)index, 3);
// check that stepApplication() throws an exception if no input data is
......@@ -679,7 +616,6 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(testWithFanOut, T, test_types) {
// check that we still don't receive anything anymore
usleep(10000);
BOOST_CHECK(valueFromBlocking.readNonBlocking() == false);
BOOST_CHECK(valueFromAsync.readNonBlocking() == false);
BOOST_CHECK(index.readNonBlocking() == false);
}
......@@ -699,16 +635,14 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(testWithTrigger, T, test_types) {
app.dev("REG2")[triggernode] >> app.readAnyTestModule.inputs.v2;
app.cs("v3") >> app.readAnyTestModule.inputs.v3;
app.cs("v4") >> app.readAnyTestModule.inputs.v4;
//app.readAnyTestModule.value >> app.blockingReadTestModule.someInput >> app.asyncReadTestModule.someInput;
app.readAnyTestModule.value >> app.blockingReadTestModule.someInput;
app.blockingReadTestModule.someOutput >> app.cs("valueFromBlocking");
//app.asyncReadTestModule.someOutput >> app.cs("valueFromAsync");
app.readAnyTestModule.index >> app.cs("index");
ctk::TestFacility test;
ctk::Device dev;
dev.open(dummySdm);
auto valueFromBlocking = test.getScalar<T>("valueFromBlocking");
auto valueFromAsync = test.getScalar<T>("valueFromAsync");
auto index = test.getScalar<uint32_t>("index");
auto trigger = test.getScalar<int>("trigger");
auto v2 = dev.getScalarRegisterAccessor<T>("REG2");
......@@ -717,7 +651,6 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(testWithTrigger, T, test_types) {
// check that we don't receive anything yet
usleep(10000);
BOOST_CHECK(valueFromBlocking.readNonBlocking() == false);
BOOST_CHECK(valueFromAsync.readNonBlocking() == false);
BOOST_CHECK(index.readNonBlocking() == false);
// send something to v2 and send the trigger
......@@ -728,16 +661,13 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(testWithTrigger, T, test_types) {
// check that we still don't receive anything yet
usleep(10000);
BOOST_CHECK(valueFromBlocking.readNonBlocking() == false);
BOOST_CHECK(valueFromAsync.readNonBlocking() == false);
BOOST_CHECK(index.readNonBlocking() == false);
// run the application and check that we got the expected result
test.stepApplication();
BOOST_CHECK(valueFromBlocking.readNonBlocking() == true);
BOOST_CHECK(valueFromAsync.readNonBlocking() == true);
BOOST_CHECK(index.readNonBlocking() == true);
BOOST_CHECK(valueFromBlocking == 11);
BOOST_CHECK(valueFromAsync == 11);
BOOST_CHECK(index == 2);
// again send something to v2 and send the trigger
......@@ -748,16 +678,13 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(testWithTrigger, T, test_types) {
// check that we still don't receive anything yet
usleep(10000);
BOOST_CHECK(valueFromBlocking.readNonBlocking() == false);
BOOST_CHECK(valueFromAsync.readNonBlocking() == false);
BOOST_CHECK(index.readNonBlocking() == false);
// run the application and check that we got the expected result
test.stepApplication();
BOOST_CHECK(valueFromBlocking.readNonBlocking() == true);
BOOST_CHECK(valueFromAsync.readNonBlocking() == true);
BOOST_CHECK(index.readNonBlocking() == true);
BOOST_CHECK(valueFromBlocking == 22);
BOOST_CHECK(valueFromAsync == 22);
BOOST_CHECK(index == 2);
// check that stepApplication() throws an exception if no input data is
......@@ -772,7 +699,7 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(testWithTrigger, T, test_types) {
// check that we still don't receive anything anymore
usleep(10000);
BOOST_CHECK(valueFromBlocking.readNonBlocking() == false);
BOOST_CHECK(valueFromAsync.readNonBlocking() == false);
// BOOST_CHECK(valueFromAsync.readNonBlocking() == false);
BOOST_CHECK(index.readNonBlocking() == false);
}
......@@ -792,18 +719,15 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(testWithTriggerFanOut, T, test_types) {
app.cs("v2") >> app.readAnyTestModule.inputs.v2;
app.cs("v3") >> app.readAnyTestModule.inputs.v3;
app.cs("v4") >> app.readAnyTestModule.inputs.v4;
//app.dev("REG2")[triggernode] >> app.asyncReadTestModule.someInput;
app.dev("REG3")[triggernode] >> app.blockingReadTestModule.someInput;
app.readAnyTestModule.value >> app.cs("valueFromAny");
app.readAnyTestModule.index >> app.cs("index");
app.blockingReadTestModule.someOutput >> app.cs("valueFromBlocking");
//app.asyncReadTestModule.someOutput >> app.cs("valueFromAsync");
ctk::TestFacility test;
ctk::Device dev;
dev.open(dummySdm);
auto valueFromBlocking = test.getScalar<T>("valueFromBlocking");
auto valueFromAsync = test.getScalar<T>("valueFromAsync");
auto valueFromAny = test.getScalar<T>("valueFromAny");
auto index = test.getScalar<uint32_t>("index");
auto trigger = test.getScalar<int>("trigger");
......@@ -815,7 +739,6 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(testWithTriggerFanOut, T, test_types) {
// check that we don't receive anything yet
usleep(10000);
BOOST_CHECK(valueFromBlocking.readNonBlocking() == false);
BOOST_CHECK(valueFromAsync.readNonBlocking() == false);
BOOST_CHECK(index.readNonBlocking() == false);
BOOST_CHECK(index.readNonBlocking() == false);
......@@ -831,25 +754,21 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(testWithTriggerFanOut, T, test_types) {
// check that we still don't receive anything yet
usleep(10000);
BOOST_CHECK(valueFromBlocking.readNonBlocking() == false);
BOOST_CHECK(valueFromAsync.readNonBlocking() == false);
BOOST_CHECK(valueFromAny.readNonBlocking() == false);
BOOST_CHECK(index.readNonBlocking() == false);
// run the application and check that we got the expected result
test.stepApplication();
BOOST_CHECK(valueFromBlocking.readNonBlocking() == true);
BOOST_CHECK(valueFromAsync.readNonBlocking() == true);
BOOST_CHECK(valueFromAny.readNonBlocking() == true);
BOOST_CHECK(index.readNonBlocking() == true);
BOOST_CHECK(valueFromBlocking == 33);
BOOST_CHECK(valueFromAsync == 22);
BOOST_CHECK(valueFromAny == 11);
BOOST_CHECK(index == 1);
// check that we don't receive anything yet
usleep(10000);
BOOST_CHECK(valueFromBlocking.readNonBlocking() == false);
BOOST_CHECK(valueFromAsync.readNonBlocking() == false);
BOOST_CHECK(index.readNonBlocking() == false);
BOOST_CHECK(index.readNonBlocking() == false);
......@@ -865,18 +784,15 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(testWithTriggerFanOut, T, test_types) {
// check that we still don't receive anything yet
usleep(10000);
BOOST_CHECK(valueFromBlocking.readNonBlocking() == false);
BOOST_CHECK(valueFromAsync.readNonBlocking() == false);
BOOST_CHECK(valueFromAny.readNonBlocking() == false);
BOOST_CHECK(index.readNonBlocking() == false);
// run the application and check that we got the expected result
test.stepApplication();
BOOST_CHECK(valueFromBlocking.readNonBlocking() == true);
BOOST_CHECK(valueFromAsync.readNonBlocking() == true);
BOOST_CHECK(valueFromAny.readNonBlocking() == true);
BOOST_CHECK(index.readNonBlocking() == true);
BOOST_CHECK(valueFromBlocking == 4);
BOOST_CHECK(valueFromAsync == 5);
BOOST_CHECK(valueFromAny == 6);
BOOST_CHECK(index == 1);
......@@ -892,7 +808,6 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(testWithTriggerFanOut, T, test_types) {
// check that we still don't receive anything anymore
usleep(10000);
BOOST_CHECK(valueFromBlocking.readNonBlocking() == false);
BOOST_CHECK(valueFromAsync.readNonBlocking() == false);
BOOST_CHECK(valueFromAny.readNonBlocking() == false);
BOOST_CHECK(index.readNonBlocking() == false);
}
......@@ -910,7 +825,6 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(testConvenienceRead, T, test_types) {
app.cs("input") >> app.blockingReadTestModule.someInput;
app.blockingReadTestModule.someOutput >> app.cs("output");
//app.asyncReadTestModule.connectTo(app.cs["async"]); // avoid runtime warning
app.readAnyTestModule.connectTo(app.cs["readAny"]); // avoid runtime warning
ctk::TestFacility test;
......@@ -1076,5 +990,3 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(testPolling, T, test_types) {
BOOST_CHECK_EQUAL((T)pv_valuePush, 24);
BOOST_CHECK_EQUAL((T)pv_state, 3);
}
#endif
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment