summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2015-10-04 19:28:20 +0000
committerDavid Robillard <d@drobilla.net>2015-10-04 19:28:20 +0000
commit1bdcf3843770e085adbb7d665153b7a4d6ee7b7b (patch)
treeb31c74f3e9f37915a42d42d69736af3528dad9a6 /test
parent464659f73bddf4a7d7b254ca3191cc1bf6dc9a31 (diff)
downloadlilv-1bdcf3843770e085adbb7d665153b7a4d6ee7b7b.tar.gz
lilv-1bdcf3843770e085adbb7d665153b7a4d6ee7b7b.tar.bz2
lilv-1bdcf3843770e085adbb7d665153b7a4d6ee7b7b.zip
Improve test coverage
git-svn-id: http://svn.drobilla.net/lad/trunk/lilv@5742 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'test')
-rw-r--r--test/failed_lib_descriptor.lv2/failed_lib_descriptor.c30
-rw-r--r--test/failed_lib_descriptor.lv2/failed_lib_descriptor.ttl.in38
-rw-r--r--test/failed_lib_descriptor.lv2/manifest.ttl.in7
-rw-r--r--test/failed_lib_descriptor.lv2/test_failed_lib_descriptor.c44
-rw-r--r--test/lib_descriptor.lv2/lib_descriptor.c112
-rw-r--r--test/lib_descriptor.lv2/lib_descriptor.ttl.in41
-rw-r--r--test/lib_descriptor.lv2/manifest.ttl.in7
-rw-r--r--test/lib_descriptor.lv2/test_lib_descriptor.c52
-rw-r--r--test/lilv_test.c59
-rw-r--r--test/missing_descriptor.lv2/manifest.ttl.in7
-rw-r--r--test/missing_descriptor.lv2/missing_descriptor.c20
-rw-r--r--test/missing_descriptor.lv2/missing_descriptor.ttl.in38
-rw-r--r--test/missing_descriptor.lv2/test_missing_descriptor.c44
-rw-r--r--test/missing_name.lv2/manifest.ttl.in7
-rw-r--r--test/missing_name.lv2/missing_name.c93
-rw-r--r--test/missing_name.lv2/missing_name.ttl.in37
-rw-r--r--test/missing_name.lv2/test_missing_name.c44
-rw-r--r--test/missing_plugin.lv2/manifest.ttl.in7
-rw-r--r--test/missing_plugin.lv2/missing_plugin.c28
-rw-r--r--test/missing_plugin.lv2/missing_plugin.ttl.in38
-rw-r--r--test/missing_plugin.lv2/test_missing_plugin.c44
-rw-r--r--test/missing_port_name.lv2/manifest.ttl.in7
-rw-r--r--test/missing_port_name.lv2/missing_port_name.c93
-rw-r--r--test/missing_port_name.lv2/missing_port_name.ttl.in30
-rw-r--r--test/missing_port_name.lv2/test_missing_port_name.c46
-rw-r--r--test/test.lv2/manifest.ttl.in (renamed from test/manifest.ttl.in)4
-rw-r--r--test/test.lv2/test.c (renamed from test/test_plugin.c)2
-rw-r--r--test/test.lv2/test.ttl.in (renamed from test/test_plugin.ttl.in)2
28 files changed, 976 insertions, 5 deletions
diff --git a/test/failed_lib_descriptor.lv2/failed_lib_descriptor.c b/test/failed_lib_descriptor.lv2/failed_lib_descriptor.c
new file mode 100644
index 0000000..6a1fd90
--- /dev/null
+++ b/test/failed_lib_descriptor.lv2/failed_lib_descriptor.c
@@ -0,0 +1,30 @@
+/*
+ Lilv Test Plugin - Failed lib descriptor
+ Copyright 2011-2015 David Robillard <d@drobilla.net>
+
+ Permission to use, copy, modify, and/or distribute this software for any
+ purpose with or without fee is hereby granted, provided that the above
+ copyright notice and this permission notice appear in all copies.
+
+ THIS SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+*/
+
+#include <stdlib.h>
+
+#include "lv2/lv2plug.in/ns/lv2core/lv2.h"
+
+#define PLUGIN_URI "http://example.org/failed-lib-descriptor"
+
+LV2_SYMBOL_EXPORT
+const LV2_Lib_Descriptor*
+lv2_lib_descriptor(const char* bundle_path,
+ const LV2_Feature*const* features)
+{
+ return NULL;
+}
diff --git a/test/failed_lib_descriptor.lv2/failed_lib_descriptor.ttl.in b/test/failed_lib_descriptor.lv2/failed_lib_descriptor.ttl.in
new file mode 100644
index 0000000..f41545f
--- /dev/null
+++ b/test/failed_lib_descriptor.lv2/failed_lib_descriptor.ttl.in
@@ -0,0 +1,38 @@
+# Lilv Test Plugin - Failed lib descriptor
+# Copyright 2011-2015 David Robillard <d@drobilla.net>
+#
+# Permission to use, copy, modify, and/or distribute this software for any
+# purpose with or without fee is hereby granted, provided that the above
+# copyright notice and this permission notice appear in all copies.
+#
+# THIS SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+@prefix doap: <http://usefulinc.com/ns/doap#> .
+@prefix foaf: <http://xmlns.com/foaf/0.1/> .
+@prefix lv2: <http://lv2plug.in/ns/lv2core#> .
+@prefix ui: <http://lv2plug.in/ns/extensions/ui#> .
+
+<http://example.org/failed-lib-descriptor>
+ a lv2:Plugin ;
+ doap:name "Missing descriptor test" ;
+ doap:license <http://opensource.org/licenses/isc> ;
+ lv2:optionalFeature lv2:hardRTCapable ;
+ lv2:port [
+ a lv2:InputPort ,
+ lv2:ControlPort ;
+ lv2:index 0 ;
+ lv2:symbol "input" ;
+ lv2:name "Input"
+ ] , [
+ a lv2:OutputPort ,
+ lv2:ControlPort ;
+ lv2:index 1 ;
+ lv2:symbol "output" ;
+ lv2:name "Output"
+ ] .
diff --git a/test/failed_lib_descriptor.lv2/manifest.ttl.in b/test/failed_lib_descriptor.lv2/manifest.ttl.in
new file mode 100644
index 0000000..4724f0f
--- /dev/null
+++ b/test/failed_lib_descriptor.lv2/manifest.ttl.in
@@ -0,0 +1,7 @@
+@prefix lv2: <http://lv2plug.in/ns/lv2core#> .
+@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
+
+<http://example.org/failed-lib-descriptor>
+ a lv2:Plugin ;
+ lv2:binary <failed_lib_descriptor@SHLIB_EXT@> ;
+ rdfs:seeAlso <failed_lib_descriptor.ttl> .
diff --git a/test/failed_lib_descriptor.lv2/test_failed_lib_descriptor.c b/test/failed_lib_descriptor.lv2/test_failed_lib_descriptor.c
new file mode 100644
index 0000000..2bdc999
--- /dev/null
+++ b/test/failed_lib_descriptor.lv2/test_failed_lib_descriptor.c
@@ -0,0 +1,44 @@
+#include "lilv/lilv.h"
+#include "../src/lilv_internal.h"
+
+#define PLUGIN_URI "http://example.org/failed-lib-descriptor"
+
+#define TEST_ASSERT(check) do {\
+ if (!(check)) {\
+ fprintf(stderr, "%s:%d: failed test: %s\n", __FILE__, __LINE__, #check);\
+ return 1;\
+ }\
+} while (0)
+
+int
+main(int argc, char** argv)
+{
+ if (argc != 2) {
+ fprintf(stderr, "USAGE: %s BUNDLE\n", argv[0]);
+ return 1;
+ }
+
+ const char* bundle_path = argv[1];
+ LilvWorld* world = lilv_world_new();
+
+ // Load test plugin bundle
+ uint8_t* abs_bundle = (uint8_t*)lilv_path_absolute(bundle_path);
+ SerdNode bundle = serd_node_new_file_uri(abs_bundle, 0, 0, true);
+ LilvNode* bundle_uri = lilv_new_uri(world, (const char*)bundle.buf);
+ lilv_world_load_bundle(world, bundle_uri);
+ free(abs_bundle);
+ serd_node_free(&bundle);
+
+ LilvNode* plugin_uri = lilv_new_uri(world, PLUGIN_URI);
+ const LilvPlugins* plugins = lilv_world_get_all_plugins(world);
+ const LilvPlugin* plugin = lilv_plugins_get_by_uri(plugins, plugin_uri);
+ TEST_ASSERT(plugin);
+
+ LilvInstance* instance = lilv_plugin_instantiate(plugin, 48000.0, NULL);
+ TEST_ASSERT(!instance);
+
+ lilv_world_free(world);
+
+ return 0;
+}
+
diff --git a/test/lib_descriptor.lv2/lib_descriptor.c b/test/lib_descriptor.lv2/lib_descriptor.c
new file mode 100644
index 0000000..48dc775
--- /dev/null
+++ b/test/lib_descriptor.lv2/lib_descriptor.c
@@ -0,0 +1,112 @@
+/*
+ Lilv Test Plugin - Missing descriptor
+ Copyright 2011-2015 David Robillard <d@drobilla.net>
+
+ Permission to use, copy, modify, and/or distribute this software for any
+ purpose with or without fee is hereby granted, provided that the above
+ copyright notice and this permission notice appear in all copies.
+
+ THIS SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+*/
+
+#include <stdlib.h>
+
+#include "lv2/lv2plug.in/ns/lv2core/lv2.h"
+
+#define PLUGIN_URI "http://example.org/lib-descriptor"
+
+enum {
+ TEST_INPUT = 0,
+ TEST_OUTPUT = 1
+};
+
+typedef struct {
+ float* input;
+ float* output;
+} Test;
+
+static void
+cleanup(LV2_Handle instance)
+{
+ free((Test*)instance);
+}
+
+static void
+connect_port(LV2_Handle instance, uint32_t port, void* data)
+{
+ Test* test = (Test*)instance;
+ switch (port) {
+ case TEST_INPUT:
+ test->input = (float*)data;
+ break;
+ case TEST_OUTPUT:
+ test->output = (float*)data;
+ break;
+ default:
+ break;
+ }
+}
+
+static LV2_Handle
+instantiate(const LV2_Descriptor* descriptor,
+ double rate,
+ const char* path,
+ const LV2_Feature* const* features)
+{
+ Test* test = (Test*)calloc(1, sizeof(Test));
+ if (!test) {
+ return NULL;
+ }
+
+ return (LV2_Handle)test;
+}
+
+static void
+run(LV2_Handle instance, uint32_t sample_count)
+{
+ Test* test = (Test*)instance;
+
+ *test->output = *test->input;
+}
+
+static const LV2_Descriptor descriptor = {
+ PLUGIN_URI,
+ instantiate,
+ connect_port,
+ NULL, // activate,
+ run,
+ NULL, // deactivate,
+ cleanup,
+ NULL // extension_data
+};
+
+static const LV2_Descriptor*
+get_plugin(LV2_Lib_Handle handle, uint32_t index)
+{
+ switch (index) {
+ case 0:
+ return &descriptor;
+ default:
+ return NULL;
+ }
+}
+
+static const LV2_Lib_Descriptor lib = {
+ NULL,
+ sizeof(LV2_Lib_Descriptor),
+ NULL,
+ get_plugin };
+
+LV2_SYMBOL_EXPORT
+const LV2_Lib_Descriptor*
+lv2_lib_descriptor(const char* bundle_path,
+ const LV2_Feature*const* features)
+{
+ return &lib;
+}
diff --git a/test/lib_descriptor.lv2/lib_descriptor.ttl.in b/test/lib_descriptor.lv2/lib_descriptor.ttl.in
new file mode 100644
index 0000000..19c8c4a
--- /dev/null
+++ b/test/lib_descriptor.lv2/lib_descriptor.ttl.in
@@ -0,0 +1,41 @@
+# Lilv Test Plugin - Missing descriptor
+# Copyright 2011-2015 David Robillard <d@drobilla.net>
+#
+# Permission to use, copy, modify, and/or distribute this software for any
+# purpose with or without fee is hereby granted, provided that the above
+# copyright notice and this permission notice appear in all copies.
+#
+# THIS SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+@prefix doap: <http://usefulinc.com/ns/doap#> .
+@prefix foaf: <http://xmlns.com/foaf/0.1/> .
+@prefix lv2: <http://lv2plug.in/ns/lv2core#> .
+@prefix ui: <http://lv2plug.in/ns/extensions/ui#> .
+@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
+
+<http://example.org/lib-descriptor>
+ a lv2:Plugin ;
+ doap:name "Missing descriptor test" ;
+ doap:license <http://opensource.org/licenses/isc> ;
+ lv2:optionalFeature lv2:hardRTCapable ;
+ <http://example.org/blob> "aGVsbG8sIHdvcmxk"^^xsd:base64Binary ;
+ <http://example.org/junk> "opaque"^^<http://example.org/binary> ;
+ lv2:port [
+ a lv2:InputPort ,
+ lv2:ControlPort ;
+ lv2:index 0 ;
+ lv2:symbol "input" ;
+ lv2:name "Input"
+ ] , [
+ a lv2:OutputPort ,
+ lv2:ControlPort ;
+ lv2:index 1 ;
+ lv2:symbol "output" ;
+ lv2:name "Output"
+ ] .
diff --git a/test/lib_descriptor.lv2/manifest.ttl.in b/test/lib_descriptor.lv2/manifest.ttl.in
new file mode 100644
index 0000000..5f4eced
--- /dev/null
+++ b/test/lib_descriptor.lv2/manifest.ttl.in
@@ -0,0 +1,7 @@
+@prefix lv2: <http://lv2plug.in/ns/lv2core#> .
+@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
+
+<http://example.org/lib-descriptor>
+ a lv2:Plugin ;
+ lv2:binary <lib_descriptor@SHLIB_EXT@> ;
+ rdfs:seeAlso <lib_descriptor.ttl> .
diff --git a/test/lib_descriptor.lv2/test_lib_descriptor.c b/test/lib_descriptor.lv2/test_lib_descriptor.c
new file mode 100644
index 0000000..3409ef2
--- /dev/null
+++ b/test/lib_descriptor.lv2/test_lib_descriptor.c
@@ -0,0 +1,52 @@
+#include "lilv/lilv.h"
+#include "../src/lilv_internal.h"
+
+#define PLUGIN_URI "http://example.org/lib-descriptor"
+
+#define TEST_ASSERT(check) do {\
+ if (!(check)) {\
+ fprintf(stderr, "%s:%d: failed test: %s\n", __FILE__, __LINE__, #check);\
+ return 1;\
+ }\
+} while (0)
+
+int
+main(int argc, char** argv)
+{
+ if (argc != 2) {
+ fprintf(stderr, "USAGE: %s BUNDLE\n", argv[0]);
+ return 1;
+ }
+
+ const char* bundle_path = argv[1];
+ LilvWorld* world = lilv_world_new();
+
+ // Load test plugin bundle
+ uint8_t* abs_bundle = (uint8_t*)lilv_path_absolute(bundle_path);
+ SerdNode bundle = serd_node_new_file_uri(abs_bundle, 0, 0, true);
+ LilvNode* bundle_uri = lilv_new_uri(world, (const char*)bundle.buf);
+ lilv_world_load_bundle(world, bundle_uri);
+ free(abs_bundle);
+ serd_node_free(&bundle);
+
+ LilvNode* plugin_uri = lilv_new_uri(world, PLUGIN_URI);
+ const LilvPlugins* plugins = lilv_world_get_all_plugins(world);
+ const LilvPlugin* plugin = lilv_plugins_get_by_uri(plugins, plugin_uri);
+ TEST_ASSERT(plugin);
+
+ LilvInstance* instance = lilv_plugin_instantiate(plugin, 48000.0, NULL);
+ TEST_ASSERT(instance);
+
+ LilvNode* eg_blob = lilv_new_uri(world, "http://example.org/blob");
+ LilvNode* blob = lilv_world_get(world, plugin_uri, eg_blob, NULL);
+ TEST_ASSERT(lilv_node_is_literal(blob));
+
+ LilvNode* eg_junk = lilv_new_uri(world, "http://example.org/junk");
+ LilvNode* junk = lilv_world_get(world, plugin_uri, eg_junk, NULL);
+ TEST_ASSERT(lilv_node_is_literal(junk));
+
+ lilv_world_free(world);
+
+ return 0;
+}
+
diff --git a/test/lilv_test.c b/test/lilv_test.c
index e89239c..3e2a23a 100644
--- a/test/lilv_test.c
+++ b/test/lilv_test.c
@@ -1,5 +1,5 @@
/*
- Copyright 2007-2014 David Robillard <http://drobilla.net>
+ Copyright 2007-2015 David Robillard <http://drobilla.net>
Copyright 2008 Krzysztof Foltman
Permission to use, copy, modify, and/or distribute this software for any
@@ -241,6 +241,7 @@ test_value(void)
TEST_ASSERT(lilv_node_is_int(ival));
TEST_ASSERT(lilv_node_is_float(fval));
+ TEST_ASSERT(!lilv_node_is_literal(NULL));
TEST_ASSERT(!lilv_node_is_literal(uval));
TEST_ASSERT(lilv_node_is_literal(sval));
TEST_ASSERT(lilv_node_is_literal(ival));
@@ -605,6 +606,9 @@ test_plugin(void)
TEST_ASSERT(lilv_nodes_contains(data_uris, data_uri_val));
lilv_node_free(data_uri_val);
+ LilvNode* unknown_uri_val = lilv_new_uri(world, "http://example.org/unknown");
+ TEST_ASSERT(!lilv_nodes_contains(data_uris, unknown_uri_val));
+
free(manifest_uri);
free(data_uri);
@@ -645,6 +649,7 @@ test_plugin(void)
TEST_ASSERT(latency_port);
TEST_ASSERT(lilv_port_get_index(plug, latency_port) == 2);
+ TEST_ASSERT(lilv_node_is_blank(lilv_port_get_node(plug, latency_port)));
LilvNode* rt_feature = lilv_new_uri(world,
"http://lv2plug.in/ns/lv2core#hardRTCapable");
@@ -1060,6 +1065,12 @@ test_port(void)
TEST_ASSERT(p3 == NULL);
lilv_node_free(nopsym);
+ // Try getting an invalid property
+ LilvNode* num = lilv_new_int(world, 1);
+ LilvNodes* nothing = lilv_port_get_value(plug, p, num);
+ TEST_ASSERT(!nothing);
+ lilv_node_free(num);
+
LilvNode* audio_class = lilv_new_uri(world,
"http://lv2plug.in/ns/lv2core#AudioPort");
LilvNode* control_class = lilv_new_uri(world,
@@ -1116,6 +1127,12 @@ test_port(void)
TEST_ASSERT(!strcmp(lilv_node_as_string(name), "store"));
lilv_node_free(name);
+ // Invalid language
+ setenv("LANG", "1!", 1);
+ name = lilv_port_get_name(plug, p);
+ TEST_ASSERT(!strcmp(lilv_node_as_string(name), "store"));
+ lilv_node_free(name);
+
setenv("LANG", "en_CA.utf-8", 1);
// Language tagged value with no untranslated values
@@ -1347,11 +1364,15 @@ test_ui(void)
LilvNode* ui_class_uri = lilv_new_uri(world,
"http://lv2plug.in/ns/extensions/ui#GtkUI");
+ LilvNode* unknown_ui_class_uri = lilv_new_uri(world,
+ "http://example.org/mysteryUI");
+
TEST_ASSERT(lilv_node_equals(lilv_nodes_get_first(classes), ui_class_uri));
TEST_ASSERT(lilv_ui_is_a(ui0, ui_class_uri));
const LilvNode* ui_type = NULL;
TEST_ASSERT(lilv_ui_is_supported(ui0, ui_supported, ui_class_uri, &ui_type));
+ TEST_ASSERT(!lilv_ui_is_supported(ui0, ui_supported, unknown_ui_class_uri, &ui_type));
TEST_ASSERT(lilv_node_equals(ui_type, ui_class_uri));
const LilvNode* plug_bundle_uri = lilv_plugin_get_bundle_uri(plug);
@@ -1647,6 +1668,15 @@ test_state(void)
lilv_instance_connect_port(instance, 1, &out);
lilv_instance_run(instance, 1);
+ // Test instantiating twice
+ LilvInstance* instance2 = lilv_plugin_instantiate(plugin, 48000.0, ffeatures);
+ if (!instance2) {
+ fatal_error("Failed to create multiple instances of <%s>\n",
+ lilv_node_as_uri(state_plugin_uri));
+ return 0;
+ }
+ lilv_instance_free(instance2);
+
// Get instance state state
LilvState* fstate = lilv_state_new_from_instance(
plugin, instance, &map,
@@ -1869,6 +1899,32 @@ test_string(void)
/*****************************************************************************/
+static int
+test_world(void)
+{
+ if (!init_world()) {
+ return 0;
+ }
+
+ LilvNode* num = lilv_new_int(world, 4);
+ LilvNode* uri = lilv_new_uri(world, "http://example.org/object");
+
+ LilvNodes* matches = lilv_world_find_nodes(world, num, NULL, NULL);
+ TEST_ASSERT(!matches);
+
+ matches = lilv_world_find_nodes(world, NULL, num, NULL);
+ TEST_ASSERT(!matches);
+
+ matches = lilv_world_find_nodes(world, NULL, uri, NULL);
+ TEST_ASSERT(!matches);
+
+ lilv_world_unload_bundle(world, NULL);
+
+ return 1;
+}
+
+/*****************************************************************************/
+
/* add tests here */
static struct TestCase tests[] = {
TEST_CASE(value),
@@ -1889,6 +1945,7 @@ static struct TestCase tests[] = {
TEST_CASE(bad_port_index),
TEST_CASE(bad_port_index),
TEST_CASE(string),
+ TEST_CASE(world),
TEST_CASE(state),
{ NULL, NULL }
};
diff --git a/test/missing_descriptor.lv2/manifest.ttl.in b/test/missing_descriptor.lv2/manifest.ttl.in
new file mode 100644
index 0000000..789d1ec
--- /dev/null
+++ b/test/missing_descriptor.lv2/manifest.ttl.in
@@ -0,0 +1,7 @@
+@prefix lv2: <http://lv2plug.in/ns/lv2core#> .
+@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
+
+<http://example.org/missing-descriptor>
+ a lv2:Plugin ;
+ lv2:binary <missing_descriptor@SHLIB_EXT@> ;
+ rdfs:seeAlso <missing_descriptor.ttl> .
diff --git a/test/missing_descriptor.lv2/missing_descriptor.c b/test/missing_descriptor.lv2/missing_descriptor.c
new file mode 100644
index 0000000..0aa2050
--- /dev/null
+++ b/test/missing_descriptor.lv2/missing_descriptor.c
@@ -0,0 +1,20 @@
+/*
+ Lilv Test Plugin - Missing descriptor
+ Copyright 2011-2015 David Robillard <d@drobilla.net>
+
+ Permission to use, copy, modify, and/or distribute this software for any
+ purpose with or without fee is hereby granted, provided that the above
+ copyright notice and this permission notice appear in all copies.
+
+ THIS SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+*/
+
+#include "lv2/lv2plug.in/ns/lv2core/lv2.h"
+
+LV2_SYMBOL_EXPORT const char* msg = "this is not the thing you're looking for";
diff --git a/test/missing_descriptor.lv2/missing_descriptor.ttl.in b/test/missing_descriptor.lv2/missing_descriptor.ttl.in
new file mode 100644
index 0000000..9e2aad8
--- /dev/null
+++ b/test/missing_descriptor.lv2/missing_descriptor.ttl.in
@@ -0,0 +1,38 @@
+# Lilv Test Plugin - Missing descriptor
+# Copyright 2011-2015 David Robillard <d@drobilla.net>
+#
+# Permission to use, copy, modify, and/or distribute this software for any
+# purpose with or without fee is hereby granted, provided that the above
+# copyright notice and this permission notice appear in all copies.
+#
+# THIS SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+@prefix doap: <http://usefulinc.com/ns/doap#> .
+@prefix foaf: <http://xmlns.com/foaf/0.1/> .
+@prefix lv2: <http://lv2plug.in/ns/lv2core#> .
+@prefix ui: <http://lv2plug.in/ns/extensions/ui#> .
+
+<http://example.org/missing-descriptor>
+ a lv2:Plugin ;
+ doap:name "Missing descriptor test" ;
+ doap:license <http://opensource.org/licenses/isc> ;
+ lv2:optionalFeature lv2:hardRTCapable ;
+ lv2:port [
+ a lv2:InputPort ,
+ lv2:ControlPort ;
+ lv2:index 0 ;
+ lv2:symbol "input" ;
+ lv2:name "Input"
+ ] , [
+ a lv2:OutputPort ,
+ lv2:ControlPort ;
+ lv2:index 1 ;
+ lv2:symbol "output" ;
+ lv2:name "Output"
+ ] .
diff --git a/test/missing_descriptor.lv2/test_missing_descriptor.c b/test/missing_descriptor.lv2/test_missing_descriptor.c
new file mode 100644
index 0000000..e0af49e
--- /dev/null
+++ b/test/missing_descriptor.lv2/test_missing_descriptor.c
@@ -0,0 +1,44 @@
+#include "lilv/lilv.h"
+#include "../src/lilv_internal.h"
+
+#define PLUGIN_URI "http://example.org/missing-descriptor"
+
+#define TEST_ASSERT(check) do {\
+ if (!(check)) {\
+ fprintf(stderr, "%s:%d: failed test: %s\n", __FILE__, __LINE__, #check);\
+ return 1;\
+ }\
+} while (0)
+
+int
+main(int argc, char** argv)
+{
+ if (argc != 2) {
+ fprintf(stderr, "USAGE: %s BUNDLE\n", argv[0]);
+ return 1;
+ }
+
+ const char* bundle_path = argv[1];
+ LilvWorld* world = lilv_world_new();
+
+ // Load test plugin bundle
+ uint8_t* abs_bundle = (uint8_t*)lilv_path_absolute(bundle_path);
+ SerdNode bundle = serd_node_new_file_uri(abs_bundle, 0, 0, true);
+ LilvNode* bundle_uri = lilv_new_uri(world, (const char*)bundle.buf);
+ lilv_world_load_bundle(world, bundle_uri);
+ free(abs_bundle);
+ serd_node_free(&bundle);
+
+ LilvNode* plugin_uri = lilv_new_uri(world, PLUGIN_URI);
+ const LilvPlugins* plugins = lilv_world_get_all_plugins(world);
+ const LilvPlugin* plugin = lilv_plugins_get_by_uri(plugins, plugin_uri);
+ TEST_ASSERT(plugin);
+
+ LilvInstance* instance = lilv_plugin_instantiate(plugin, 48000.0, NULL);
+ TEST_ASSERT(!instance);
+
+ lilv_world_free(world);
+
+ return 0;
+}
+
diff --git a/test/missing_name.lv2/manifest.ttl.in b/test/missing_name.lv2/manifest.ttl.in
new file mode 100644
index 0000000..62f4813
--- /dev/null
+++ b/test/missing_name.lv2/manifest.ttl.in
@@ -0,0 +1,7 @@
+@prefix lv2: <http://lv2plug.in/ns/lv2core#> .
+@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
+
+<http://example.org/missing-name>
+ a lv2:Plugin ;
+ lv2:binary <missing_name@SHLIB_EXT@> ;
+ rdfs:seeAlso <missing_name.ttl> .
diff --git a/test/missing_name.lv2/missing_name.c b/test/missing_name.lv2/missing_name.c
new file mode 100644
index 0000000..8a198b9
--- /dev/null
+++ b/test/missing_name.lv2/missing_name.c
@@ -0,0 +1,93 @@
+/*
+ Lilv Test Plugin - Missing descriptor
+ Copyright 2011-2015 David Robillard <d@drobilla.net>
+
+ Permission to use, copy, modify, and/or distribute this software for any
+ purpose with or without fee is hereby granted, provided that the above
+ copyright notice and this permission notice appear in all copies.
+
+ THIS SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+*/
+
+#include <stdlib.h>
+
+#include "lv2/lv2plug.in/ns/lv2core/lv2.h"
+
+#define PLUGIN_URI "http://example.org/missing-name"
+
+enum {
+ TEST_INPUT = 0,
+ TEST_OUTPUT = 1
+};
+
+typedef struct {
+ float* input;
+ float* output;
+} Test;
+
+static void
+cleanup(LV2_Handle instance)
+{
+ free((Test*)instance);
+}
+
+static void
+connect_port(LV2_Handle instance, uint32_t port, void* data)
+{
+ Test* test = (Test*)instance;
+ switch (port) {
+ case TEST_INPUT:
+ test->input = (float*)data;
+ break;
+ case TEST_OUTPUT:
+ test->output = (float*)data;
+ break;
+ default:
+ break;
+ }
+}
+
+static LV2_Handle
+instantiate(const LV2_Descriptor* descriptor,
+ double rate,
+ const char* path,
+ const LV2_Feature* const* features)
+{
+ Test* test = (Test*)calloc(1, sizeof(Test));
+ if (!test) {
+ return NULL;
+ }
+
+ return (LV2_Handle)test;
+}
+
+static void
+run(LV2_Handle instance, uint32_t sample_count)
+{
+ Test* test = (Test*)instance;
+
+ *test->output = *test->input;
+}
+
+static const LV2_Descriptor descriptor = {
+ PLUGIN_URI,
+ instantiate,
+ connect_port,
+ NULL, // activate,
+ run,
+ NULL, // deactivate,
+ cleanup,
+ NULL // extension_data
+};
+
+LV2_SYMBOL_EXPORT
+const LV2_Descriptor* lv2_descriptor(uint32_t index)
+{
+ return (index == 0) ? &descriptor : NULL;
+}
diff --git a/test/missing_name.lv2/missing_name.ttl.in b/test/missing_name.lv2/missing_name.ttl.in
new file mode 100644
index 0000000..68ce23e
--- /dev/null
+++ b/test/missing_name.lv2/missing_name.ttl.in
@@ -0,0 +1,37 @@
+# Lilv Test Plugin - Missing plugin name
+# Copyright 2011-2015 David Robillard <d@drobilla.net>
+#
+# Permission to use, copy, modify, and/or distribute this software for any
+# purpose with or without fee is hereby granted, provided that the above
+# copyright notice and this permission notice appear in all copies.
+#
+# THIS SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+@prefix doap: <http://usefulinc.com/ns/doap#> .
+@prefix foaf: <http://xmlns.com/foaf/0.1/> .
+@prefix lv2: <http://lv2plug.in/ns/lv2core#> .
+@prefix ui: <http://lv2plug.in/ns/extensions/ui#> .
+
+<http://example.org/missing-name>
+ a lv2:Plugin ;
+ doap:license <http://opensource.org/licenses/isc> ;
+ lv2:optionalFeature lv2:hardRTCapable ;
+ lv2:port [
+ a lv2:InputPort ,
+ lv2:ControlPort ;
+ lv2:index 0 ;
+ lv2:symbol "input" ;
+ lv2:name "Input"
+ ] , [
+ a lv2:OutputPort ,
+ lv2:ControlPort ;
+ lv2:index 1 ;
+ lv2:symbol "output" ;
+ lv2:name "Output"
+ ] .
diff --git a/test/missing_name.lv2/test_missing_name.c b/test/missing_name.lv2/test_missing_name.c
new file mode 100644
index 0000000..9237ae2
--- /dev/null
+++ b/test/missing_name.lv2/test_missing_name.c
@@ -0,0 +1,44 @@
+#include "lilv/lilv.h"
+#include "../src/lilv_internal.h"
+
+#define PLUGIN_URI "http://example.org/missing-name"
+
+#define TEST_ASSERT(check) do {\
+ if (!(check)) {\
+ fprintf(stderr, "%s:%d: failed test: %s\n", __FILE__, __LINE__, #check);\
+ return 1;\
+ }\
+} while (0)
+
+int
+main(int argc, char** argv)
+{
+ if (argc != 2) {
+ fprintf(stderr, "USAGE: %s BUNDLE\n", argv[0]);
+ return 1;
+ }
+
+ const char* bundle_path = argv[1];
+ LilvWorld* world = lilv_world_new();
+
+ // Load test plugin bundle
+ uint8_t* abs_bundle = (uint8_t*)lilv_path_absolute(bundle_path);
+ SerdNode bundle = serd_node_new_file_uri(abs_bundle, 0, 0, true);
+ LilvNode* bundle_uri = lilv_new_uri(world, (const char*)bundle.buf);
+ lilv_world_load_bundle(world, bundle_uri);
+ free(abs_bundle);
+ serd_node_free(&bundle);
+
+ LilvNode* plugin_uri = lilv_new_uri(world, PLUGIN_URI);
+ const LilvPlugins* plugins = lilv_world_get_all_plugins(world);
+ const LilvPlugin* plugin = lilv_plugins_get_by_uri(plugins, plugin_uri);
+ TEST_ASSERT(plugin);
+
+ LilvInstance* instance = lilv_plugin_instantiate(plugin, 48000.0, NULL);
+ TEST_ASSERT(instance);
+
+ lilv_world_free(world);
+
+ return 0;
+}
+
diff --git a/test/missing_plugin.lv2/manifest.ttl.in b/test/missing_plugin.lv2/manifest.ttl.in
new file mode 100644
index 0000000..d969cec
--- /dev/null
+++ b/test/missing_plugin.lv2/manifest.ttl.in
@@ -0,0 +1,7 @@
+@prefix lv2: <http://lv2plug.in/ns/lv2core#> .
+@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
+
+<http://example.org/missing-plugin>
+ a lv2:Plugin ;
+ lv2:binary <missing_plugin@SHLIB_EXT@> ;
+ rdfs:seeAlso <missing_plugin.ttl> .
diff --git a/test/missing_plugin.lv2/missing_plugin.c b/test/missing_plugin.lv2/missing_plugin.c
new file mode 100644
index 0000000..577d42a
--- /dev/null
+++ b/test/missing_plugin.lv2/missing_plugin.c
@@ -0,0 +1,28 @@
+/*
+ Lilv Test Plugin - Missing plugin
+ Copyright 2011-2015 David Robillard <d@drobilla.net>
+
+ Permission to use, copy, modify, and/or distribute this software for any
+ purpose with or without fee is hereby granted, provided that the above
+ copyright notice and this permission notice appear in all copies.
+
+ THIS SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+*/
+
+#include <stdlib.h>
+
+#include "lv2/lv2plug.in/ns/lv2core/lv2.h"
+
+#define PLUGIN_URI "http://example.org/missing-plugin"
+
+LV2_SYMBOL_EXPORT
+const LV2_Descriptor* lv2_descriptor(uint32_t index)
+{
+ return NULL;
+}
diff --git a/test/missing_plugin.lv2/missing_plugin.ttl.in b/test/missing_plugin.lv2/missing_plugin.ttl.in
new file mode 100644
index 0000000..ed8a7f3
--- /dev/null
+++ b/test/missing_plugin.lv2/missing_plugin.ttl.in
@@ -0,0 +1,38 @@
+# Lilv Test Plugin - Missing plugin
+# Copyright 2011-2015 David Robillard <d@drobilla.net>
+#
+# Permission to use, copy, modify, and/or distribute this software for any
+# purpose with or without fee is hereby granted, provided that the above
+# copyright notice and this permission notice appear in all copies.
+#
+# THIS SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+@prefix doap: <http://usefulinc.com/ns/doap#> .
+@prefix foaf: <http://xmlns.com/foaf/0.1/> .
+@prefix lv2: <http://lv2plug.in/ns/lv2core#> .
+@prefix ui: <http://lv2plug.in/ns/extensions/ui#> .
+
+<http://example.org/missing-plugin>
+ a lv2:Plugin ;
+ doap:name "Missing descriptor test" ;
+ doap:license <http://opensource.org/licenses/isc> ;
+ lv2:optionalFeature lv2:hardRTCapable ;
+ lv2:port [
+ a lv2:InputPort ,
+ lv2:ControlPort ;
+ lv2:index 0 ;
+ lv2:symbol "input" ;
+ lv2:name "Input"
+ ] , [
+ a lv2:OutputPort ,
+ lv2:ControlPort ;
+ lv2:index 1 ;
+ lv2:symbol "output" ;
+ lv2:name "Output"
+ ] .
diff --git a/test/missing_plugin.lv2/test_missing_plugin.c b/test/missing_plugin.lv2/test_missing_plugin.c
new file mode 100644
index 0000000..01f00cd
--- /dev/null
+++ b/test/missing_plugin.lv2/test_missing_plugin.c
@@ -0,0 +1,44 @@
+#include "lilv/lilv.h"
+#include "../src/lilv_internal.h"
+
+#define PLUGIN_URI "http://example.org/missing-plugin"
+
+#define TEST_ASSERT(check) do {\
+ if (!(check)) {\
+ fprintf(stderr, "%s:%d: failed test: %s\n", __FILE__, __LINE__, #check);\
+ return 1;\
+ }\
+} while (0)
+
+int
+main(int argc, char** argv)
+{
+ if (argc != 2) {
+ fprintf(stderr, "USAGE: %s BUNDLE\n", argv[0]);
+ return 1;
+ }
+
+ const char* bundle_path = argv[1];
+ LilvWorld* world = lilv_world_new();
+
+ // Load test plugin bundle
+ uint8_t* abs_bundle = (uint8_t*)lilv_path_absolute(bundle_path);
+ SerdNode bundle = serd_node_new_file_uri(abs_bundle, 0, 0, true);
+ LilvNode* bundle_uri = lilv_new_uri(world, (const char*)bundle.buf);
+ lilv_world_load_bundle(world, bundle_uri);
+ free(abs_bundle);
+ serd_node_free(&bundle);
+
+ LilvNode* plugin_uri = lilv_new_uri(world, PLUGIN_URI);
+ const LilvPlugins* plugins = lilv_world_get_all_plugins(world);
+ const LilvPlugin* plugin = lilv_plugins_get_by_uri(plugins, plugin_uri);
+ TEST_ASSERT(plugin);
+
+ LilvInstance* instance = lilv_plugin_instantiate(plugin, 48000.0, NULL);
+ TEST_ASSERT(!instance);
+
+ lilv_world_free(world);
+
+ return 0;
+}
+
diff --git a/test/missing_port_name.lv2/manifest.ttl.in b/test/missing_port_name.lv2/manifest.ttl.in
new file mode 100644
index 0000000..d6a4e39
--- /dev/null
+++ b/test/missing_port_name.lv2/manifest.ttl.in
@@ -0,0 +1,7 @@
+@prefix lv2: <http://lv2plug.in/ns/lv2core#> .
+@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
+
+<http://example.org/missing-port-name>
+ a lv2:Plugin ;
+ lv2:binary <missing_port_name@SHLIB_EXT@> ;
+ rdfs:seeAlso <missing_port_name.ttl> .
diff --git a/test/missing_port_name.lv2/missing_port_name.c b/test/missing_port_name.lv2/missing_port_name.c
new file mode 100644
index 0000000..4ed44ed
--- /dev/null
+++ b/test/missing_port_name.lv2/missing_port_name.c
@@ -0,0 +1,93 @@
+/*
+ Lilv Test Plugin - Missing port name
+ Copyright 2011-2015 David Robillard <d@drobilla.net>
+
+ Permission to use, copy, modify, and/or distribute this software for any
+ purpose with or without fee is hereby granted, provided that the above
+ copyright notice and this permission notice appear in all copies.
+
+ THIS SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+*/
+
+#include <stdlib.h>
+
+#include "lv2/lv2plug.in/ns/lv2core/lv2.h"
+
+#define PLUGIN_URI "http://example.org/missing-port-name"
+
+enum {
+ TEST_INPUT = 0,
+ TEST_OUTPUT = 1
+};
+
+typedef struct {
+ float* input;
+ float* output;
+} Test;
+
+static void
+cleanup(LV2_Handle instance)
+{
+ free((Test*)instance);
+}
+
+static void
+connect_port(LV2_Handle instance, uint32_t port, void* data)
+{
+ Test* test = (Test*)instance;
+ switch (port) {
+ case TEST_INPUT:
+ test->input = (float*)data;
+ break;
+ case TEST_OUTPUT:
+ test->output = (float*)data;
+ break;
+ default:
+ break;
+ }
+}
+
+static LV2_Handle
+instantiate(const LV2_Descriptor* descriptor,
+ double rate,
+ const char* path,
+ const LV2_Feature* const* features)
+{
+ Test* test = (Test*)calloc(1, sizeof(Test));
+ if (!test) {
+ return NULL;
+ }
+
+ return (LV2_Handle)test;
+}
+
+static void
+run(LV2_Handle instance, uint32_t sample_count)
+{
+ Test* test = (Test*)instance;
+
+ *test->output = *test->input;
+}
+
+static const LV2_Descriptor descriptor = {
+ PLUGIN_URI,
+ instantiate,
+ connect_port,
+ NULL, // activate,
+ run,
+ NULL, // deactivate,
+ cleanup,
+ NULL // extension_data
+};
+
+LV2_SYMBOL_EXPORT
+const LV2_Descriptor* lv2_descriptor(uint32_t index)
+{
+ return (index == 0) ? &descriptor : NULL;
+}
diff --git a/test/missing_port_name.lv2/missing_port_name.ttl.in b/test/missing_port_name.lv2/missing_port_name.ttl.in
new file mode 100644
index 0000000..5a58a80
--- /dev/null
+++ b/test/missing_port_name.lv2/missing_port_name.ttl.in
@@ -0,0 +1,30 @@
+# Lilv Test Plugin - Missing port name
+# Copyright 2011-2015 David Robillard <d@drobilla.net>
+#
+# Permission to use, copy, modify, and/or distribute this software for any
+# purpose with or without fee is hereby granted, provided that the above
+# copyright notice and this permission notice appear in all copies.
+#
+# THIS SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+@prefix doap: <http://usefulinc.com/ns/doap#> .
+@prefix foaf: <http://xmlns.com/foaf/0.1/> .
+@prefix lv2: <http://lv2plug.in/ns/lv2core#> .
+@prefix ui: <http://lv2plug.in/ns/extensions/ui#> .
+
+<http://example.org/missing-port-name>
+ a lv2:Plugin ;
+ doap:license <http://opensource.org/licenses/isc> ;
+ lv2:optionalFeature lv2:hardRTCapable ;
+ lv2:port [
+ a lv2:InputPort ,
+ lv2:ControlPort ;
+ lv2:index 0 ;
+ lv2:symbol "input" ;
+ ] . \ No newline at end of file
diff --git a/test/missing_port_name.lv2/test_missing_port_name.c b/test/missing_port_name.lv2/test_missing_port_name.c
new file mode 100644
index 0000000..0f96918
--- /dev/null
+++ b/test/missing_port_name.lv2/test_missing_port_name.c
@@ -0,0 +1,46 @@
+#include "lilv/lilv.h"
+#include "../src/lilv_internal.h"
+
+#define PLUGIN_URI "http://example.org/missing-port-name"
+
+#define TEST_ASSERT(check) do {\
+ if (!(check)) {\
+ fprintf(stderr, "%s:%d: failed test: %s\n", __FILE__, __LINE__, #check);\
+ return 1;\
+ }\
+} while (0)
+
+int
+main(int argc, char** argv)
+{
+ if (argc != 2) {
+ fprintf(stderr, "USAGE: %s BUNDLE\n", argv[0]);
+ return 1;
+ }
+
+ const char* bundle_path = argv[1];
+ LilvWorld* world = lilv_world_new();
+
+ // Load test plugin bundle
+ uint8_t* abs_bundle = (uint8_t*)lilv_path_absolute(bundle_path);
+ SerdNode bundle = serd_node_new_file_uri(abs_bundle, 0, 0, true);
+ LilvNode* bundle_uri = lilv_new_uri(world, (const char*)bundle.buf);
+ lilv_world_load_bundle(world, bundle_uri);
+ free(abs_bundle);
+ serd_node_free(&bundle);
+
+ LilvNode* plugin_uri = lilv_new_uri(world, PLUGIN_URI);
+ const LilvPlugins* plugins = lilv_world_get_all_plugins(world);
+ const LilvPlugin* plugin = lilv_plugins_get_by_uri(plugins, plugin_uri);
+ TEST_ASSERT(plugin);
+
+ const LilvPort* port = lilv_plugin_get_port_by_index(plugin, 0);
+ TEST_ASSERT(port);
+ LilvNode* name = lilv_port_get_name(plugin, port);
+ TEST_ASSERT(!name);
+
+ lilv_world_free(world);
+
+ return 0;
+}
+
diff --git a/test/manifest.ttl.in b/test/test.lv2/manifest.ttl.in
index 48b009b..bc3952c 100644
--- a/test/manifest.ttl.in
+++ b/test/test.lv2/manifest.ttl.in
@@ -3,5 +3,5 @@
<http://example.org/lilv-test-plugin>
a lv2:Plugin ;
- lv2:binary <test_plugin@SHLIB_EXT@> ;
- rdfs:seeAlso <test_plugin.ttl> .
+ lv2:binary <test@SHLIB_EXT@> ;
+ rdfs:seeAlso <test.ttl> .
diff --git a/test/test_plugin.c b/test/test.lv2/test.c
index edcc5ab..cd9a18c 100644
--- a/test/test_plugin.c
+++ b/test/test.lv2/test.c
@@ -1,6 +1,6 @@
/*
Lilv Test Plugin
- Copyright 2011-2012 David Robillard <d@drobilla.net>
+ Copyright 2011-2015 David Robillard <d@drobilla.net>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
diff --git a/test/test_plugin.ttl.in b/test/test.lv2/test.ttl.in
index 704f815..6fb6aed 100644
--- a/test/test_plugin.ttl.in
+++ b/test/test.lv2/test.ttl.in
@@ -1,5 +1,5 @@
# Lilv Test Plugin
-# Copyright 2011 David Robillard <d@drobilla.net>
+# Copyright 2011-2015 David Robillard <d@drobilla.net>
#
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is hereby granted, provided that the above