diff options
Diffstat (limited to 'test/lib_descriptor.lv2')
-rw-r--r-- | test/lib_descriptor.lv2/lib_descriptor.c | 27 | ||||
-rw-r--r-- | test/lib_descriptor.lv2/meson.build | 37 | ||||
-rw-r--r-- | test/lib_descriptor.lv2/test_lib_descriptor.c | 17 |
3 files changed, 46 insertions, 35 deletions
diff --git a/test/lib_descriptor.lv2/lib_descriptor.c b/test/lib_descriptor.lv2/lib_descriptor.c index ab27c2b..5a269ad 100644 --- a/test/lib_descriptor.lv2/lib_descriptor.c +++ b/test/lib_descriptor.lv2/lib_descriptor.c @@ -1,21 +1,7 @@ -/* - Lilv Test Plugin - Missing descriptor - Copyright 2011-2019 David Robillard <d@drobilla.net> +// Copyright 2011-2019 David Robillard <d@drobilla.net> +// SPDX-License-Identifier: ISC - 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/core/lv2.h" +#include <lv2/core/lv2.h> #include <stdint.h> #include <stdlib.h> @@ -96,12 +82,7 @@ get_plugin(LV2_Lib_Handle handle, uint32_t index) { (void)handle; - switch (index) { - case 0: - return &descriptor; - default: - return NULL; - } + return index ? NULL : &descriptor; } static const LV2_Lib_Descriptor lib = {NULL, diff --git a/test/lib_descriptor.lv2/meson.build b/test/lib_descriptor.lv2/meson.build new file mode 100644 index 0000000..217b907 --- /dev/null +++ b/test/lib_descriptor.lv2/meson.build @@ -0,0 +1,37 @@ +# Copyright 2021-2022 David Robillard <d@drobilla.net> +# SPDX-License-Identifier: 0BSD OR ISC + +module = shared_module( + 'lib_descriptor', + files('lib_descriptor.c'), + c_args: c_suppressions, + dependencies: lv2_dep, + gnu_symbol_visibility: 'hidden', + name_prefix: '', +) + +extension = '.' + module.full_path().split('.')[-1] +config = configuration_data({'SHLIB_EXT': extension}) +ttl_files = ['manifest.ttl', 'lib_descriptor.ttl'] + +foreach f : ttl_files + configure_file( + input: files(f + '.in'), + output: f, + configuration: config, + ) +endforeach + +test( + 'lib_descriptor', + executable( + 'test_lib_descriptor', + files('test_lib_descriptor.c'), + c_args: c_suppressions + test_args, + dependencies: [lv2_dep, lilv_dep], + implicit_include_directories: false, + ), + args: [meson.current_build_dir() / ''], + suite: 'plugin', +) + diff --git a/test/lib_descriptor.lv2/test_lib_descriptor.c b/test/lib_descriptor.lv2/test_lib_descriptor.c index bf79be8..29a51fd 100644 --- a/test/lib_descriptor.lv2/test_lib_descriptor.c +++ b/test/lib_descriptor.lv2/test_lib_descriptor.c @@ -1,15 +1,12 @@ -#undef NDEBUG +// Copyright 2015-2020 David Robillard <d@drobilla.net> +// SPDX-License-Identifier: ISC -#include "../src/filesystem.h" +#undef NDEBUG -#include "lilv/lilv.h" -#include "serd/serd.h" +#include <lilv/lilv.h> #include <assert.h> -#include <stdbool.h> -#include <stdint.h> #include <stdio.h> -#include <stdlib.h> #define PLUGIN_URI "http://example.org/lib-descriptor" @@ -25,12 +22,8 @@ main(int argc, char** argv) 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); + LilvNode* bundle_uri = lilv_new_file_uri(world, NULL, bundle_path); lilv_world_load_bundle(world, bundle_uri); - free(abs_bundle); - serd_node_free(&bundle); lilv_node_free(bundle_uri); LilvNode* plugin_uri = lilv_new_uri(world, PLUGIN_URI); |