One of the goals of this extended clean-up and refactoring is to allow access to the data buffers of a `DataSink` through a `BuffHandle` as front-end. Which essentially means that the ''Buffer Provider Protocol'' and the ''Output Slot Protocol'' mesh together well. After the clean-up of the `BufferProvider` implementation hierarchy, the viability of this idea was demonstrated with the `BufferProxyAdapter` draft; so it is now roughly clear what must be changed within the existing implementation of `OutputSlot`. More specifically, the only actual implementation ever completed was a dummy implementation for test (`DiagnosticOutputSlot`), which hooked confusingly into the corresponding dummy implementation of `BufferProvider`, that was written one year earlier (and was also without actual implementation at that time). So the second half of the task ahead seems very similar to the first part: - the base implementation of the ''Output Slot Protocol'' seems roughly acceptable - but the actual dummy implementation was somewhat confused and should be re-written from scratch, without ''any attempt to cut corners by re-using other dummy code'' __Note__ as part of this analysis I discovered some gap in the design regarding timeout handling ⟶ Ticket #1417
109 lines
3.1 KiB
C++
109 lines
3.1 KiB
C++
/*
|
||
EngineInterface(Test) - verify basics of the engine (scheduling) service
|
||
|
||
Copyright (C)
|
||
2011, Hermann Vosseler <Ichthyostega@web.de>
|
||
|
||
**Lumiera** is free software; you can redistribute it and/or modify it
|
||
under the terms of the GNU General Public License as published by the
|
||
Free Software Foundation; either version 2 of the License, or (at your
|
||
option) any later version. See the file COPYING for further details.
|
||
|
||
* *****************************************************************/
|
||
|
||
/** @file engine-interface-test.cpp
|
||
** unit test \ref EngineInterface_test
|
||
*/
|
||
|
||
|
||
#include "test/run.hpp"
|
||
#include "lib/error.hpp"
|
||
|
||
#include "steam/engine/calc-stream.hpp"
|
||
#include "steam/engine/engine-service.hpp"
|
||
#include "steam/engine/engine-diagnostics.hpp"
|
||
#include "steam/play/output-slot.hpp"
|
||
#include "steam/play/diagnostic-output-slot.hpp"
|
||
#include "steam/mobject/model-port.hpp"
|
||
#include "steam/asset/pipe.hpp"
|
||
#include "lib/time/timevalue.hpp"
|
||
|
||
//#include <ctime>
|
||
|
||
using test::Test;
|
||
//using std::rand;
|
||
|
||
|
||
namespace steam {
|
||
namespace engine{
|
||
namespace test {
|
||
|
||
using asset::Pipe;
|
||
using asset::PPipe;
|
||
using mobject::ModelPort;
|
||
using steam::play::OutputSlot;
|
||
using steam::play::DiagnosticOutputSlot;
|
||
using lib::time::FrameRate;
|
||
|
||
typedef asset::ID<Pipe> PID;
|
||
typedef OutputSlot::Allocation Allocation;
|
||
|
||
|
||
namespace { // test fixture...
|
||
|
||
} // (End) test fixture
|
||
|
||
|
||
|
||
/***************************************************************//**
|
||
* @test cover the basic service exposed at the engine interface:
|
||
* create a calculation stream and verify the translation
|
||
* into individual jobs.
|
||
*
|
||
* This test relies on the engine's diagnostic facilities, allowing
|
||
* to log and verify the generated jobs without needing to execute
|
||
* them. So this test doesn't actually run the engine. There are
|
||
* \link OutputSlotProtocol_test other tests \endlink covering
|
||
* the output generation separate from the engine.
|
||
*
|
||
* @see CalcStream_test more in-depth coverage of the various
|
||
* flavours of calculation streams supported by the engine
|
||
* @see EngineService
|
||
* @see CalcStream
|
||
* @see OutputSlotProtocol_test
|
||
*/
|
||
class EngineInterface_test : public Test
|
||
{
|
||
|
||
virtual void
|
||
run (Arg)
|
||
{
|
||
UNIMPLEMENTED ("simple standard case of Engine interface usage");
|
||
|
||
EngineService& engine = EngineService::instance();
|
||
EngineDiagnostics monitor(engine);
|
||
|
||
PID pipe = Pipe::query("id(dummy)");
|
||
ModelPort port(pipe);
|
||
|
||
DiagnosticOutputSlot oSlot;
|
||
Allocation& output = oSlot.allocate();
|
||
Timings timings (FrameRate::PAL); /////////TODO
|
||
|
||
// Invoke test subject...
|
||
CalcStreams calc = engine.calculate(port, timings, output);
|
||
|
||
////TODO some direct checks on the calculation stream??
|
||
|
||
CHECK (monitor.has_scheduled_jobs_for(timings));
|
||
}
|
||
|
||
};
|
||
|
||
|
||
/** Register this test class... */
|
||
LAUNCHER (EngineInterface_test, "function engine");
|
||
|
||
|
||
|
||
}}} // namespace steam::engine::test
|