Skip to content
Snippets Groups Projects
Commit b0add4ba authored by Martin Christoph Hierholzer's avatar Martin Christoph Hierholzer
Browse files

fixed more problems, but some still remain (failing tests)

parent fa372bbe
No related branches found
No related tags found
No related merge requests found
......@@ -41,9 +41,9 @@ namespace ChimeraTK {
}
bool readNonBlocking() {
bool ret = impl->readNonBlocking();
impl->read(); /// @todo FIXME this is wrong, but otherwise DeviceAccess fails to work properly right now
mtca4u::NDRegisterAccessor<UserType>::buffer_2D[0].swap(impl->accessChannel(0));
return ret;
return true;
}
void write() {
......
......@@ -166,9 +166,10 @@ namespace ChimeraTK {
bool readNonBlocking() {
bool ret = impl->readNonBlocking();
mtca4u::NDRegisterAccessor<UserType>::buffer_2D[0].swap(impl->accessChannel(0));
if(ret) {
for(auto &slave : slaves) { // send out copies to slaves
slave->accessData(0) = impl->accessData(0);
slave->accessChannel(0) = mtca4u::NDRegisterAccessor<UserType>::buffer_2D[0];
slave->write();
}
}
......@@ -177,10 +178,12 @@ namespace ChimeraTK {
void write() {
for(auto &slave : slaves) { // send out copies to slaves
slave->accessData(0) = impl->accessData(0);
slave->accessChannel(0) = mtca4u::NDRegisterAccessor<UserType>::buffer_2D[0];
slave->write();
}
impl->accessChannel(0).swap(mtca4u::NDRegisterAccessor<UserType>::buffer_2D[0]);
impl->write();
impl->accessChannel(0).swap(mtca4u::NDRegisterAccessor<UserType>::buffer_2D[0]);
return;
}
......
......@@ -73,21 +73,21 @@ BOOST_AUTO_TEST_CASE_TEMPLATE( testFeedToCS, T, test_types ) {
app.makeConnections();
BOOST_CHECK_EQUAL(pvManagers.first->getAllProcessVariables().size(), 1);
auto myFeeder = pvManagers.first->getProcessScalar<T>("/myFeeder");
auto myFeeder = pvManagers.first->getProcessArray<T>("/myFeeder");
app.testModule.feeder = 42;
BOOST_CHECK_EQUAL(myFeeder->readNonBlocking(), false);
app.testModule.feeder.write();
BOOST_CHECK_EQUAL(myFeeder->readNonBlocking(), true);
BOOST_CHECK_EQUAL(myFeeder->readNonBlocking(), false);
BOOST_CHECK(*myFeeder == 42);
BOOST_CHECK(myFeeder->accessData(0) == 42);
app.testModule.feeder = 120;
BOOST_CHECK_EQUAL(myFeeder->readNonBlocking(), false);
app.testModule.feeder.write();
BOOST_CHECK_EQUAL(myFeeder->readNonBlocking(), true);
BOOST_CHECK_EQUAL(myFeeder->readNonBlocking(), false);
BOOST_CHECK(*myFeeder == 120);
BOOST_CHECK(myFeeder->accessData(0) == 120);
}
......@@ -105,14 +105,14 @@ BOOST_AUTO_TEST_CASE_TEMPLATE( testConsumeFromCS, T, test_types ) {
app.makeConnections();
BOOST_CHECK_EQUAL(pvManagers.first->getAllProcessVariables().size(), 1);
auto myConsumer = pvManagers.first->getProcessScalar<T>("/myConsumer");
auto myConsumer = pvManagers.first->getProcessArray<T>("/myConsumer");
*myConsumer = 42;
myConsumer->accessData(0) = 42;
myConsumer->write();
app.testModule.consumer.read();
BOOST_CHECK(app.testModule.consumer == 42);
*myConsumer = 120;
myConsumer->accessData(0) = 120;
myConsumer->write();
app.testModule.consumer.read();
BOOST_CHECK(app.testModule.consumer == 120);
......@@ -136,10 +136,10 @@ BOOST_AUTO_TEST_CASE_TEMPLATE( testMultiplePublications, T, test_types ) {
app.run(); // make the connections and start the FanOut threads
BOOST_CHECK_EQUAL(pvManagers.first->getAllProcessVariables().size(), 4);
auto myFeeder0 = pvManagers.first->getProcessScalar<T>("/myFeeder0");
auto myFeeder1 = pvManagers.first->getProcessScalar<T>("/myFeeder1");
auto myFeeder2 = pvManagers.first->getProcessScalar<T>("/myFeeder2");
auto myFeeder3 = pvManagers.first->getProcessScalar<T>("/myFeeder3");
auto myFeeder0 = pvManagers.first->getProcessArray<T>("/myFeeder0");
auto myFeeder1 = pvManagers.first->getProcessArray<T>("/myFeeder1");
auto myFeeder2 = pvManagers.first->getProcessArray<T>("/myFeeder2");
auto myFeeder3 = pvManagers.first->getProcessArray<T>("/myFeeder3");
app.testModule.feeder = 42;
BOOST_CHECK(myFeeder0->readNonBlocking() == false);
......@@ -152,10 +152,10 @@ BOOST_AUTO_TEST_CASE_TEMPLATE( testMultiplePublications, T, test_types ) {
BOOST_CHECK(myFeeder1->readNonBlocking() == true);
BOOST_CHECK(myFeeder2->readNonBlocking() == true);
BOOST_CHECK(myFeeder3->readNonBlocking() == true);
BOOST_CHECK(*myFeeder0 == 42);
BOOST_CHECK(*myFeeder1 == 42);
BOOST_CHECK(*myFeeder2 == 42);
BOOST_CHECK(*myFeeder3 == 42);
BOOST_CHECK(myFeeder0->accessData(0) == 42);
BOOST_CHECK(myFeeder1->accessData(0) == 42);
BOOST_CHECK(myFeeder2->accessData(0) == 42);
BOOST_CHECK(myFeeder3->accessData(0) == 42);
BOOST_CHECK(myFeeder0->readNonBlocking() == false);
BOOST_CHECK(myFeeder1->readNonBlocking() == false);
BOOST_CHECK(myFeeder2->readNonBlocking() == false);
......@@ -172,10 +172,10 @@ BOOST_AUTO_TEST_CASE_TEMPLATE( testMultiplePublications, T, test_types ) {
BOOST_CHECK(myFeeder1->readNonBlocking() == true);
BOOST_CHECK(myFeeder2->readNonBlocking() == true);
BOOST_CHECK(myFeeder3->readNonBlocking() == true);
BOOST_CHECK(*myFeeder0 == 120);
BOOST_CHECK(*myFeeder1 == 120);
BOOST_CHECK(*myFeeder2 == 120);
BOOST_CHECK(*myFeeder3 == 120);
BOOST_CHECK(myFeeder0->accessData(0) == 120);
BOOST_CHECK(myFeeder1->accessData(0) == 120);
BOOST_CHECK(myFeeder2->accessData(0) == 120);
BOOST_CHECK(myFeeder3->accessData(0) == 120);
BOOST_CHECK(myFeeder0->readNonBlocking() == false);
BOOST_CHECK(myFeeder1->readNonBlocking() == false);
BOOST_CHECK(myFeeder2->readNonBlocking() == false);
......@@ -192,10 +192,10 @@ BOOST_AUTO_TEST_CASE_TEMPLATE( testMultiplePublications, T, test_types ) {
BOOST_CHECK(myFeeder1->readNonBlocking() == true);
BOOST_CHECK(myFeeder2->readNonBlocking() == true);
BOOST_CHECK(myFeeder3->readNonBlocking() == true);
BOOST_CHECK(*myFeeder0 == 120);
BOOST_CHECK(*myFeeder1 == 120);
BOOST_CHECK(*myFeeder2 == 120);
BOOST_CHECK(*myFeeder3 == 120);
BOOST_CHECK(myFeeder0->accessData(0) == 120);
BOOST_CHECK(myFeeder1->accessData(0) == 120);
BOOST_CHECK(myFeeder2->accessData(0) == 120);
BOOST_CHECK(myFeeder3->accessData(0) == 120);
BOOST_CHECK(myFeeder0->readNonBlocking() == false);
BOOST_CHECK(myFeeder1->readNonBlocking() == false);
BOOST_CHECK(myFeeder2->readNonBlocking() == false);
......@@ -204,7 +204,7 @@ BOOST_AUTO_TEST_CASE_TEMPLATE( testMultiplePublications, T, test_types ) {
}
/*********************************************************************************************************************/
/* test multiple re-publications of a variable fed from teh control system */
/* test multiple re-publications of a variable fed from the control system */
BOOST_AUTO_TEST_CASE_TEMPLATE( testMultipleRePublications, T, test_types ) {
......@@ -220,12 +220,12 @@ BOOST_AUTO_TEST_CASE_TEMPLATE( testMultipleRePublications, T, test_types ) {
app.run(); // make the connections and start the FanOut threads
BOOST_CHECK_EQUAL(pvManagers.first->getAllProcessVariables().size(), 4);
auto myConsumer = pvManagers.first->getProcessScalar<T>("/myConsumer");
auto myConsumer_copy1 = pvManagers.first->getProcessScalar<T>("/myConsumer_copy1");
auto myConsumer_copy2 = pvManagers.first->getProcessScalar<T>("/myConsumer_copy2");
auto myConsumer_copy3 = pvManagers.first->getProcessScalar<T>("/myConsumer_copy3");
auto myConsumer = pvManagers.first->getProcessArray<T>("/myConsumer");
auto myConsumer_copy1 = pvManagers.first->getProcessArray<T>("/myConsumer_copy1");
auto myConsumer_copy2 = pvManagers.first->getProcessArray<T>("/myConsumer_copy2");
auto myConsumer_copy3 = pvManagers.first->getProcessArray<T>("/myConsumer_copy3");
*myConsumer = 42;
myConsumer->accessData(0) = 42;
BOOST_CHECK(myConsumer_copy1->readNonBlocking() == false);
BOOST_CHECK(myConsumer_copy2->readNonBlocking() == false);
BOOST_CHECK(myConsumer_copy3->readNonBlocking() == false);
......@@ -234,16 +234,16 @@ BOOST_AUTO_TEST_CASE_TEMPLATE( testMultipleRePublications, T, test_types ) {
BOOST_CHECK(myConsumer_copy1->readNonBlocking() == true);
BOOST_CHECK(myConsumer_copy2->readNonBlocking() == true);
BOOST_CHECK(myConsumer_copy3->readNonBlocking() == true);
BOOST_CHECK(*myConsumer_copy1 == 42);
BOOST_CHECK(*myConsumer_copy2 == 42);
BOOST_CHECK(*myConsumer_copy3 == 42);
BOOST_CHECK(myConsumer_copy1->accessData(0) == 42);
BOOST_CHECK(myConsumer_copy2->accessData(0) == 42);
BOOST_CHECK(myConsumer_copy3->accessData(0) == 42);
BOOST_CHECK(myConsumer_copy1->readNonBlocking() == false);
BOOST_CHECK(myConsumer_copy2->readNonBlocking() == false);
BOOST_CHECK(myConsumer_copy3->readNonBlocking() == false);
app.testModule.consumer.read();
BOOST_CHECK(app.testModule.consumer == 42);
*myConsumer = 120;
myConsumer->accessData(0) = 120;
BOOST_CHECK(myConsumer_copy1->readNonBlocking() == false);
BOOST_CHECK(myConsumer_copy2->readNonBlocking() == false);
BOOST_CHECK(myConsumer_copy3->readNonBlocking() == false);
......@@ -252,9 +252,9 @@ BOOST_AUTO_TEST_CASE_TEMPLATE( testMultipleRePublications, T, test_types ) {
BOOST_CHECK(myConsumer_copy1->readNonBlocking() == true);
BOOST_CHECK(myConsumer_copy2->readNonBlocking() == true);
BOOST_CHECK(myConsumer_copy3->readNonBlocking() == true);
BOOST_CHECK(*myConsumer_copy1 == 120);
BOOST_CHECK(*myConsumer_copy2 == 120);
BOOST_CHECK(*myConsumer_copy3 == 120);
BOOST_CHECK(myConsumer_copy1->accessData(0) == 120);
BOOST_CHECK(myConsumer_copy2->accessData(0) == 120);
BOOST_CHECK(myConsumer_copy3->accessData(0) == 120);
BOOST_CHECK(myConsumer_copy1->readNonBlocking() == false);
BOOST_CHECK(myConsumer_copy2->readNonBlocking() == false);
BOOST_CHECK(myConsumer_copy3->readNonBlocking() == false);
......@@ -270,9 +270,9 @@ BOOST_AUTO_TEST_CASE_TEMPLATE( testMultipleRePublications, T, test_types ) {
BOOST_CHECK(myConsumer_copy1->readNonBlocking() == true);
BOOST_CHECK(myConsumer_copy2->readNonBlocking() == true);
BOOST_CHECK(myConsumer_copy3->readNonBlocking() == true);
BOOST_CHECK(*myConsumer_copy1 == 120);
BOOST_CHECK(*myConsumer_copy2 == 120);
BOOST_CHECK(*myConsumer_copy3 == 120);
BOOST_CHECK(myConsumer_copy1->accessData(0) == 120);
BOOST_CHECK(myConsumer_copy2->accessData(0) == 120);
BOOST_CHECK(myConsumer_copy3->accessData(0) == 120);
BOOST_CHECK(myConsumer_copy1->readNonBlocking() == false);
BOOST_CHECK(myConsumer_copy2->readNonBlocking() == false);
BOOST_CHECK(myConsumer_copy3->readNonBlocking() == false);
......
......@@ -151,7 +151,7 @@ BOOST_AUTO_TEST_CASE_TEMPLATE( testTriggerDevToCS, T, test_types ) {
app.run();
BOOST_CHECK_EQUAL(pvManagers.first->getAllProcessVariables().size(), 1);
auto myCSVar = pvManagers.first->getProcessScalar<T>("/myCSVar");
auto myCSVar = pvManagers.first->getProcessArray<T>("/myCSVar");
// single theaded test only, since the receiving process scalar does not support blocking
BOOST_CHECK(myCSVar->readNonBlocking() == false);
......@@ -161,7 +161,7 @@ BOOST_AUTO_TEST_CASE_TEMPLATE( testTriggerDevToCS, T, test_types ) {
BOOST_CHECK(myCSVar->readNonBlocking() == false);
app.testModule.theTrigger.write();
CHECK_TIMEOUT(myCSVar->readNonBlocking() == true, 30000);
BOOST_CHECK(*myCSVar == 42);
BOOST_CHECK(myCSVar->accessData(0) == 42);
BOOST_CHECK(myCSVar->readNonBlocking() == false);
app.testModule.feedingToDevice = 120;
......@@ -170,7 +170,7 @@ BOOST_AUTO_TEST_CASE_TEMPLATE( testTriggerDevToCS, T, test_types ) {
BOOST_CHECK(myCSVar->readNonBlocking() == false);
app.testModule.theTrigger.write();
CHECK_TIMEOUT(myCSVar->readNonBlocking() == true, 30000);
BOOST_CHECK(*myCSVar == 120);
BOOST_CHECK(myCSVar->accessData(0) == 120);
BOOST_CHECK(myCSVar->readNonBlocking() == false);
}
......@@ -198,29 +198,29 @@ BOOST_AUTO_TEST_CASE_TEMPLATE( testTriggerByCS, T, test_types ) {
app.run();
BOOST_CHECK_EQUAL(pvManagers.first->getAllProcessVariables().size(), 2);
auto myCSVar = pvManagers.first->getProcessScalar<T>("/myCSVar");
auto theTrigger = pvManagers.first->getProcessScalar<T>("/theTrigger");
auto myCSVar = pvManagers.first->getProcessArray<T>("/myCSVar");
auto theTrigger = pvManagers.first->getProcessArray<T>("/theTrigger");
// single theaded test only, since the receiving process scalar does not support blocking
BOOST_CHECK(myCSVar->readNonBlocking() == false);
app.testModule.feedingToDevice = 42;
BOOST_CHECK(myCSVar->readNonBlocking() == false);
app.testModule.feedingToDevice.write();
BOOST_CHECK(myCSVar->readNonBlocking() == false);
*theTrigger = 0;
myCSVar->accessData(0) = 0;
theTrigger->write();
CHECK_TIMEOUT(myCSVar->readNonBlocking() == true, 30000);
BOOST_CHECK(*myCSVar == 42);
BOOST_CHECK(myCSVar->accessData(0) == 42);
BOOST_CHECK(myCSVar->readNonBlocking() == false);
app.testModule.feedingToDevice = 120;
BOOST_CHECK(myCSVar->readNonBlocking() == false);
app.testModule.feedingToDevice.write();
BOOST_CHECK(myCSVar->readNonBlocking() == false);
*theTrigger = 0;
myCSVar->accessData(0) = 0;
theTrigger->write();
CHECK_TIMEOUT(myCSVar->readNonBlocking() == true, 30000);
BOOST_CHECK(*myCSVar == 120);
BOOST_CHECK(myCSVar->accessData(0) == 120);
BOOST_CHECK(myCSVar->readNonBlocking() == false);
}
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