From a7d83f19b08eb4c6f79a82fe60c2b86db13f4420 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sat, 24 Nov 2018 13:44:03 +0100 Subject: Squashed 'waflib/' changes from 6e726eb1..5ea8f99f 5ea8f99f Improve test output spacing 0e23b29f Raise exception when test suite fails to ensure non-zero exit status d6de073b Show run time of unit tests 5b655541 Add short configure option for ultra-strict flags 4687ba6d Use gtest-like test output 258903d9 Fix failure count in test group summaries da07e738 Fix verbose tests with Python 3 git-subtree-dir: waflib git-subtree-split: 5ea8f99f6e1246079c1fe6bb590c38a53aadd40d --- tests/TestClient.hpp | 54 -------- tests/connect_disconnect_node_node.ttl | 36 ----- tests/connect_disconnect_node_patch.ttl | 105 --------------- tests/connect_disconnect_patch_patch.ttl | 36 ----- tests/copy_node.ttl | 16 --- tests/create_delete_node.ttl | 27 ---- tests/create_delete_patch.ttl | 14 -- tests/create_delete_poly_patch.ttl | 15 --- tests/create_delete_port.ttl | 53 -------- tests/disconnect_all_node.ttl | 45 ------- tests/disconnect_all_port.ttl | 32 ----- tests/duplicate_node.ttl | 19 --- tests/empty.ingen/main.ttl | 52 ------- tests/empty.ingen/manifest.ttl | 16 --- tests/enable_graph.ttl | 15 --- tests/get_engine.ttl | 7 - tests/get_node.ttl | 15 --- tests/get_patch.ttl | 39 ------ tests/get_plugin.ttl | 7 - tests/get_plugins.ttl | 7 - tests/get_port.ttl | 15 --- tests/ingen_bench.cpp | 140 ------------------- tests/ingen_test.cpp | 223 ------------------------------- tests/load_graph.ttl | 8 -- tests/move_node.ttl | 16 --- tests/move_port.ttl | 16 --- tests/move_root_port.ttl | 20 --- tests/poly.ttl | 25 ---- tests/put_audio_in.ttl | 10 -- tests/save_graph.ttl | 8 -- tests/set_graph_poly.ttl | 17 --- tests/set_patch_port_value.ttl | 17 --- tests/test_utils.hpp | 40 ------ tests/tst_FilePath.cpp | 103 -------------- 34 files changed, 1268 deletions(-) delete mode 100644 tests/TestClient.hpp delete mode 100644 tests/connect_disconnect_node_node.ttl delete mode 100644 tests/connect_disconnect_node_patch.ttl delete mode 100644 tests/connect_disconnect_patch_patch.ttl delete mode 100644 tests/copy_node.ttl delete mode 100644 tests/create_delete_node.ttl delete mode 100644 tests/create_delete_patch.ttl delete mode 100644 tests/create_delete_poly_patch.ttl delete mode 100644 tests/create_delete_port.ttl delete mode 100644 tests/disconnect_all_node.ttl delete mode 100644 tests/disconnect_all_port.ttl delete mode 100644 tests/duplicate_node.ttl delete mode 100644 tests/empty.ingen/main.ttl delete mode 100644 tests/empty.ingen/manifest.ttl delete mode 100644 tests/enable_graph.ttl delete mode 100644 tests/get_engine.ttl delete mode 100644 tests/get_node.ttl delete mode 100644 tests/get_patch.ttl delete mode 100644 tests/get_plugin.ttl delete mode 100644 tests/get_plugins.ttl delete mode 100644 tests/get_port.ttl delete mode 100644 tests/ingen_bench.cpp delete mode 100644 tests/ingen_test.cpp delete mode 100644 tests/load_graph.ttl delete mode 100644 tests/move_node.ttl delete mode 100644 tests/move_port.ttl delete mode 100644 tests/move_root_port.ttl delete mode 100644 tests/poly.ttl delete mode 100644 tests/put_audio_in.ttl delete mode 100644 tests/save_graph.ttl delete mode 100644 tests/set_graph_poly.ttl delete mode 100644 tests/set_patch_port_value.ttl delete mode 100644 tests/test_utils.hpp delete mode 100644 tests/tst_FilePath.cpp (limited to 'tests') diff --git a/tests/TestClient.hpp b/tests/TestClient.hpp deleted file mode 100644 index 8d99db86..00000000 --- a/tests/TestClient.hpp +++ /dev/null @@ -1,54 +0,0 @@ -/* - This file is part of Ingen. - Copyright 2007-2017 David Robillard - - 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 . -*/ - -#ifndef INGEN_TESTCLIENT_HPP -#define INGEN_TESTCLIENT_HPP - -#include - -#include "ingen/Interface.hpp" -#include "ingen/Log.hpp" - -using namespace Ingen; - -class TestClient : public Ingen::Interface -{ -public: - explicit TestClient(Log& log) : _log(log) {} - ~TestClient() {} - - URI uri() const override { return URI("ingen:testClient"); } - - void message(const Message& msg) override { - if (const Response* const response = boost::get(&msg)) { - if (response->status != Status::SUCCESS) { - _log.error(fmt("error on message %1%: %2% (%3%)\n") - % response->id - % ingen_status_string(response->status) - % response->subject); - exit(EXIT_FAILURE); - } - } else if (const Error* const error = boost::get(&msg)) { - _log.error(fmt("error: %1%\n") % error->message); - exit(EXIT_FAILURE); - } - } - -private: - Log& _log; -}; - -#endif // INGEN_TESTCLIENT_HPP diff --git a/tests/connect_disconnect_node_node.ttl b/tests/connect_disconnect_node_node.ttl deleted file mode 100644 index 935de482..00000000 --- a/tests/connect_disconnect_node_node.ttl +++ /dev/null @@ -1,36 +0,0 @@ -@prefix lv2: . -@prefix patch: . -@prefix ingen: . - - - a patch:Put ; - patch:subject ; - patch:body [ - a ingen:Block ; - lv2:prototype - ] . - - - a patch:Put ; - patch:subject ; - patch:body [ - a ingen:Block ; - lv2:prototype - ] . - - - a patch:Put ; - patch:subject ; - patch:body [ - a ingen:Arc ; - ingen:tail ; - ingen:head - ] . - - - a patch:Delete ; - patch:body [ - a ingen:Arc ; - ingen:tail ; - ingen:head - ] . diff --git a/tests/connect_disconnect_node_patch.ttl b/tests/connect_disconnect_node_patch.ttl deleted file mode 100644 index 77ada2ad..00000000 --- a/tests/connect_disconnect_node_patch.ttl +++ /dev/null @@ -1,105 +0,0 @@ -@prefix atom: . -@prefix lv2: . -@prefix patch: . -@prefix ingen: . - - - a patch:Put ; - patch:subject ; - patch:body [ - a ingen:Block ; - lv2:prototype - ] . - - - a patch:Put ; - patch:subject ; - patch:body [ - a ingen:Block ; - lv2:prototype - ] . - - - a patch:Put ; - patch:subject ; - patch:body [ - a lv2:OutputPort , - lv2:AudioPort - ] . - - - a patch:Put ; - patch:subject ; - patch:body [ - a lv2:InputPort , - lv2:AudioPort - ] . - - - a patch:Put ; - patch:subject ; - patch:body [ - a lv2:InputPort , - atom:AtomPort ; - atom:bufferType atom:Sequence - ] . - - - a patch:Put ; - patch:subject ; - patch:body [ - a lv2:InputPort , - lv2:ControlPort - ] . - - - a patch:Put ; - patch:subject ; - patch:body [ - a ingen:Arc ; - ingen:tail ; - ingen:head - ] . - - - a patch:Put ; - patch:subject ; - patch:body [ - a ingen:Arc ; - ingen:tail ; - ingen:head - ] . - - - a patch:Put ; - patch:subject ; - patch:body [ - a ingen:Arc ; - ingen:tail ; - ingen:head - ] . - - - a patch:Put ; - patch:subject ; - patch:body [ - a ingen:Arc ; - ingen:tail ; - ingen:head - ] . - - - a patch:Delete ; - patch:body [ - a ingen:Arc ; - ingen:tail ; - ingen:head - ] . - - - a patch:Delete ; - patch:body [ - a ingen:Arc ; - ingen:tail ; - ingen:head - ] . diff --git a/tests/connect_disconnect_patch_patch.ttl b/tests/connect_disconnect_patch_patch.ttl deleted file mode 100644 index b35a4b55..00000000 --- a/tests/connect_disconnect_patch_patch.ttl +++ /dev/null @@ -1,36 +0,0 @@ -@prefix lv2: . -@prefix patch: . -@prefix ingen: . - - - a patch:Put ; - patch:subject ; - patch:body [ - a lv2:InputPort , - lv2:AudioPort - ] . - - - a patch:Put ; - patch:subject ; - patch:body [ - a lv2:InputPort , - lv2:AudioPort - ] . - - - a patch:Put ; - patch:subject ; - patch:body [ - a ingen:Arc ; - ingen:tail ; - ingen:head - ] . - - - a patch:Delete ; - patch:body [ - a ingen:Arc ; - ingen:tail ; - ingen:head - ] . diff --git a/tests/copy_node.ttl b/tests/copy_node.ttl deleted file mode 100644 index 129ba758..00000000 --- a/tests/copy_node.ttl +++ /dev/null @@ -1,16 +0,0 @@ -@prefix lv2: . -@prefix patch: . -@prefix ingen: . - - - a patch:Put ; - patch:subject ; - patch:body [ - a ingen:Block ; - lv2:prototype - ] . - - - a patch:Copy ; - patch:subject ; - patch:destination . diff --git a/tests/create_delete_node.ttl b/tests/create_delete_node.ttl deleted file mode 100644 index 81086e69..00000000 --- a/tests/create_delete_node.ttl +++ /dev/null @@ -1,27 +0,0 @@ -@prefix lv2: . -@prefix patch: . -@prefix ingen: . - - - a patch:Put ; - patch:subject ; - patch:body [ - a ingen:Block ; - lv2:prototype - ] . - - - a patch:Delete ; - patch:subject . - - - a patch:Put ; - patch:subject ; - patch:body [ - a ingen:Block ; - ingen:prototype - ] . - - - a patch:Delete ; - patch:subject . diff --git a/tests/create_delete_patch.ttl b/tests/create_delete_patch.ttl deleted file mode 100644 index 2fa72c42..00000000 --- a/tests/create_delete_patch.ttl +++ /dev/null @@ -1,14 +0,0 @@ -@prefix lv2: . -@prefix patch: . -@prefix ingen: . - - - a patch:Put ; - patch:subject ; - patch:body [ - a ingen:Graph ; - ] . - - - a patch:Delete ; - patch:subject . diff --git a/tests/create_delete_poly_patch.ttl b/tests/create_delete_poly_patch.ttl deleted file mode 100644 index ea0228d4..00000000 --- a/tests/create_delete_poly_patch.ttl +++ /dev/null @@ -1,15 +0,0 @@ -@prefix lv2: . -@prefix patch: . -@prefix ingen: . - - - a patch:Put ; - patch:subject ; - patch:body [ - a ingen:Graph ; - ingen:polyphony 8 ; - ] . - - - a patch:Delete ; - patch:subject . diff --git a/tests/create_delete_port.ttl b/tests/create_delete_port.ttl deleted file mode 100644 index ba26560d..00000000 --- a/tests/create_delete_port.ttl +++ /dev/null @@ -1,53 +0,0 @@ -@prefix atom: . -@prefix lv2: . -@prefix patch: . -@prefix ingen: . - - - a patch:Put ; - patch:subject ; - patch:body [ - a lv2:InputPort , - lv2:AudioPort - ] . - - - a patch:Put ; - patch:subject ; - patch:body [ - a lv2:InputPort , - lv2:ControlPort - ] . - - - a patch:Put ; - patch:subject ; - patch:body [ - a lv2:InputPort , - lv2:CVPort - ] . - - - a patch:Put ; - patch:subject ; - patch:body [ - a lv2:InputPort , - atom:AtomPort ; - atom:bufferType atom:Sequence - ] . - - - a patch:Delete ; - patch:subject . - - - a patch:Delete ; - patch:subject . - - - a patch:Delete ; - patch:subject . - - - a patch:Delete ; - patch:subject . diff --git a/tests/disconnect_all_node.ttl b/tests/disconnect_all_node.ttl deleted file mode 100644 index 2b65f758..00000000 --- a/tests/disconnect_all_node.ttl +++ /dev/null @@ -1,45 +0,0 @@ -@prefix lv2: . -@prefix patch: . -@prefix ingen: . - - - a patch:Put ; - patch:subject ; - patch:body [ - a ingen:Block ; - lv2:prototype - ] . - - - a patch:Put ; - patch:subject ; - patch:body [ - a ingen:Block ; - lv2:prototype - ] . - - - a patch:Put ; - patch:subject ; - patch:body [ - a ingen:Arc ; - ingen:tail ; - ingen:head - ] . - - - a patch:Put ; - patch:subject ; - patch:body [ - a ingen:Arc ; - ingen:tail ; - ingen:head - ] . - - - a patch:Delete ; - patch:subject ; - patch:body [ - a ingen:Arc ; - ingen:incidentTo - ] . diff --git a/tests/disconnect_all_port.ttl b/tests/disconnect_all_port.ttl deleted file mode 100644 index 5c2d92f2..00000000 --- a/tests/disconnect_all_port.ttl +++ /dev/null @@ -1,32 +0,0 @@ -@prefix lv2: . -@prefix patch: . -@prefix ingen: . - - - a patch:Put ; - patch:subject ; - patch:body [ - a lv2:InputPort , - lv2:AudioPort - ] . - - - a patch:Put ; - patch:subject ; - patch:body [ - a ingen:Block ; - lv2:prototype - ] . - - - a patch:Put ; - patch:subject ; - patch:body [ - a ingen:Arc ; - ingen:tail ; - ingen:head - ] . - - - a patch:Delete ; - patch:subject . diff --git a/tests/duplicate_node.ttl b/tests/duplicate_node.ttl deleted file mode 100644 index 47d71dfc..00000000 --- a/tests/duplicate_node.ttl +++ /dev/null @@ -1,19 +0,0 @@ -@prefix lv2: . -@prefix patch: . -@prefix ingen: . - - - a patch:Put ; - patch:subject ; - patch:body [ - a ingen:Block ; - lv2:prototype - ] . - - - a patch:Put ; - patch:subject ; - patch:body [ - a ingen:Block ; - lv2:prototype - ] . diff --git a/tests/empty.ingen/main.ttl b/tests/empty.ingen/main.ttl deleted file mode 100644 index eee1ce4b..00000000 --- a/tests/empty.ingen/main.ttl +++ /dev/null @@ -1,52 +0,0 @@ -@prefix atom: . -@prefix doap: . -@prefix ingen: . -@prefix lv2: . -@prefix midi: . -@prefix owl: . -@prefix patch: . -@prefix rdf: . -@prefix rdfs: . -@prefix xsd: . - - - ingen:canvasX 32.0 ; - ingen:canvasY 32.0 ; - ingen:polyphonic false ; - atom:bufferType atom:Sequence ; - atom:supports patch:Message ; - 4096 ; - lv2:designation lv2:control ; - lv2:index 0 ; - lv2:name "Control" ; - lv2:portProperty lv2:connectionOptional ; - lv2:symbol "control" ; - a atom:AtomPort , - lv2:InputPort . - -<> - ingen:polyphony 1 ; - ingen:GraphUIGtk2 ; - lv2:extensionData ; - lv2:port , - ; - lv2:symbol "empty" ; - doap:name "empty" ; - a ingen:Graph , - lv2:Plugin . - - - ingen:canvasX 128.0 ; - ingen:canvasY 32.0 ; - ingen:polyphonic false ; - atom:bufferType atom:Sequence ; - atom:supports patch:Message ; - 4096 ; - lv2:designation lv2:control ; - lv2:index 1 ; - lv2:name "Control" ; - lv2:portProperty lv2:connectionOptional ; - lv2:symbol "notify" ; - a atom:AtomPort , - lv2:OutputPort . - diff --git a/tests/empty.ingen/manifest.ttl b/tests/empty.ingen/manifest.ttl deleted file mode 100644 index 71f194a0..00000000 --- a/tests/empty.ingen/manifest.ttl +++ /dev/null @@ -1,16 +0,0 @@ -@prefix atom: . -@prefix patch: . -@prefix doap: . -@prefix ingen: . -@prefix lv2: . -@prefix midi: . -@prefix owl: . -@prefix rdf: . -@prefix rdfs: . -@prefix xsd: . - - - lv2:prototype ingen:GraphPrototype ; - a ingen:Graph , - lv2:Plugin ; - rdfs:seeAlso . diff --git a/tests/enable_graph.ttl b/tests/enable_graph.ttl deleted file mode 100644 index f3fa786c..00000000 --- a/tests/enable_graph.ttl +++ /dev/null @@ -1,15 +0,0 @@ -@prefix ingen: . -@prefix lv2: . -@prefix patch: . - - - a patch:Set ; - patch:subject ; - patch:property ingen:enabled ; - patch:value true . - - - a patch:Set ; - patch:subject ; - patch:property ingen:enabled ; - patch:value false . diff --git a/tests/get_engine.ttl b/tests/get_engine.ttl deleted file mode 100644 index adfa6a01..00000000 --- a/tests/get_engine.ttl +++ /dev/null @@ -1,7 +0,0 @@ -@prefix lv2: . -@prefix patch: . -@prefix ingen: . - - - a patch:Get ; - patch:subject . diff --git a/tests/get_node.ttl b/tests/get_node.ttl deleted file mode 100644 index 12977092..00000000 --- a/tests/get_node.ttl +++ /dev/null @@ -1,15 +0,0 @@ -@prefix lv2: . -@prefix patch: . -@prefix ingen: . - - - a patch:Put ; - patch:subject ; - patch:body [ - a ingen:Block ; - lv2:prototype - ] . - - - a patch:Get ; - patch:subject . diff --git a/tests/get_patch.ttl b/tests/get_patch.ttl deleted file mode 100644 index 9ea9e036..00000000 --- a/tests/get_patch.ttl +++ /dev/null @@ -1,39 +0,0 @@ -@prefix lv2: . -@prefix patch: . -@prefix ingen: . - - - a patch:Put ; - patch:subject ; - patch:body [ - a ingen:Graph - ] . - - - a patch:Put ; - patch:subject ; - patch:body [ - a ingen:Block ; - lv2:prototype - ] . - - - a patch:Put ; - patch:subject ; - patch:body [ - a ingen:Block ; - lv2:prototype - ] . - - - a patch:Put ; - patch:subject ; - patch:body [ - a ingen:Arc ; - ingen:tail ; - ingen:head - ] . - - - a patch:Get ; - patch:subject . diff --git a/tests/get_plugin.ttl b/tests/get_plugin.ttl deleted file mode 100644 index 19a9c93c..00000000 --- a/tests/get_plugin.ttl +++ /dev/null @@ -1,7 +0,0 @@ -@prefix lv2: . -@prefix patch: . -@prefix ingen: . - - - a patch:Get ; - patch:subject . diff --git a/tests/get_plugins.ttl b/tests/get_plugins.ttl deleted file mode 100644 index 8dc91cdf..00000000 --- a/tests/get_plugins.ttl +++ /dev/null @@ -1,7 +0,0 @@ -@prefix lv2: . -@prefix patch: . -@prefix ingen: . - - - a patch:Get ; - patch:subject . diff --git a/tests/get_port.ttl b/tests/get_port.ttl deleted file mode 100644 index 4f26e499..00000000 --- a/tests/get_port.ttl +++ /dev/null @@ -1,15 +0,0 @@ -@prefix lv2: . -@prefix patch: . -@prefix ingen: . - - - a patch:Put ; - patch:subject ; - patch:body [ - a lv2:InputPort , - lv2:AudioPort - ] . - - - a patch:Get ; - patch:subject . diff --git a/tests/ingen_bench.cpp b/tests/ingen_bench.cpp deleted file mode 100644 index e8cccf4c..00000000 --- a/tests/ingen_bench.cpp +++ /dev/null @@ -1,140 +0,0 @@ -/* - This file is part of Ingen. - Copyright 2007-2017 David Robillard - - 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 . -*/ - -#include -#include -#include -#include - -#include "ingen/Clock.hpp" -#include "ingen/Configuration.hpp" -#include "ingen/EngineBase.hpp" -#include "ingen/Forge.hpp" -#include "ingen/Interface.hpp" -#include "ingen/Parser.hpp" -#include "ingen/World.hpp" -#include "ingen/runtime_paths.hpp" -#include "ingen/types.hpp" - -#include "TestClient.hpp" -#include "ingen_config.h" - -using namespace std; -using namespace Ingen; - -World* world = nullptr; - -static void -ingen_try(bool cond, const char* msg) -{ - if (!cond) { - cerr << "ingen: Error: " << msg << endl; - delete world; - exit(EXIT_FAILURE); - } -} - -static std::string -real_path(const char* path) -{ - char* const c_real_path = realpath(path, nullptr); - const std::string result(c_real_path ? c_real_path : ""); - free(c_real_path); - return result; -} - -int -main(int argc, char** argv) -{ - set_bundle_path_from_code((void*)&ingen_try); - - // Create world - try { - world = new World(nullptr, nullptr, nullptr); - world->conf().add( - "output", "output", 'O', "File to write benchmark output", - Ingen::Configuration::SESSION, world->forge().String, Atom()); - world->load_configuration(argc, argv); - } catch (std::exception& e) { - cout << "ingen: " << e.what() << endl; - return EXIT_FAILURE; - } - - // Get mandatory command line arguments - const Atom& load = world->conf().option("load"); - const Atom& out = world->conf().option("output"); - if (!load.is_valid() || !out.is_valid()) { - cerr << "Usage: ingen_bench --load START_GRAPH --output OUT_FILE" << endl; - return EXIT_FAILURE; - } - - // Get start graph and output file options - const std::string start_graph = real_path((const char*)load.get_body()); - const std::string out_file = (const char*)out.get_body(); - if (start_graph.empty()) { - cerr << "error: initial graph '" - << ((const char*)load.get_body()) - << "' does not exist" << endl; - return EXIT_FAILURE; - } - - // Load modules - ingen_try(world->load_module("server"), - "Unable to load server module"); - - // Initialise engine - ingen_try(bool(world->engine()), - "Unable to create engine"); - world->engine()->init(48000.0, 4096, 4096); - world->engine()->activate(); - - // Load graph - if (!world->parser()->parse_file(world, world->interface().get(), start_graph)) { - cerr << "error: failed to load initial graph " << start_graph << endl; - return EXIT_FAILURE; - } - world->engine()->flush_events(std::chrono::milliseconds(20)); - - // Run benchmark - // TODO: Set up real-time scheduling for this and worker threads - Ingen::Clock clock; - const uint32_t n_test_frames = 1 << 20; - const uint32_t block_length = 4096; - const uint64_t t_start = clock.now_microseconds(); - for (uint32_t i = 0; i < n_test_frames; i += block_length) { - world->engine()->advance(block_length); - world->engine()->run(block_length); - //world->engine()->main_iteration(); - } - const uint64_t t_end = clock.now_microseconds(); - - // Write log output - FILE* log = fopen(out_file.c_str(), "a"); - if (ftell(log) == 0) { - fprintf(log, "# n_threads\trun_time\treal_time\n"); - } - fprintf(log, "%u\t%f\t%f\n", - world->conf().option("threads").get(), - (t_end - t_start) / 1000000.0, - (n_test_frames / 48000.0)); - fclose(log); - - // Shut down - world->engine()->deactivate(); - - delete world; - return EXIT_SUCCESS; -} diff --git a/tests/ingen_test.cpp b/tests/ingen_test.cpp deleted file mode 100644 index c0a7bd32..00000000 --- a/tests/ingen_test.cpp +++ /dev/null @@ -1,223 +0,0 @@ -/* - This file is part of Ingen. - Copyright 2007-2017 David Robillard - - 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 . -*/ - -#include - -#include -#include -#include - -#include - -#include "raul/Path.hpp" - -#include "serd/serd.h" -#include "sord/sordmm.hpp" -#include "sratom/sratom.h" - -#include "ingen_config.h" - -#include "ingen/AtomReader.hpp" -#include "ingen/AtomWriter.hpp" -#include "ingen/Configuration.hpp" -#include "ingen/Configuration.hpp" -#include "ingen/EngineBase.hpp" -#include "ingen/Interface.hpp" -#include "ingen/Parser.hpp" -#include "ingen/Properties.hpp" -#include "ingen/Serialiser.hpp" -#include "ingen/Store.hpp" -#include "ingen/URIMap.hpp" -#include "ingen/World.hpp" -#include "ingen/filesystem.hpp" -#include "ingen/runtime_paths.hpp" -#include "ingen/types.hpp" - -#include "TestClient.hpp" - -using namespace std; -using namespace Ingen; - -World* world = nullptr; - -static 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) -{ - set_bundle_path_from_code((void*)&ingen_try); - - // Create world - try { - world = new World(nullptr, nullptr, nullptr); - world->load_configuration(argc, argv); - } catch (std::exception& e) { - cout << "ingen: " << e.what() << endl; - return EXIT_FAILURE; - } - - // Get mandatory command line arguments - const Atom& load = world->conf().option("load"); - const Atom& execute = world->conf().option("execute"); - if (!load.is_valid() || !execute.is_valid()) { - cerr << "Usage: ingen_test --load START_GRAPH --execute COMMANDS_FILE" << endl; - return EXIT_FAILURE; - } - - // Get start graph and commands file options - const char* load_path = (const char*)load.get_body(); - char* real_start_graph = realpath(load_path, nullptr); - if (!real_start_graph) { - cerr << "error: initial graph '" << load_path << "' does not exist" << endl; - return EXIT_FAILURE; - } - - const std::string start_graph = real_start_graph; - const FilePath cmds_file_path = (const char*)execute.get_body(); - free(real_start_graph); - - // Load modules - ingen_try(world->load_module("server"), - "Unable to load server module"); - - // Initialise engine - ingen_try(bool(world->engine()), - "Unable to create engine"); - world->engine()->init(48000.0, 4096, 4096); - world->engine()->activate(); - - // Load graph - if (!world->parser()->parse_file(world, world->interface().get(), start_graph)) { - cerr << "error: failed to load initial graph " << start_graph << endl; - return EXIT_FAILURE; - } - world->engine()->flush_events(std::chrono::milliseconds(20)); - - // Read commands - - LV2_URID_Map* map = &world->uri_map().urid_map_feature()->urid_map; - Sratom* sratom = sratom_new(map); - - sratom_set_object_mode(sratom, SRATOM_OBJECT_MODE_BLANK_SUBJECT); - - LV2_Atom_Forge forge; - lv2_atom_forge_init(&forge, map); - - AtomForgeSink out(&forge); - - // AtomReader to read commands from a file and send them to engine - AtomReader atom_reader(world->uri_map(), - world->uris(), - world->log(), - *world->interface().get()); - - // AtomWriter to serialise responses from the engine - SPtr client(new TestClient(world->log())); - - world->interface()->set_respondee(client); - world->engine()->register_client(client); - - SerdURI cmds_base; - SerdNode cmds_file_uri = serd_node_new_file_uri( - (const uint8_t*)cmds_file_path.c_str(), - nullptr, &cmds_base, true); - Sord::Model* cmds = new Sord::Model(*world->rdf_world(), - (const char*)cmds_file_uri.buf); - SerdEnv* env = serd_env_new(&cmds_file_uri); - cmds->load_file(env, SERD_TURTLE, cmds_file_path); - Sord::Node nil; - int n_events = 0; - for (;; ++n_events) { - std::string subject_str = (fmt("msg%1%") % n_events).str(); - Sord::URI subject(*world->rdf_world(), subject_str, - (const char*)cmds_file_uri.buf); - Sord::Iter iter = cmds->find(subject, nil, nil); - if (iter.end()) { - break; - } - - out.clear(); - sratom_read(sratom, &forge, world->rdf_world()->c_obj(), - cmds->c_obj(), subject.c_obj()); - -#if 0 - const LV2_Atom* atom = out.atom(); - cerr << "READ " << atom->size << " BYTES" << endl; - cerr << sratom_to_turtle( - sratom, - &world->uri_map().urid_unmap_feature()->urid_unmap, - (const char*)cmds_file_uri.buf, - NULL, NULL, atom->type, atom->size, LV2_ATOM_BODY(atom)) << endl; -#endif - - if (!atom_reader.write(out.atom(), n_events + 1)) { - return EXIT_FAILURE; - } - - world->engine()->flush_events(std::chrono::milliseconds(20)); - } - - delete cmds; - - // Save resulting graph - auto r = world->store()->find(Raul::Path("/")); - const std::string base = cmds_file_path.stem(); - const std::string out_name = base.substr(0, base.find('.')) + ".out.ingen"; - const FilePath out_path = filesystem::current_path() / out_name; - world->serialiser()->write_bundle(r->second, URI(out_path)); - - // Undo every event (should result in a graph identical to the original) - for (int i = 0; i < n_events; ++i) { - world->interface()->undo(); - world->engine()->flush_events(std::chrono::milliseconds(20)); - } - - // Save completely undone graph - r = world->store()->find(Raul::Path("/")); - const std::string undo_name = base.substr(0, base.find('.')) + ".undo.ingen"; - const FilePath undo_path = filesystem::current_path() / undo_name; - world->serialiser()->write_bundle(r->second, URI(undo_path)); - - // Redo every event (should result in a graph identical to the pre-undo output) - for (int i = 0; i < n_events; ++i) { - world->interface()->redo(); - world->engine()->flush_events(std::chrono::milliseconds(20)); - } - - // Save completely redone graph - r = world->store()->find(Raul::Path("/")); - const std::string redo_name = base.substr(0, base.find('.')) + ".redo.ingen"; - const FilePath redo_path = filesystem::current_path() / redo_name; - world->serialiser()->write_bundle(r->second, URI(redo_path)); - - serd_env_free(env); - sratom_free(sratom); - serd_node_free(&cmds_file_uri); - - // Shut down - world->engine()->deactivate(); - - delete world; - return EXIT_SUCCESS; -} diff --git a/tests/load_graph.ttl b/tests/load_graph.ttl deleted file mode 100644 index f1cd9dda..00000000 --- a/tests/load_graph.ttl +++ /dev/null @@ -1,8 +0,0 @@ -@prefix lv2: . -@prefix patch: . -@prefix ingen: . - - - a patch:Copy ; - patch:subject ; - patch:destination . diff --git a/tests/move_node.ttl b/tests/move_node.ttl deleted file mode 100644 index 22f6cfb8..00000000 --- a/tests/move_node.ttl +++ /dev/null @@ -1,16 +0,0 @@ -@prefix lv2: . -@prefix patch: . -@prefix ingen: . - - - a patch:Put ; - patch:subject ; - patch:body [ - a ingen:Block ; - lv2:prototype - ] . - - - a patch:Move ; - patch:subject ; - patch:destination . diff --git a/tests/move_port.ttl b/tests/move_port.ttl deleted file mode 100644 index 4b035037..00000000 --- a/tests/move_port.ttl +++ /dev/null @@ -1,16 +0,0 @@ -@prefix lv2: . -@prefix patch: . -@prefix ingen: . - - - a patch:Put ; - patch:subject ; - patch:body [ - a lv2:InputPort , - lv2:AudioPort - ] . - - - a patch:Move ; - patch:subject ; - patch:destination . diff --git a/tests/move_root_port.ttl b/tests/move_root_port.ttl deleted file mode 100644 index 2c925767..00000000 --- a/tests/move_root_port.ttl +++ /dev/null @@ -1,20 +0,0 @@ -@prefix lv2: . -@prefix patch: . -@prefix ingen: . - - - a patch:Put ; - patch:subject ; - patch:body [ - a lv2:InputPort , - lv2:AudioPort - ] . - - - a patch:Move ; - patch:subject ; - patch:destination . - - - a patch:Delete ; - patch:subject . diff --git a/tests/poly.ttl b/tests/poly.ttl deleted file mode 100644 index a02ba96e..00000000 --- a/tests/poly.ttl +++ /dev/null @@ -1,25 +0,0 @@ -@prefix lv2: . -@prefix patch: . -@prefix ingen: . - - - a patch:Put ; - patch:subject ; - patch:body [ - a ingen:Block ; - lv2:prototype - ] . - - - a patch:Set ; - patch:context ingen:internalContext ; - patch:subject ; - patch:property ingen:polyphony ; - patch:value 4 . - - - a patch:Set ; - patch:context ingen:externalContext ; - patch:subject ; - patch:property ingen:polyphonic ; - patch:value true . diff --git a/tests/put_audio_in.ttl b/tests/put_audio_in.ttl deleted file mode 100644 index 97468cff..00000000 --- a/tests/put_audio_in.ttl +++ /dev/null @@ -1,10 +0,0 @@ -@prefix lv2: . -@prefix patch: . - - - a patch:Put ; - patch:subject ; - patch:body [ - a lv2:InputPort , - lv2:AudioPort - ] . diff --git a/tests/save_graph.ttl b/tests/save_graph.ttl deleted file mode 100644 index 5f472d80..00000000 --- a/tests/save_graph.ttl +++ /dev/null @@ -1,8 +0,0 @@ -@prefix lv2: . -@prefix patch: . -@prefix ingen: . - - - a patch:Copy ; - patch:subject ; - patch:destination . diff --git a/tests/set_graph_poly.ttl b/tests/set_graph_poly.ttl deleted file mode 100644 index 0933c3a4..00000000 --- a/tests/set_graph_poly.ttl +++ /dev/null @@ -1,17 +0,0 @@ -@prefix ingen: . -@prefix lv2: . -@prefix patch: . - - - a patch:Set ; - patch:context ingen:internalContext ; - patch:subject ; - patch:property ingen:polyphony ; - patch:value 4 . - - - a patch:Set ; - patch:context ingen:internalContext ; - patch:subject ; - patch:property ingen:polyphony ; - patch:value 1 . diff --git a/tests/set_patch_port_value.ttl b/tests/set_patch_port_value.ttl deleted file mode 100644 index 07b467b4..00000000 --- a/tests/set_patch_port_value.ttl +++ /dev/null @@ -1,17 +0,0 @@ -@prefix ingen: . -@prefix lv2: . -@prefix patch: . - - - a patch:Put ; - patch:subject ; - patch:body [ - a lv2:InputPort , - lv2:ControlPort - ] . - - - a patch:Set ; - patch:subject ; - patch:property ingen:value ; - patch:value 0.5 . \ No newline at end of file diff --git a/tests/test_utils.hpp b/tests/test_utils.hpp deleted file mode 100644 index a0cc53ac..00000000 --- a/tests/test_utils.hpp +++ /dev/null @@ -1,40 +0,0 @@ -/* - This file is part of Ingen. - Copyright 2018 David Robillard - - 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 . -*/ - -#include - -#include - -typedef boost::basic_format fmt; - -#define EXPECT_TRUE(value) \ - if (!(value)) { \ - std::cerr << (fmt("error: %1%:%2%: !%3%\n") % __FILE__ % \ - __LINE__ % (#value)); \ - } - -#define EXPECT_FALSE(value) \ - if ((value)) { \ - std::cerr << (fmt("error: %1%:%2%: !%3%\n") % __FILE__ % \ - __LINE__ % (#value)); \ - } - -#define EXPECT_EQ(value, expected) \ - if (!((value) == (expected))) { \ - std::cerr << (fmt("error: %1%:%2%: %3% != %4%\n") % __FILE__ % \ - __LINE__ % (#value) % (#expected)); \ - std::cerr << "note: actual value: " << value << std::endl; \ - } diff --git a/tests/tst_FilePath.cpp b/tests/tst_FilePath.cpp deleted file mode 100644 index 55d6f1c2..00000000 --- a/tests/tst_FilePath.cpp +++ /dev/null @@ -1,103 +0,0 @@ -/* - This file is part of Ingen. - Copyright 2018 David Robillard - - 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 . -*/ - -#include - -#include "ingen/FilePath.hpp" -#include "test_utils.hpp" - -using Ingen::FilePath; - -int -main(int, char**) -{ - EXPECT_EQ(FilePath("/").parent_path(), FilePath("/")); - - EXPECT_TRUE(FilePath("/abs").is_absolute()) - EXPECT_FALSE(FilePath("/abs").is_relative()) - EXPECT_EQ(FilePath("/abs").root_name(), FilePath()); - EXPECT_EQ(FilePath("/abs").root_directory(), FilePath("/")); - EXPECT_EQ(FilePath("/abs").root_path(), FilePath("/")); - EXPECT_EQ(FilePath("/abs").relative_path(), FilePath("abs")); - EXPECT_EQ(FilePath("/abs").parent_path(), FilePath("/")); - EXPECT_EQ(FilePath("/abs").filename(), FilePath("abs")); - EXPECT_EQ(FilePath("/abs").stem(), FilePath("abs")); - EXPECT_EQ(FilePath("/abs").extension(), FilePath()); - - EXPECT_FALSE(FilePath("rel").is_absolute()) - EXPECT_TRUE(FilePath("rel").is_relative()) - EXPECT_EQ(FilePath("rel").root_name(), FilePath()); - EXPECT_EQ(FilePath("rel").root_directory(), FilePath()); - EXPECT_EQ(FilePath("rel").root_path(), FilePath()); - EXPECT_EQ(FilePath("rel").relative_path(), FilePath()); - EXPECT_EQ(FilePath("rel").parent_path(), FilePath()); - EXPECT_EQ(FilePath("rel").filename(), "rel"); - EXPECT_EQ(FilePath("rel").stem(), "rel"); - EXPECT_EQ(FilePath("rel").extension(), FilePath()); - - EXPECT_FALSE(FilePath("file.txt").is_absolute()) - EXPECT_TRUE(FilePath("file.txt").is_relative()) - EXPECT_EQ(FilePath("file.txt").filename(), "file.txt"); - EXPECT_EQ(FilePath("file.txt").stem(), "file"); - EXPECT_EQ(FilePath("file.txt").extension(), ".txt"); - - EXPECT_TRUE(FilePath("/abs/file.txt").is_absolute()) - EXPECT_FALSE(FilePath("/abs/file.txt").is_relative()) - EXPECT_EQ(FilePath("/abs/file.txt").filename(), "file.txt"); - EXPECT_EQ(FilePath("/abs/file.txt").stem(), "file"); - EXPECT_EQ(FilePath("/abs/file.txt").extension(), ".txt"); - - EXPECT_FALSE(FilePath("rel/file.txt").is_absolute()) - EXPECT_TRUE(FilePath("rel/file.txt").is_relative()) - EXPECT_EQ(FilePath("rel/file.txt").filename(), "file.txt"); - EXPECT_EQ(FilePath("rel/file.txt").stem(), "file"); - EXPECT_EQ(FilePath("rel/file.txt").extension(), ".txt"); - - FilePath path("/x"); - EXPECT_EQ(path, "/x"); - path = std::string("/a"); - EXPECT_EQ(path, "/a"); - - path /= FilePath("b"); - EXPECT_EQ(path, "/a/b"); - - path += FilePath("ar"); - EXPECT_EQ(path, "/a/bar"); - - path += std::string("/c"); - EXPECT_EQ(path, "/a/bar/c"); - - path += "a"; - EXPECT_EQ(path, "/a/bar/ca"); - - path += 'r'; - EXPECT_EQ(path, "/a/bar/car"); - - path += boost::string_view("/d"); - EXPECT_EQ(path, "/a/bar/car/d"); - - const FilePath apple("apple"); - const FilePath zebra("zebra"); - EXPECT_TRUE(apple == apple); - EXPECT_TRUE(apple != zebra); - EXPECT_TRUE(apple < zebra); - EXPECT_TRUE(apple <= zebra); - EXPECT_TRUE(apple <= apple); - EXPECT_TRUE(zebra > apple); - EXPECT_TRUE(zebra >= apple); - EXPECT_TRUE(zebra >= zebra); - return 0; -} -- cgit v1.2.1