diff options
author | David Robillard <d@drobilla.net> | 2012-05-18 18:03:24 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2012-05-18 18:03:24 +0000 |
commit | ec4fd6dd3809a055b66c28f841df277e4cd9f62e (patch) | |
tree | 229dbb5f8046753c433853c890c32b1fdac97a48 /tests | |
parent | da03dbe262f38fa0cc5eaacd176a4d8efe5029db (diff) | |
download | ingen-ec4fd6dd3809a055b66c28f841df277e4cd9f62e.tar.gz ingen-ec4fd6dd3809a055b66c28f841df277e4cd9f62e.tar.bz2 ingen-ec4fd6dd3809a055b66c28f841df277e4cd9f62e.zip |
Beginnings of a test framework.
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@4427 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'tests')
-rw-r--r-- | tests/empty.ingen/empty.ttl | 41 | ||||
-rw-r--r-- | tests/empty.ingen/manifest.ttl | 17 | ||||
-rw-r--r-- | tests/ingen_test.cpp | 117 |
3 files changed, 175 insertions, 0 deletions
diff --git a/tests/empty.ingen/empty.ttl b/tests/empty.ingen/empty.ttl new file mode 100644 index 00000000..ac905a2e --- /dev/null +++ b/tests/empty.ingen/empty.ttl @@ -0,0 +1,41 @@ +@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . +@prefix atom: <http://lv2plug.in/ns/ext/atom#> . +@prefix patch: <http://lv2plug.in/ns/ext/patch#> . +@prefix doap: <http://usefulinc.com/ns/doap#> . +@prefix ingen: <http://drobilla.net/ns/ingen#> . +@prefix lv2: <http://lv2plug.in/ns/lv2core#> . +@prefix lv2ev: <http://lv2plug.in/ns/ext/event#> . +@prefix midi: <http://lv2plug.in/ns/ext/midi#> . +@prefix owl: <http://www.w3.org/2002/07/owl#> . +@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . +@prefix xsd: <http://www.w3.org/2001/XMLSchema#> . + +<control_in> + ingen:polyphonic false ; + atom:bufferType atom:Sequence ; + lv2:index 0 ; + lv2:name "Control" ; + lv2:portProperty lv2:connectionOptional ; + lv2:symbol "control_in" ; + a atom:AtomPort , + lv2:InputPort . + +<control_out> + ingen:polyphonic false ; + atom:bufferType atom:Sequence ; + lv2:index 1 ; + lv2:name "Control" ; + lv2:symbol "control_out" ; + a atom:AtomPort , + lv2:OutputPort . + +<> + ingen:polyphony 1 ; + <http://lv2plug.in/ns/extensions/ui#ui> ingen:PatchUIGtk2 ; + lv2:extensionData <http://lv2plug.in/ns/ext/state#interface> ; + lv2:port <control_in> , + <control_out> ; + lv2:symbol "empty" ; + doap:name "empty" ; + a ingen:Patch , + lv2:Plugin . diff --git a/tests/empty.ingen/manifest.ttl b/tests/empty.ingen/manifest.ttl new file mode 100644 index 00000000..5aec4db2 --- /dev/null +++ b/tests/empty.ingen/manifest.ttl @@ -0,0 +1,17 @@ +@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . +@prefix atom: <http://lv2plug.in/ns/ext/atom#> . +@prefix patch: <http://lv2plug.in/ns/ext/patch#> . +@prefix doap: <http://usefulinc.com/ns/doap#> . +@prefix ingen: <http://drobilla.net/ns/ingen#> . +@prefix lv2: <http://lv2plug.in/ns/lv2core#> . +@prefix lv2ev: <http://lv2plug.in/ns/ext/event#> . +@prefix midi: <http://lv2plug.in/ns/ext/midi#> . +@prefix owl: <http://www.w3.org/2002/07/owl#> . +@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . +@prefix xsd: <http://www.w3.org/2001/XMLSchema#> . + +<empty.ttl> + lv2:binary <libingen_lv2.so> ; + a ingen:Patch , + lv2:Plugin ; + rdfs:seeAlso <empty.ttl> . diff --git a/tests/ingen_test.cpp b/tests/ingen_test.cpp new file mode 100644 index 00000000..0a882023 --- /dev/null +++ b/tests/ingen_test.cpp @@ -0,0 +1,117 @@ +/* + This file is part of Ingen. + Copyright 2007-2012 David Robillard <http://drobilla.net/> + + Ingen is free software: you can redistribute it and/or modify it under the + terms of the GNU Affero General Public License as published by the Free + Software Foundation, either version 3 of the License, or any later version. + + Ingen is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU Affero General Public License for details. + + You should have received a copy of the GNU Affero General Public License + along with Ingen. If not, see <http://www.gnu.org/licenses/>. +*/ + +#include <signal.h> +#include <stdlib.h> + +#include <iostream> +#include <string> + +#include <boost/optional.hpp> + +#include <glibmm/convert.h> +#include <glibmm/miscutils.h> +#include <glibmm/thread.h> +#include <glibmm/timer.h> + +#include "raul/Configuration.hpp" +#include "raul/Path.hpp" +#include "raul/SharedPtr.hpp" +#include "raul/Thread.hpp" +#include "raul/log.hpp" + +#include "serd/serd.h" +#include "sord/sordmm.hpp" + +#include "ingen_config.h" + +#include "ingen/EngineBase.hpp" +#include "ingen/Interface.hpp" +#include "ingen/serialisation/Parser.hpp" +#include "ingen/shared/Configuration.hpp" +#include "ingen/shared/World.hpp" +#include "ingen/shared/runtime_paths.hpp" +#include "ingen/client/ThreadedSigClientInterface.hpp" +#ifdef WITH_BINDINGS +#include "bindings/ingen_bindings.hpp" +#endif + +using namespace std; +using namespace Ingen; + +Ingen::Shared::World* world = NULL; + +void +ingen_try(bool cond, const char* msg) +{ + if (!cond) { + cerr << "ingen: Error: " << msg << endl; + delete world; + exit(EXIT_FAILURE); + } +} + +int +main(int argc, char** argv) +{ + Glib::thread_init(); + Shared::set_bundle_path_from_code((void*)&main); + + // Create world + try { + world = new Ingen::Shared::World(argc, argv, NULL, NULL); + if (argc <= 1) { + world->conf().print_usage("ingen", cout); + return EXIT_FAILURE; + } else if (world->conf().option("help").get_bool()) { + world->conf().print_usage("ingen", cout); + return EXIT_SUCCESS; + } + } catch (std::exception& e) { + cout << "ingen: " << e.what() << endl; + return EXIT_FAILURE; + } + + // Run engine + //SharedPtr<Interface> engine_interface; + ingen_try(world->load_module("server_profiled"), + "Unable to load server module"); + + //ingen_try(world->load_module("client"), + // "Unable to load client module"); + + ingen_try(world->engine(), + "Unable to create engine"); + + ingen_try(world->load_module("serialisation_profiled"), + "Unable to load serialisation module"); + + world->engine()->init(48000.0, 4096); + world->engine()->activate(); + + world->parser()->parse_file(world, world->interface().get(), argv[1]); + while (world->engine()->run(4096)) { + world->engine()->main_iteration(); + } + + // Shut down + if (world->engine()) + world->engine()->deactivate(); + + delete world; + return 0; +} + |