From 100cf1bc3a42a00afc6b60613a26dbfb260ecfcf Mon Sep 17 00:00:00 2001
From: Martin Hierholzer <martin.hierholzer@desy.de>
Date: Wed, 16 Nov 2016 13:42:56 +0100
Subject: [PATCH] fixed a bug in the test: a module was defined at the same
 scope as the application, which lead to crashes when terminating the
 application sometimes (same as last commit, but for a different test)

---
 tests/executables_src/testTrigger.cc | 22 ++++++++--------------
 1 file changed, 8 insertions(+), 14 deletions(-)

diff --git a/tests/executables_src/testTrigger.cc b/tests/executables_src/testTrigger.cc
index 002cde0f..6332a19d 100644
--- a/tests/executables_src/testTrigger.cc
+++ b/tests/executables_src/testTrigger.cc
@@ -77,6 +77,8 @@ struct TestApplication : public ctk::Application {
     void defineConnections() {}             // the setup is done in the tests
 
     TestModule<T> testModule{this,"testModule"};
+    ctk::DeviceModule dev{"Dummy0"};
+    ctk::ControlSystemModule cs;
 };
 
 /*********************************************************************************************************************/
@@ -90,11 +92,9 @@ BOOST_AUTO_TEST_CASE_TEMPLATE( testTriggerDevToApp, T, test_types ) {
 
   TestApplication<T> app;
 
-  ctk::DeviceModule dev{"Dummy0"};
+  app.testModule.feedingToDevice >> app.dev("/MyModule/Variable");
 
-  app.testModule.feedingToDevice >> dev("/MyModule/Variable");
-
-  dev("/MyModule/Variable") [ app.testModule.theTrigger ] >> app.testModule.consumingPush;
+  app.dev("/MyModule/Variable") [ app.testModule.theTrigger ] >> app.testModule.consumingPush;
   app.initialise();
   app.run();
 
@@ -143,12 +143,9 @@ BOOST_AUTO_TEST_CASE_TEMPLATE( testTriggerDevToCS, T, test_types ) {
   auto pvManagers = ctk::createPVManager();
   app.setPVManager(pvManagers.second);
 
-  ctk::DeviceModule dev{"Dummy0"};
-  ctk::ControlSystemModule cs;
-
-  app.testModule.feedingToDevice >> dev("/MyModule/Variable");
+  app.testModule.feedingToDevice >> app.dev("/MyModule/Variable");
 
-  dev("/MyModule/Variable", typeid(T), 1) [ app.testModule.theTrigger ] >> cs("myCSVar");
+  app.dev("/MyModule/Variable", typeid(T), 1) [ app.testModule.theTrigger ] >> app.cs("myCSVar");
   
   app.initialise();
   app.run();
@@ -192,12 +189,9 @@ BOOST_AUTO_TEST_CASE_TEMPLATE( testTriggerByCS, T, test_types ) {
   auto pvManagers = ctk::createPVManager();
   app.setPVManager(pvManagers.second);
 
-  ctk::DeviceModule dev{"Dummy0"};
-  ctk::ControlSystemModule cs;
-
-  app.testModule.feedingToDevice >> dev("/MyModule/Variable");
+  app.testModule.feedingToDevice >> app.dev("/MyModule/Variable");
 
-  dev("/MyModule/Variable", typeid(T), 1) [ cs("theTrigger", typeid(T), 1) ] >> cs("myCSVar");
+  app.dev("/MyModule/Variable", typeid(T), 1) [ app.cs("theTrigger", typeid(T), 1) ] >> app.cs("myCSVar");
   
   app.initialise();
   app.run();
-- 
GitLab