From 59b7cb60f0dcdd639ee4b130df9cbce3d7ebf04a Mon Sep 17 00:00:00 2001 From: David Robillard Date: Wed, 4 Jan 2012 21:03:42 +0000 Subject: Use platform specific shared library extension in test suite. git-svn-id: http://svn.drobilla.net/lad/trunk/lilv@3917 a436a847-0d15-0410-975c-d299462d15a1 --- test/lilv_test.c | 40 ++++++++++++++++++++++++---------------- test/manifest.ttl | 7 ------- test/manifest.ttl.in | 7 +++++++ test/test_plugin.ttl | 40 ---------------------------------------- test/test_plugin.ttl.in | 40 ++++++++++++++++++++++++++++++++++++++++ wscript | 11 +++++++---- 6 files changed, 78 insertions(+), 67 deletions(-) delete mode 100644 test/manifest.ttl create mode 100644 test/manifest.ttl.in delete mode 100644 test/test_plugin.ttl create mode 100644 test/test_plugin.ttl.in diff --git a/test/lilv_test.c b/test/lilv_test.c index 0a8a226..44596f0 100644 --- a/test/lilv_test.c +++ b/test/lilv_test.c @@ -34,6 +34,14 @@ #define TEST_PATH_MAX 1024 +#if defined(__APPLE__) +# define SHLIB_EXT ".dylib" +#elif defined(__WIN32__) +# define SHLIB_EXT ".dll" +#else +# define SHLIB_EXT ".so" +#endif + static char bundle_dir_name[TEST_PATH_MAX]; static char bundle_dir_uri[TEST_PATH_MAX]; static char manifest_name[TEST_PATH_MAX]; @@ -205,7 +213,7 @@ int test_value(void) { if (!start_bundle(MANIFEST_PREFIXES - ":plug a lv2:Plugin ; lv2:binary ; rdfs:seeAlso .\n", + ":plug a lv2:Plugin ; lv2:binary ; rdfs:seeAlso .\n", BUNDLE_PREFIXES ":plug a lv2:Plugin ; a lv2:CompressorPlugin ; " PLUGIN_NAME("Test plugin") " ; " @@ -324,7 +332,7 @@ discovery_verify_plugin(const LilvPlugin* plugin) TEST_ASSERT(lib_uri); TEST_ASSERT(lilv_node_is_uri(lib_uri)); TEST_ASSERT(lilv_node_as_uri(lib_uri)); - TEST_ASSERT(strstr(lilv_node_as_uri(lib_uri), "foo.so")); + TEST_ASSERT(strstr(lilv_node_as_uri(lib_uri), "foo" SHLIB_EXT)); TEST_ASSERT(lilv_plugin_verify(plugin)); } } @@ -333,7 +341,7 @@ int test_discovery(void) { if (!start_bundle(MANIFEST_PREFIXES - ":plug a lv2:Plugin ; lv2:binary ; rdfs:seeAlso .\n", + ":plug a lv2:Plugin ; lv2:binary ; rdfs:seeAlso .\n", BUNDLE_PREFIXES ":plug a lv2:Plugin ;" PLUGIN_NAME("Test plugin") " ; " @@ -376,7 +384,7 @@ int test_verify(void) { if (!start_bundle(MANIFEST_PREFIXES - ":plug a lv2:Plugin ; lv2:binary ; rdfs:seeAlso .\n", + ":plug a lv2:Plugin ; lv2:binary ; rdfs:seeAlso .\n", BUNDLE_PREFIXES ":plug a lv2:Plugin ; " PLUGIN_NAME("Test plugin") " ; " @@ -400,7 +408,7 @@ int test_no_verify(void) { if (!start_bundle(MANIFEST_PREFIXES - ":plug a lv2:Plugin ; lv2:binary ; rdfs:seeAlso .\n", + ":plug a lv2:Plugin ; lv2:binary ; rdfs:seeAlso .\n", BUNDLE_PREFIXES ":plug a lv2:Plugin . ")) return 0; @@ -420,7 +428,7 @@ int test_classes(void) { if (!start_bundle(MANIFEST_PREFIXES - ":plug a lv2:Plugin ; lv2:binary ; rdfs:seeAlso .\n", + ":plug a lv2:Plugin ; lv2:binary ; rdfs:seeAlso .\n", BUNDLE_PREFIXES ":plug a lv2:Plugin ; a lv2:CompressorPlugin ; " PLUGIN_NAME("Test plugin") " ; " @@ -464,7 +472,7 @@ int test_plugin(void) { if (!start_bundle(MANIFEST_PREFIXES - ":plug a lv2:Plugin ; lv2:binary ; rdfs:seeAlso .\n", + ":plug a lv2:Plugin ; lv2:binary ; rdfs:seeAlso .\n", BUNDLE_PREFIXES ":plug a lv2:Plugin ; a lv2:CompressorPlugin ; " PLUGIN_NAME("Test plugin") " ; " @@ -669,7 +677,7 @@ int test_port(void) { if (!start_bundle(MANIFEST_PREFIXES - ":plug a lv2:Plugin ; lv2:binary ; rdfs:seeAlso .\n", + ":plug a lv2:Plugin ; lv2:binary ; rdfs:seeAlso .\n", BUNDLE_PREFIXES PREFIX_LV2EV ":plug a lv2:Plugin ; " PLUGIN_NAME("Test plugin") " ; " @@ -904,7 +912,7 @@ int test_ui(void) { if (!start_bundle(MANIFEST_PREFIXES - ":plug a lv2:Plugin ; lv2:binary ; rdfs:seeAlso .\n", + ":plug a lv2:Plugin ; lv2:binary ; rdfs:seeAlso .\n", BUNDLE_PREFIXES PREFIX_LV2UI ":plug a lv2:Plugin ; a lv2:CompressorPlugin ; " PLUGIN_NAME("Test plugin") " ; " @@ -929,11 +937,11 @@ test_ui(void) "] .\n" ":ui a lv2ui:GtkUI ; " " lv2ui:requiredFeature lv2ui:makeResident ; " - " lv2ui:binary ; " + " lv2ui:binary ; " " lv2ui:optionalFeature lv2ui:ext_presets . " - ":ui2 a lv2ui:GtkUI ; lv2ui:binary . " - ":ui3 a lv2ui:GtkUI ; lv2ui:binary . " - ":ui4 a lv2ui:GtkUI ; lv2ui:binary . ")) + ":ui2 a lv2ui:GtkUI ; lv2ui:binary . " + ":ui3 a lv2ui:GtkUI ; lv2ui:binary . " + ":ui4 a lv2ui:GtkUI ; lv2ui:binary . ")) return 0; init_uris(); @@ -984,7 +992,7 @@ test_ui(void) char* ui_binary_uri_str = (char*)malloc(TEST_PATH_MAX); snprintf(ui_binary_uri_str, TEST_PATH_MAX, "%s%s", - lilv_node_as_string(plug_bundle_uri), "ui.so"); + lilv_node_as_string(plug_bundle_uri), "ui" SHLIB_EXT); const LilvNode* ui_binary_uri = lilv_ui_get_binary_uri(ui0); @@ -1196,7 +1204,7 @@ int test_bad_port_symbol(void) { if (!start_bundle(MANIFEST_PREFIXES - ":plug a lv2:Plugin ; lv2:binary ; rdfs:seeAlso .\n", + ":plug a lv2:Plugin ; lv2:binary ; rdfs:seeAlso .\n", BUNDLE_PREFIXES PREFIX_LV2EV ":plug a lv2:Plugin ; " PLUGIN_NAME("Test plugin") " ; " @@ -1227,7 +1235,7 @@ int test_bad_port_index(void) { if (!start_bundle(MANIFEST_PREFIXES - ":plug a lv2:Plugin ; lv2:binary ; rdfs:seeAlso .\n", + ":plug a lv2:Plugin ; lv2:binary ; rdfs:seeAlso .\n", BUNDLE_PREFIXES PREFIX_LV2EV ":plug a lv2:Plugin ; " PLUGIN_NAME("Test plugin") " ; " diff --git a/test/manifest.ttl b/test/manifest.ttl deleted file mode 100644 index 5af7e88..0000000 --- a/test/manifest.ttl +++ /dev/null @@ -1,7 +0,0 @@ -@prefix lv2: . -@prefix rdfs: . - - - a lv2:Plugin ; - lv2:binary ; - rdfs:seeAlso . diff --git a/test/manifest.ttl.in b/test/manifest.ttl.in new file mode 100644 index 0000000..48b009b --- /dev/null +++ b/test/manifest.ttl.in @@ -0,0 +1,7 @@ +@prefix lv2: . +@prefix rdfs: . + + + a lv2:Plugin ; + lv2:binary ; + rdfs:seeAlso . diff --git a/test/test_plugin.ttl b/test/test_plugin.ttl deleted file mode 100644 index ec16d00..0000000 --- a/test/test_plugin.ttl +++ /dev/null @@ -1,40 +0,0 @@ -# Lilv Test Plugin -# Copyright 2011 David Robillard -# -# 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: . -@prefix foaf: . -@prefix lv2: . -@prefix ui: . - - - a lv2:Plugin ; - doap:name "Lilv Test" ; - doap:license ; - lv2:requiredFeature ; - lv2:optionalFeature lv2:hardRtCapable ; - lv2:extensionData ; - 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/test_plugin.ttl.in b/test/test_plugin.ttl.in new file mode 100644 index 0000000..ec16d00 --- /dev/null +++ b/test/test_plugin.ttl.in @@ -0,0 +1,40 @@ +# Lilv Test Plugin +# Copyright 2011 David Robillard +# +# 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: . +@prefix foaf: . +@prefix lv2: . +@prefix ui: . + + + a lv2:Plugin ; + doap:name "Lilv Test" ; + doap:license ; + lv2:requiredFeature ; + lv2:optionalFeature lv2:hardRtCapable ; + lv2:extensionData ; + 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/wscript b/wscript index 3a047af..4d9de86 100644 --- a/wscript +++ b/wscript @@ -243,6 +243,8 @@ def build(bld): if shlib_pattern.startswith('lib'): shlib_pattern = shlib_pattern[3:] penv['cshlib_PATTERN'] = shlib_pattern + shlib_ext = shlib_pattern[shlib_pattern.rfind('.'):] + obj = bld(features = 'c cshlib', env = penv, source = 'test/test_plugin.c', @@ -252,11 +254,12 @@ def build(bld): uselib = 'LV2CORE LV2_STATE LV2_URID') # Test plugin data files - for i in [ 'manifest.ttl', 'test_plugin.ttl' ]: - bld(rule = 'cp ${SRC} ${TGT}', + for i in [ 'manifest.ttl.in', 'test_plugin.ttl.in' ]: + bld(features = 'subst', source = 'test/' + i, - target = 'test/test_plugin.lv2/' + i, - install_path = None) + target = 'test/test_plugin.lv2/' + i.replace('.in', ''), + install_path = None, + SHLIB_EXT = shlib_ext) # Static profiled library (for unit test code coverage) obj = bld(features = 'c cstlib', -- cgit v1.2.1