From 79127c2c0f91d1c45f3e7a17fee24c8b17836c35 Mon Sep 17 00:00:00 2001 From: Martin Hierholzer <martin.hierholzer@desy.de> Date: Tue, 4 Feb 2020 10:26:04 +0100 Subject: [PATCH] fix not synchronising test logic to start of mainLoop() this was violating thread safety of accessors, since the mainLoopWrapper() was reading initial values at the same time as the test thread was reading the same accessors. --- tests/executables_src/testTrigger.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/executables_src/testTrigger.cc b/tests/executables_src/testTrigger.cc index 892bb175..0a0fd4f0 100644 --- a/tests/executables_src/testTrigger.cc +++ b/tests/executables_src/testTrigger.cc @@ -197,6 +197,7 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(testTriggerDevToCS, T, test_types) { app.initialise(); app.run(); + app.testModule.mainLoopStarted.wait(); // make sure the module's mainLoop() is entered auto myCSVar = pvManagers.first->getProcessArray<T>("/myCSVar"); @@ -248,6 +249,7 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(testTriggerByCS, T, test_types) { app.initialise(); app.run(); + app.testModule.mainLoopStarted.wait(); // make sure the module's mainLoop() is entered auto myCSVar = pvManagers.first->getProcessArray<T>("/myCSVar"); auto theTrigger = pvManagers.first->getProcessArray<T>("/theTrigger"); @@ -307,6 +309,7 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(testTriggerTransferGroup, T, test_types) { app.dev2("/REG3")[app.testModule.theTrigger] >> app.testModule.consumingPush3; app.initialise(); app.run(); + app.testModule.mainLoopStarted.wait(); // make sure the module's mainLoop() is entered // initialise values app.testModule.consumingPush = 0; -- GitLab