4 #define BOOST_TEST_DYN_LINK
5 #define BOOST_TEST_MODULE SharedDummyBackendUnifiedTest
11 #include <boost/filesystem.hpp>
12 #include <boost/interprocess/managed_shared_memory.hpp>
13 #include <boost/test/unit_test.hpp>
23 using namespace boost::unit_test_framework;
28 static std::string instanceId{
"1"};
29 static std::string mapFileName{
"sharedDummyUnified.map"};
31 BOOST_AUTO_TEST_SUITE(SharedDummyBackendUnifiedTestSuite)
34 TestFixture() : argc(framework::master_test_suite().argc), argv(framework::master_test_suite().argv) {}
40 static void mirrorArea(
42 processVarsFrom.
read();
43 for(
size_t i = 0; i < processVarsFrom.
getNElements(); ++i) {
44 processVarsTo[i] = processVarsFrom[i];
46 processVarsTo.
write();
58 bool keepRunning =
true;
62 boost::filesystem::path absPathToMapFile = boost::filesystem::absolute(mapFileName);
68 dev.
open(
"SHDMEMDEV");
77 BOOST_CHECK_EQUAL(processVarsFeature.
getNElements(), processVarsMirror.getNElements());
93 mirrorRequest_Busy.readLatest();
95 boost::this_thread::sleep_for(boost::chrono::milliseconds(50));
96 }
while(mirrorRequest_Busy == 0);
101 mirrorArea(processVarsMirror, processVarsFeature);
104 mirrorArea(processVarsFeature, processVarsMirror);
109 mirrorRequest_Updated.readLatest();
110 ++mirrorRequest_Updated;
111 mirrorRequest_Updated.write();
113 mirrorRequestUpdated_Interrupt = 1;
114 mirrorRequestUpdated_Interrupt.write();
116 mirrorRequest_Busy = 0;
117 mirrorRequest_Busy.write();
119 mirrorRequest_DataInterrupt.readLatest();
120 if(mirrorRequest_DataInterrupt == 1) {
121 dataInterrupt.write();
122 mirrorRequest_DataInterrupt = 0;
123 mirrorRequest_DataInterrupt.write();
125 }
while(keepRunning);
131 BOOST_AUTO_TEST_SUITE_END()