From 8a0f26c78747f5d1b7492ba21685a43c5158bb85 Mon Sep 17 00:00:00 2001 From: Ichthyostega Date: Wed, 11 Jan 2017 05:01:47 +0100 Subject: [PATCH] start and stop the Dispatcher for running the function(integration) test need also to start and stop the interface registry, since by policy we do not run the application framework itself for execution of the test suite; thus if some test actually needs an application service, it must be started/stopped manually --- tests/45controller.tests | 5 +++ .../control/session-command-function-test.cpp | 45 ++++++++++++++++--- 2 files changed, 43 insertions(+), 7 deletions(-) diff --git a/tests/45controller.tests b/tests/45controller.tests index 06c24b518..ee09c3692 100644 --- a/tests/45controller.tests +++ b/tests/45controller.tests @@ -125,3 +125,8 @@ END TEST "Dispatcher command queue" CommandQueue_test < +#include namespace proc { @@ -50,8 +55,9 @@ namespace test { using lib::time::Duration; using lib::time::Offset; using lib::Symbol; -// using util::isnil; + using util::isnil; using util::toString; + using std::string; namespace { // test fixture... @@ -129,25 +135,50 @@ namespace test { virtual void run (Arg) { + lumiera_interfaceregistry_init(); + lumiera::throwOnError(); + startDispatcher(); - perform_simpleInvocation(); - perform_messageInvocation(); - perform_massivelyParallel(); +// perform_simpleInvocation(); +// perform_messageInvocation(); +// perform_massivelyParallel(); stopDispatcher(); + + lumiera_interfaceregistry_destroy(); } + /** @test start the session loop thread, similar + * to what the »session subsystem« does + * @note we are _not_ actually starting the subsystem + * @see facade.cpp + */ void startDispatcher() { - UNIMPLEMENTED ("start the session loop thread"); + CHECK (not ProcDispatcher::instance().isRunning()); + + ProcDispatcher::instance().start ([&] (string* problemMessage) + { + CHECK (isnil (*problemMessage)); + thread_has_ended = true; + }); + + CHECK (ProcDispatcher::instance().isRunning()); + CHECK (not thread_has_ended); } + bool thread_has_ended{false}; void stopDispatcher() { - UNIMPLEMENTED ("stop the session loop thread"); + CHECK (ProcDispatcher::instance().isRunning()); + ProcDispatcher::instance().requestStop(); + + usleep(10000); + CHECK (not ProcDispatcher::instance().isRunning()); + CHECK (thread_has_ended); }