summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/.clang-tidy38
-rw-r--r--test/bad_syntax.lv2/bad_syntax.c20
-rw-r--r--test/bad_syntax.lv2/meson.build37
-rw-r--r--test/bad_syntax.lv2/test_bad_syntax.c17
-rw-r--r--test/cpp/.clang-tidy21
-rw-r--r--test/cpp/meson.build37
-rw-r--r--test/cpp/test_lilv_hpp.cpp12
-rw-r--r--test/failed_instantiation.lv2/failed_instantiation.c27
-rw-r--r--test/failed_instantiation.lv2/meson.build37
-rw-r--r--test/failed_instantiation.lv2/test_failed_instantiation.c17
-rw-r--r--test/failed_lib_descriptor.lv2/failed_lib_descriptor.c20
-rw-r--r--test/failed_lib_descriptor.lv2/meson.build37
-rw-r--r--test/failed_lib_descriptor.lv2/test_failed_lib_descriptor.c19
-rw-r--r--test/headers/.clang-tidy15
-rw-r--r--test/headers/meson.build32
-rw-r--r--test/headers/test_headers.c13
-rw-r--r--test/lib_descriptor.lv2/lib_descriptor.c27
-rw-r--r--test/lib_descriptor.lv2/meson.build37
-rw-r--r--test/lib_descriptor.lv2/test_lib_descriptor.c17
-rw-r--r--test/lilv_cxx_test.cpp25
-rw-r--r--test/lilv_test_uri_map.h36
-rw-r--r--test/lilv_test_utils.c114
-rw-r--r--test/lilv_test_utils.h29
-rw-r--r--test/lint/meson.build38
-rw-r--r--test/lv2/core.lv2/lv2core.ttl (renamed from test/core.lv2/lv2core.ttl)0
-rw-r--r--test/lv2/core.lv2/manifest.ttl (renamed from test/core.lv2/manifest.ttl)0
-rw-r--r--test/lv2/core.lv2/meson.build11
-rw-r--r--test/meson.build103
-rw-r--r--test/missing_descriptor.lv2/meson.build37
-rw-r--r--test/missing_descriptor.lv2/missing_descriptor.c20
-rw-r--r--test/missing_descriptor.lv2/test_missing_descriptor.c19
-rw-r--r--test/missing_name.lv2/meson.build37
-rw-r--r--test/missing_name.lv2/missing_name.c20
-rw-r--r--test/missing_name.lv2/test_missing_name.c17
-rw-r--r--test/missing_plugin.lv2/meson.build37
-rw-r--r--test/missing_plugin.lv2/missing_plugin.c20
-rw-r--r--test/missing_plugin.lv2/test_missing_plugin.c19
-rw-r--r--test/missing_port.lv2/meson.build37
-rw-r--r--test/missing_port.lv2/missing_port.c20
-rw-r--r--test/missing_port.lv2/test_missing_port.c17
-rw-r--r--test/missing_port_name.lv2/meson.build37
-rw-r--r--test/missing_port_name.lv2/missing_port_name.c20
-rw-r--r--test/missing_port_name.lv2/test_missing_port_name.c17
-rw-r--r--test/new_version.lv2/meson.build24
-rw-r--r--test/new_version.lv2/new_version.c20
-rw-r--r--test/old_version.lv2/meson.build24
-rw-r--r--test/old_version.lv2/old_version.c20
-rw-r--r--test/test_bad_port_index.c23
-rw-r--r--test/test_bad_port_symbol.c23
-rw-r--r--test/test_classes.c19
-rw-r--r--test/test_discovery.c23
-rw-r--r--test/test_filesystem.c553
-rw-r--r--test/test_get_symbol.c19
-rw-r--r--test/test_no_author.c29
-rw-r--r--test/test_no_verify.c23
-rw-r--r--test/test_plugin.c29
-rw-r--r--test/test_plugin.lv2/manifest.ttl.in (renamed from test/test.lv2/manifest.ttl.in)4
-rw-r--r--test/test_plugin.lv2/meson.build24
-rw-r--r--test/test_plugin.lv2/test_plugin.c (renamed from test/test.lv2/test.c)104
-rw-r--r--test/test_plugin.lv2/test_plugin.ttl.in (renamed from test/test.lv2/test.ttl.in)0
-rw-r--r--test/test_port.c23
-rw-r--r--test/test_preset.c21
-rw-r--r--test/test_project.c23
-rw-r--r--test/test_project_no_author.c29
-rw-r--r--test/test_prototype.c23
-rw-r--r--test/test_reload_bundle.c19
-rw-r--r--test/test_replace_version.c27
-rw-r--r--test/test_state.c265
-rw-r--r--test/test_string.c56
-rw-r--r--test/test_ui.c19
-rw-r--r--test/test_util.c67
-rw-r--r--test/test_value.c21
-rw-r--r--test/test_verify.c23
-rw-r--r--test/test_world.c21
74 files changed, 1170 insertions, 1638 deletions
diff --git a/test/.clang-tidy b/test/.clang-tidy
index a6f6844..729db52 100644
--- a/test/.clang-tidy
+++ b/test/.clang-tidy
@@ -1,42 +1,20 @@
+# Copyright 2020-2024 David Robillard <d@drobilla.net>
+# SPDX-License-Identifier: 0BSD OR ISC
+
Checks: >
- *,
- -*-else-after-return,
-*-magic-numbers,
- -*-uppercase-literal-suffix,
- -*-vararg,
-android-cloexec-fopen,
-bugprone-assert-side-effect,
-bugprone-branch-clone,
- -bugprone-macro-parentheses,
-bugprone-narrowing-conversions,
- -bugprone-not-null-terminated-result,
- -bugprone-reserved-identifier,
- -bugprone-suspicious-string-compare,
- -cert-dcl37-c,
- -cert-dcl50-cpp,
- -cert-dcl51-cpp,
- -cert-err34-c,
- -clang-analyzer-alpha.*,
+ -cert-err33-c,
-clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling,
+ -concurrency-mt-unsafe,
-cppcoreguidelines-avoid-non-const-global-variables,
- -cppcoreguidelines-macro-usage,
-cppcoreguidelines-narrowing-conversions,
- -cppcoreguidelines-pro-bounds-array-to-pointer-decay,
- -fuchsia-overloaded-operator,
- -google-explicit-constructor,
- -google-readability-todo,
- -hicpp-explicit-conversions,
-hicpp-multiway-paths-covered,
- -hicpp-no-array-decay,
-hicpp-signed-bitwise,
-llvm-header-guard,
- -llvmlibc-*,
- -misc-no-recursion,
- -misc-non-private-member-variables-in-classes,
- -misc-unused-parameters,
- -modernize-return-braced-init-list,
- -modernize-use-trailing-return-type,
- -readability-implicit-bool-conversion,
-WarningsAsErrors: '*'
-HeaderFilterRegex: '.*'
-FormatStyle: file
+ -readability-function-cognitive-complexity,
+ -readability-suspicious-call-argument,
+InheritParentConfig: true
diff --git a/test/bad_syntax.lv2/bad_syntax.c b/test/bad_syntax.lv2/bad_syntax.c
index da9c041..692fc33 100644
--- a/test/bad_syntax.lv2/bad_syntax.c
+++ b/test/bad_syntax.lv2/bad_syntax.c
@@ -1,21 +1,7 @@
-/*
- Lilv Test Plugin - Bad syntax in plugin data file
- 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>
diff --git a/test/bad_syntax.lv2/meson.build b/test/bad_syntax.lv2/meson.build
new file mode 100644
index 0000000..48df70e
--- /dev/null
+++ b/test/bad_syntax.lv2/meson.build
@@ -0,0 +1,37 @@
+# Copyright 2021-2022 David Robillard <d@drobilla.net>
+# SPDX-License-Identifier: 0BSD OR ISC
+
+module = shared_module(
+ 'bad_syntax',
+ files('bad_syntax.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', 'bad_syntax.ttl']
+
+foreach f : ttl_files
+ configure_file(
+ configuration: config,
+ input: files(f + '.in'),
+ output: f,
+ )
+endforeach
+
+test(
+ 'bad_syntax',
+ executable(
+ 'test_bad_syntax',
+ files('test_bad_syntax.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/bad_syntax.lv2/test_bad_syntax.c b/test/bad_syntax.lv2/test_bad_syntax.c
index 5f10828..1e42ef3 100644
--- a/test/bad_syntax.lv2/test_bad_syntax.c
+++ b/test/bad_syntax.lv2/test_bad_syntax.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/bad-syntax"
@@ -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);
diff --git a/test/cpp/.clang-tidy b/test/cpp/.clang-tidy
new file mode 100644
index 0000000..a087a3d
--- /dev/null
+++ b/test/cpp/.clang-tidy
@@ -0,0 +1,21 @@
+# Copyright 2020-2025 David Robillard <d@drobilla.net>
+# SPDX-License-Identifier: 0BSD OR ISC
+
+Checks: >
+ -*-nullptr,
+ -cert-dcl50-cpp,
+ -cppcoreguidelines-macro-usage,
+ -cppcoreguidelines-pro-bounds-array-to-pointer-decay,
+ -fuchsia-overloaded-operator,
+ -google-explicit-constructor,
+ -google-readability-todo,
+ -hicpp-explicit-conversions,
+ -hicpp-no-array-decay,
+ -misc-non-private-member-variables-in-classes,
+ -modernize-return-braced-init-list,
+ -modernize-use-nodiscard,
+ -modernize-use-trailing-return-type,
+ -modernize-use-using,
+ -readability-implicit-bool-conversion,
+HeaderFilterRegex: '.*/lilvmm\.hpp'
+InheritParentConfig: true
diff --git a/test/cpp/meson.build b/test/cpp/meson.build
new file mode 100644
index 0000000..b810e39
--- /dev/null
+++ b/test/cpp/meson.build
@@ -0,0 +1,37 @@
+# Copyright 2020-2022 David Robillard <d@drobilla.net>
+# SPDX-License-Identifier: 0BSD OR ISC
+
+cpp_suppressions = []
+if cpp.get_id() == 'gcc'
+ cpp_suppressions += [
+ '-Wno-cast-align',
+ '-Wno-padded',
+ ]
+elif cpp.get_id() == 'clang'
+ cpp_suppressions += [
+ '-Wno-c++98-compat',
+ '-Wno-cast-align',
+ '-Wno-cast-qual',
+ '-Wno-documentation-unknown-command',
+ '-Wno-padded',
+ '-Wno-poison-system-directories',
+ '-Wno-reserved-id-macro',
+ ]
+elif cpp.get_id() == 'msvc'
+ cpp_suppressions += [
+ '/wd4514', # unreferenced inline function has been removed
+ '/wd4820', # padding added after construct
+ ]
+endif
+
+test(
+ 'lilv_hpp',
+ executable(
+ 'test_lilv_hpp',
+ files('test_lilv_hpp.cpp'),
+ cpp_args: test_args + cpp_suppressions,
+ dependencies: [lv2_dep, lilv_dep],
+ implicit_include_directories: false,
+ ),
+ suite: 'unit',
+)
diff --git a/test/cpp/test_lilv_hpp.cpp b/test/cpp/test_lilv_hpp.cpp
new file mode 100644
index 0000000..228fe1d
--- /dev/null
+++ b/test/cpp/test_lilv_hpp.cpp
@@ -0,0 +1,12 @@
+// Copyright 2017-2019 David Robillard <d@drobilla.net>
+// SPDX-License-Identifier: ISC
+
+#include <lilv/lilvmm.hpp>
+
+int
+main()
+{
+ const Lilv::World world{};
+
+ return 0;
+}
diff --git a/test/failed_instantiation.lv2/failed_instantiation.c b/test/failed_instantiation.lv2/failed_instantiation.c
index ecab647..e4e0efe 100644
--- a/test/failed_instantiation.lv2/failed_instantiation.c
+++ b/test/failed_instantiation.lv2/failed_instantiation.c
@@ -1,34 +1,13 @@
-/*
- Lilv Test Plugin - Failed instantiation
- 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>
#define PLUGIN_URI "http://example.org/failed-instantiation"
-enum { TEST_INPUT = 0, TEST_OUTPUT = 1 };
-
-typedef struct {
- float* input;
- float* output;
-} Test;
-
static void
cleanup(LV2_Handle instance)
{
diff --git a/test/failed_instantiation.lv2/meson.build b/test/failed_instantiation.lv2/meson.build
new file mode 100644
index 0000000..0719d53
--- /dev/null
+++ b/test/failed_instantiation.lv2/meson.build
@@ -0,0 +1,37 @@
+# Copyright 2021-2022 David Robillard <d@drobilla.net>
+# SPDX-License-Identifier: 0BSD OR ISC
+
+module = shared_module(
+ 'failed_instantiation',
+ files('failed_instantiation.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', 'failed_instantiation.ttl']
+
+foreach f : ttl_files
+ configure_file(
+ configuration: config,
+ input: files(f + '.in'),
+ output: f,
+ )
+endforeach
+
+test(
+ 'failed_instantiation',
+ executable(
+ 'test_failed_instantiation',
+ files('test_failed_instantiation.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/failed_instantiation.lv2/test_failed_instantiation.c b/test/failed_instantiation.lv2/test_failed_instantiation.c
index 8dbefc3..9e677cf 100644
--- a/test/failed_instantiation.lv2/test_failed_instantiation.c
+++ b/test/failed_instantiation.lv2/test_failed_instantiation.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/failed-instantiation"
@@ -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);
diff --git a/test/failed_lib_descriptor.lv2/failed_lib_descriptor.c b/test/failed_lib_descriptor.lv2/failed_lib_descriptor.c
index c7c08cf..4de2ebe 100644
--- a/test/failed_lib_descriptor.lv2/failed_lib_descriptor.c
+++ b/test/failed_lib_descriptor.lv2/failed_lib_descriptor.c
@@ -1,21 +1,7 @@
-/*
- Lilv Test Plugin - Failed lib 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 <stdlib.h>
diff --git a/test/failed_lib_descriptor.lv2/meson.build b/test/failed_lib_descriptor.lv2/meson.build
new file mode 100644
index 0000000..8c5907a
--- /dev/null
+++ b/test/failed_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(
+ 'failed_lib_descriptor',
+ files('failed_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', 'failed_lib_descriptor.ttl']
+
+foreach f : ttl_files
+ configure_file(
+ input: files(f + '.in'),
+ output: f,
+ configuration: config,
+ )
+endforeach
+
+test(
+ 'failed_lib_descriptor',
+ executable(
+ 'test_failed_lib_descriptor',
+ files('test_failed_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/failed_lib_descriptor.lv2/test_failed_lib_descriptor.c b/test/failed_lib_descriptor.lv2/test_failed_lib_descriptor.c
index 71a3b96..dc37244 100644
--- a/test/failed_lib_descriptor.lv2/test_failed_lib_descriptor.c
+++ b/test/failed_lib_descriptor.lv2/test_failed_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/failed-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);
@@ -38,7 +31,7 @@ main(int argc, char** argv)
const LilvPlugin* plugin = lilv_plugins_get_by_uri(plugins, plugin_uri);
assert(plugin);
- LilvInstance* instance = lilv_plugin_instantiate(plugin, 48000.0, NULL);
+ const LilvInstance* instance = lilv_plugin_instantiate(plugin, 48000.0, NULL);
assert(!instance);
lilv_node_free(plugin_uri);
diff --git a/test/headers/.clang-tidy b/test/headers/.clang-tidy
new file mode 100644
index 0000000..a42a718
--- /dev/null
+++ b/test/headers/.clang-tidy
@@ -0,0 +1,15 @@
+# Copyright 2020-2024 David Robillard <d@drobilla.net>
+# SPDX-License-Identifier: 0BSD OR ISC
+
+Checks: >
+ *,
+ -altera-*,
+ -llvmlibc-*,
+CheckOptions:
+ - key: readability-function-cognitive-complexity.Threshold
+ value: '1'
+ - key: readability-identifier-length.IgnoredParameterNames
+ value: '^(a)|(b)|(ui)|(i)$'
+WarningsAsErrors: '*'
+HeaderFilterRegex: '.*'
+FormatStyle: file
diff --git a/test/headers/meson.build b/test/headers/meson.build
new file mode 100644
index 0000000..c81ffaa
--- /dev/null
+++ b/test/headers/meson.build
@@ -0,0 +1,32 @@
+# Copyright 2020-2025 David Robillard <d@drobilla.net>
+# SPDX-License-Identifier: 0BSD OR ISC
+
+header_c_suppressions = []
+
+if get_option('warning_level') == 'everything'
+ if cc.get_id() == 'clang'
+ if not meson.is_cross_build()
+ header_c_suppressions += ['-Wno-poison-system-directories']
+ endif
+ elif cc.get_id() == 'msvc'
+ header_c_suppressions += [
+ '/wd4820', # padding added after construct
+ ]
+ endif
+endif
+
+if cc.get_id() == 'clang'
+ header_c_suppressions += ['-Wno-nullability-extension']
+endif
+
+test(
+ 'headers',
+ executable(
+ 'test_headers',
+ files('test_headers.c'),
+ c_args: header_c_suppressions,
+ dependencies: lilv_dep,
+ implicit_include_directories: false,
+ ),
+ suite: 'unit',
+)
diff --git a/test/headers/test_headers.c b/test/headers/test_headers.c
new file mode 100644
index 0000000..b0d4aa5
--- /dev/null
+++ b/test/headers/test_headers.c
@@ -0,0 +1,13 @@
+// Copyright 2022-2025 David Robillard <d@drobilla.net>
+// SPDX-License-Identifier: ISC
+
+#include <lilv/lilv.h> // IWYU pragma: keep
+
+#ifdef __GNUC__
+__attribute__((const))
+#endif
+int
+main(void)
+{
+ return 0;
+}
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);
diff --git a/test/lilv_cxx_test.cpp b/test/lilv_cxx_test.cpp
deleted file mode 100644
index 31d5e4e..0000000
--- a/test/lilv_cxx_test.cpp
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- Copyright 2017-2019 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 "lilv/lilvmm.hpp"
-
-int
-main()
-{
- Lilv::World world;
-
- return 0;
-}
diff --git a/test/lilv_test_uri_map.h b/test/lilv_test_uri_map.h
index 5f85c86..00b5226 100644
--- a/test/lilv_test_uri_map.h
+++ b/test/lilv_test_uri_map.h
@@ -1,36 +1,20 @@
-/*
- Copyright 2007-2020 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.
-*/
+// Copyright 2007-2020 David Robillard <d@drobilla.net>
+// SPDX-License-Identifier: ISC
#ifndef LILV_TEST_URI_MAP_H
#define LILV_TEST_URI_MAP_H
-#include "../src/lilv_internal.h"
-
-#include "lv2/urid/urid.h"
-#include "serd/serd.h"
+#include <lv2/urid/urid.h>
+#include <serd/serd.h>
#include <assert.h>
-#include <stddef.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
typedef struct {
- char** uris;
- size_t n_uris;
+ char** uris;
+ uint32_t n_uris;
} LilvTestUriMap;
static inline void
@@ -43,7 +27,7 @@ lilv_test_uri_map_init(LilvTestUriMap* const map)
static inline void
lilv_test_uri_map_clear(LilvTestUriMap* const map)
{
- for (size_t i = 0; i < map->n_uris; ++i) {
+ for (uint32_t i = 0; i < map->n_uris; ++i) {
free(map->uris[i]);
}
@@ -57,16 +41,18 @@ map_uri(LV2_URID_Map_Handle handle, const char* uri)
{
LilvTestUriMap* map = (LilvTestUriMap*)handle;
- for (size_t i = 0; i < map->n_uris; ++i) {
+ for (uint32_t i = 0; i < map->n_uris; ++i) {
if (!strcmp(map->uris[i], uri)) {
return i + 1;
}
}
+ const size_t uri_len = strlen(uri);
assert(serd_uri_string_has_scheme((const uint8_t*)uri));
map->uris = (char**)realloc(map->uris, ++map->n_uris * sizeof(char*));
- map->uris[map->n_uris - 1] = lilv_strdup(uri);
+ map->uris[map->n_uris - 1] = (char*)calloc(1, uri_len + 1);
+ memcpy(map->uris[map->n_uris - 1], uri, uri_len + 1);
return map->n_uris;
}
diff --git a/test/lilv_test_utils.c b/test/lilv_test_utils.c
index f658f1b..ba291d7 100644
--- a/test/lilv_test_utils.c
+++ b/test/lilv_test_utils.c
@@ -1,28 +1,14 @@
-/*
- Copyright 2020 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.
-*/
-
-#define _POSIX_C_SOURCE 200809L /* for setenv */
+// Copyright 2020 David Robillard <d@drobilla.net>
+// SPDX-License-Identifier: ISC
#include "lilv_test_utils.h"
-#include "../src/filesystem.h"
-#include "../src/lilv_internal.h"
-
-#include "lilv/lilv.h"
-#include "serd/serd.h"
+#include <lilv/lilv.h>
+#include <serd/serd.h>
+#include <zix/allocator.h>
+#include <zix/filesystem.h>
+#include <zix/path.h>
+#include <zix/status.h>
#include <errno.h>
#include <stdbool.h>
@@ -46,13 +32,13 @@ lilv_test_env_new(void)
env->plugin2_uri = lilv_new_uri(world, "http://example.org/foobar");
// Set custom LV2_PATH in build directory to only use test data
- char* test_path = lilv_path_canonical(LILV_TEST_DIR);
- char* lv2_path = lilv_strjoin(test_path, "/test_lv2_path", NULL);
+ char* test_path = zix_canonical_path(NULL, LILV_TEST_DIR);
+ char* lv2_path = zix_path_join(NULL, test_path, "lv2");
LilvNode* path = lilv_new_string(world, lv2_path);
lilv_world_set_option(world, LILV_OPTION_LV2_PATH, path);
- free(lv2_path);
- free(test_path);
lilv_node_free(path);
+ zix_free(NULL, lv2_path);
+ zix_free(NULL, test_path);
return env;
}
@@ -60,10 +46,10 @@ lilv_test_env_new(void)
void
lilv_test_env_free(LilvTestEnv* env)
{
- free(env->test_content_path);
- free(env->test_manifest_path);
- free(env->test_bundle_uri);
- free(env->test_bundle_path);
+ zix_free(NULL, env->test_content_path);
+ zix_free(NULL, env->test_manifest_path);
+ lilv_node_free(env->test_bundle_uri);
+ zix_free(NULL, env->test_bundle_path);
lilv_node_free(env->plugin2_uri);
lilv_node_free(env->plugin1_uri);
lilv_world_free(env->world);
@@ -77,16 +63,16 @@ create_bundle(LilvTestEnv* env,
const char* plugin)
{
{
- char* const test_dir = lilv_path_canonical(LILV_TEST_DIR);
- char* const bundle_dir = lilv_path_join(test_dir, name);
+ char* const test_dir = zix_canonical_path(NULL, LILV_TEST_DIR);
+ char* const bundle_dir = zix_path_join(NULL, test_dir, name);
- env->test_bundle_path = lilv_path_join(bundle_dir, "");
+ env->test_bundle_path = zix_path_join(NULL, bundle_dir, "");
- lilv_free(bundle_dir);
- lilv_free(test_dir);
+ zix_free(NULL, bundle_dir);
+ zix_free(NULL, test_dir);
}
- if (lilv_create_directories(env->test_bundle_path)) {
+ if (zix_create_directories(NULL, env->test_bundle_path)) {
fprintf(stderr,
"Failed to create directory '%s' (%s)\n",
env->test_bundle_path,
@@ -98,9 +84,12 @@ create_bundle(LilvTestEnv* env,
(const uint8_t*)env->test_bundle_path, NULL, NULL, true);
env->test_bundle_uri = lilv_new_uri(env->world, (const char*)s.buf);
+
env->test_manifest_path =
- lilv_path_join(env->test_bundle_path, "manifest.ttl");
- env->test_content_path = lilv_path_join(env->test_bundle_path, "plugin.ttl");
+ zix_path_join(NULL, env->test_bundle_path, "manifest.ttl");
+
+ env->test_content_path =
+ zix_path_join(NULL, env->test_bundle_path, "plugin.ttl");
serd_node_free(&s);
@@ -148,25 +137,34 @@ start_bundle(LilvTestEnv* env,
return 0;
}
+static void
+remove_temporary(const char* const path)
+{
+ const ZixStatus st = zix_remove(path);
+ if (st) {
+ fprintf(stderr, "Failed to remove '%s' (%s)\n", path, zix_strerror(st));
+ }
+}
+
void
delete_bundle(LilvTestEnv* env)
{
if (env->test_content_path) {
- lilv_remove(env->test_content_path);
+ remove_temporary(env->test_content_path);
}
if (env->test_manifest_path) {
- lilv_remove(env->test_manifest_path);
+ remove_temporary(env->test_manifest_path);
}
if (env->test_bundle_path) {
- remove(env->test_bundle_path);
+ remove_temporary(env->test_bundle_path);
}
- free(env->test_content_path);
- free(env->test_manifest_path);
- free(env->test_bundle_uri);
- free(env->test_bundle_path);
+ zix_free(NULL, env->test_content_path);
+ zix_free(NULL, env->test_manifest_path);
+ lilv_node_free(env->test_bundle_uri);
+ zix_free(NULL, env->test_bundle_path);
env->test_content_path = NULL;
env->test_manifest_path = NULL;
@@ -188,3 +186,29 @@ set_env(const char* name, const char* value)
setenv(name, value, 1);
#endif
}
+
+char*
+lilv_create_temporary_directory(const char* pattern)
+{
+ char* const tmpdir = zix_temp_directory_path(NULL);
+ char* const path_pattern = zix_path_join(NULL, tmpdir, pattern);
+ char* const result = zix_create_temporary_directory(NULL, path_pattern);
+
+ zix_free(NULL, path_pattern);
+ zix_free(NULL, tmpdir);
+
+ return result;
+}
+
+char*
+string_concat(const char* const head, const char* const tail)
+{
+ const size_t head_len = strlen(head);
+ const size_t tail_len = strlen(tail);
+ char* const result = (char*)calloc(1U, head_len + tail_len + 1U);
+ if (result) {
+ memcpy(result, head, head_len + 1U);
+ memcpy(result + head_len, tail, tail_len + 1U);
+ }
+ return result;
+}
diff --git a/test/lilv_test_utils.h b/test/lilv_test_utils.h
index 76d9bc1..0943238 100644
--- a/test/lilv_test_utils.h
+++ b/test/lilv_test_utils.h
@@ -1,23 +1,11 @@
-/*
- Copyright 2020 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.
-*/
+// Copyright 2020 David Robillard <d@drobilla.net>
+// SPDX-License-Identifier: ISC
#ifndef LILV_TEST_UTILS_H
#define LILV_TEST_UTILS_H
-#include "lilv/lilv.h"
+#include <lilv/lilv.h>
+#include <zix/attributes.h>
#define MANIFEST_PREFIXES \
"\
@@ -92,4 +80,13 @@ delete_bundle(LilvTestEnv* env);
void
set_env(const char* name, const char* value);
+// Create a unique temporary directory
+ZIX_MALLOC_FUNC
+char*
+lilv_create_temporary_directory(const char* pattern);
+
+// Return a new string that is a concatenation of two given strings
+char*
+string_concat(const char* head, const char* tail);
+
#endif // LILV_TEST_UTILS_H
diff --git a/test/lint/meson.build b/test/lint/meson.build
new file mode 100644
index 0000000..04214f1
--- /dev/null
+++ b/test/lint/meson.build
@@ -0,0 +1,38 @@
+# Copyright 2020-2024 David Robillard <d@drobilla.net>
+# SPDX-License-Identifier: 0BSD OR ISC
+
+# Check licensing metadata
+reuse = find_program('reuse', required: false)
+if reuse.found()
+ reuse_args = ['--root', lilv_src_root, 'lint']
+ test('REUSE', reuse, args: reuse_args, suite: 'data')
+endif
+
+if not meson.is_subproject()
+ # Check release metadata
+ autoship = find_program('autoship', required: false)
+ if autoship.found()
+ test('autoship', autoship, args: ['test', lilv_src_root], suite: 'data')
+ endif
+
+ # Check code with cppcheck
+ cppcheck = find_program('cppcheck', required: false)
+ if cppcheck.found()
+ compdb_path = join_paths(lilv_build_root, 'compile_commands.json')
+ suppress_path = join_paths(lilv_src_root, '.suppress.cppcheck')
+ test(
+ 'cppcheck',
+ cppcheck,
+ args: [
+ '--cppcheck-build-dir=' + meson.current_build_dir(),
+ '--enable=warning,style,performance,portability',
+ '--error-exitcode=1',
+ '--project=' + compdb_path,
+ '--suppressions-list=' + suppress_path,
+ '-DLILV_VERSION="\"@0@\""'.format(meson.project_version()),
+ '-q',
+ ],
+ suite: 'code',
+ )
+ endif
+endif
diff --git a/test/core.lv2/lv2core.ttl b/test/lv2/core.lv2/lv2core.ttl
index 5659487..5659487 100644
--- a/test/core.lv2/lv2core.ttl
+++ b/test/lv2/core.lv2/lv2core.ttl
diff --git a/test/core.lv2/manifest.ttl b/test/lv2/core.lv2/manifest.ttl
index a77ad71..a77ad71 100644
--- a/test/core.lv2/manifest.ttl
+++ b/test/lv2/core.lv2/manifest.ttl
diff --git a/test/lv2/core.lv2/meson.build b/test/lv2/core.lv2/meson.build
new file mode 100644
index 0000000..0d02ae1
--- /dev/null
+++ b/test/lv2/core.lv2/meson.build
@@ -0,0 +1,11 @@
+# Copyright 2021-2022 David Robillard <d@drobilla.net>
+# SPDX-License-Identifier: 0BSD OR ISC
+
+ttl_files = files(
+ 'lv2core.ttl',
+ 'manifest.ttl',
+)
+
+foreach file : ttl_files
+ configure_file(copy: true, input: file, output: '@PLAINNAME@')
+endforeach
diff --git a/test/meson.build b/test/meson.build
new file mode 100644
index 0000000..ce0c708
--- /dev/null
+++ b/test/meson.build
@@ -0,0 +1,103 @@
+# Copyright 2020-2022 David Robillard <d@drobilla.net>
+# SPDX-License-Identifier: 0BSD OR ISC
+
+###################
+# Header Warnings #
+###################
+
+subdir('headers')
+
+##############
+# Test Setup #
+##############
+
+test_args = []
+if cc.get_id() == 'msvc'
+ test_args += [
+ '/wd4464', # relative include path contains '..'
+ ]
+endif
+
+subdir('lv2/core.lv2')
+
+################
+# Bundle Tests #
+################
+
+subdir('bad_syntax.lv2')
+subdir('failed_instantiation.lv2')
+subdir('failed_lib_descriptor.lv2')
+subdir('lib_descriptor.lv2')
+subdir('missing_descriptor.lv2')
+subdir('missing_name.lv2')
+subdir('missing_plugin.lv2')
+subdir('missing_port.lv2')
+subdir('missing_port_name.lv2')
+subdir('new_version.lv2')
+subdir('old_version.lv2')
+subdir('test_plugin.lv2')
+
+################
+# C++ Bindings #
+################
+
+if not get_option('bindings_cpp').disabled()
+ subdir('cpp')
+endif
+
+##############
+# Unit Tests #
+##############
+
+unit_tests = [
+ 'bad_port_index',
+ 'bad_port_symbol',
+ 'classes',
+ 'discovery',
+ 'get_symbol',
+ 'no_author',
+ 'no_verify',
+ 'plugin',
+ 'port',
+ 'preset',
+ 'project',
+ 'project_no_author',
+ 'prototype',
+ 'reload_bundle',
+ 'replace_version',
+ 'state',
+ 'ui',
+ 'util',
+ 'value',
+ 'verify',
+ 'world',
+]
+
+define_args = [
+ '-DLILV_TEST_BUNDLE="@0@/"'.format(
+ meson.current_build_dir() / 'test_plugin.lv2',
+ ),
+ '-DLILV_TEST_DIR="@0@/"'.format(meson.current_build_dir()),
+]
+
+foreach unit : unit_tests
+ test(
+ unit,
+ executable(
+ 'test_@0@'.format(unit),
+ files('lilv_test_utils.c', 'test_@0@.c'.format(unit)),
+ c_args: define_args + test_args + c_suppressions,
+ dependencies: [lv2_dep, lilv_dep],
+ implicit_include_directories: false,
+ ),
+ suite: 'unit',
+ )
+endforeach
+
+########
+# Lint #
+########
+
+if get_option('lint')
+ subdir('lint')
+endif
diff --git a/test/missing_descriptor.lv2/meson.build b/test/missing_descriptor.lv2/meson.build
new file mode 100644
index 0000000..92c5145
--- /dev/null
+++ b/test/missing_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(
+ 'missing_descriptor',
+ files('missing_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', 'missing_descriptor.ttl']
+
+foreach f : ttl_files
+ configure_file(
+ input: files(f + '.in'),
+ output: f,
+ configuration: config,
+ )
+endforeach
+
+test(
+ 'missing_descriptor',
+ executable(
+ 'test_missing_descriptor',
+ files('test_missing_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/missing_descriptor.lv2/missing_descriptor.c b/test/missing_descriptor.lv2/missing_descriptor.c
index ec1b473..c1fa47a 100644
--- a/test/missing_descriptor.lv2/missing_descriptor.c
+++ b/test/missing_descriptor.lv2/missing_descriptor.c
@@ -1,21 +1,7 @@
-/*
- Lilv Test Plugin - Missing descriptor
- Copyright 2011-2018 David Robillard <d@drobilla.net>
+// Copyright 2011-2018 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>
LV2_SYMBOL_EXPORT
extern const char* msg;
diff --git a/test/missing_descriptor.lv2/test_missing_descriptor.c b/test/missing_descriptor.lv2/test_missing_descriptor.c
index 330e534..ed7b868 100644
--- a/test/missing_descriptor.lv2/test_missing_descriptor.c
+++ b/test/missing_descriptor.lv2/test_missing_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/missing-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);
@@ -38,7 +31,7 @@ main(int argc, char** argv)
const LilvPlugin* plugin = lilv_plugins_get_by_uri(plugins, plugin_uri);
assert(plugin);
- LilvInstance* instance = lilv_plugin_instantiate(plugin, 48000.0, NULL);
+ const LilvInstance* instance = lilv_plugin_instantiate(plugin, 48000.0, NULL);
assert(!instance);
lilv_node_free(plugin_uri);
diff --git a/test/missing_name.lv2/meson.build b/test/missing_name.lv2/meson.build
new file mode 100644
index 0000000..da9759e
--- /dev/null
+++ b/test/missing_name.lv2/meson.build
@@ -0,0 +1,37 @@
+# Copyright 2021-2022 David Robillard <d@drobilla.net>
+# SPDX-License-Identifier: 0BSD OR ISC
+
+module = shared_module(
+ 'missing_name',
+ files('missing_name.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', 'missing_name.ttl']
+
+foreach f : ttl_files
+ configure_file(
+ input: files(f + '.in'),
+ output: f,
+ configuration: config,
+ )
+endforeach
+
+test(
+ 'missing_name',
+ executable(
+ 'test_missing_name',
+ files('test_missing_name.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/missing_name.lv2/missing_name.c b/test/missing_name.lv2/missing_name.c
index 8c6e6fe..8099cc4 100644
--- a/test/missing_name.lv2/missing_name.c
+++ b/test/missing_name.lv2/missing_name.c
@@ -1,21 +1,7 @@
-/*
- Lilv Test Plugin - Missing name
- 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>
diff --git a/test/missing_name.lv2/test_missing_name.c b/test/missing_name.lv2/test_missing_name.c
index 5cb069a..368ad5f 100644
--- a/test/missing_name.lv2/test_missing_name.c
+++ b/test/missing_name.lv2/test_missing_name.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/missing-name"
@@ -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);
diff --git a/test/missing_plugin.lv2/meson.build b/test/missing_plugin.lv2/meson.build
new file mode 100644
index 0000000..f28fc9f
--- /dev/null
+++ b/test/missing_plugin.lv2/meson.build
@@ -0,0 +1,37 @@
+# Copyright 2021-2022 David Robillard <d@drobilla.net>
+# SPDX-License-Identifier: 0BSD OR ISC
+
+module = shared_module(
+ 'missing_plugin',
+ files('missing_plugin.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', 'missing_plugin.ttl']
+
+foreach f : ttl_files
+ configure_file(
+ input: files(f + '.in'),
+ output: f,
+ configuration: config,
+ )
+endforeach
+
+test(
+ 'missing_plugin',
+ executable(
+ 'test_missing_plugin',
+ files('test_missing_plugin.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/missing_plugin.lv2/missing_plugin.c b/test/missing_plugin.lv2/missing_plugin.c
index 8ca146c..15b790f 100644
--- a/test/missing_plugin.lv2/missing_plugin.c
+++ b/test/missing_plugin.lv2/missing_plugin.c
@@ -1,21 +1,7 @@
-/*
- Lilv Test Plugin - Missing plugin
- 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>
diff --git a/test/missing_plugin.lv2/test_missing_plugin.c b/test/missing_plugin.lv2/test_missing_plugin.c
index 861fcba..e62b236 100644
--- a/test/missing_plugin.lv2/test_missing_plugin.c
+++ b/test/missing_plugin.lv2/test_missing_plugin.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/missing-plugin"
@@ -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);
@@ -38,7 +31,7 @@ main(int argc, char** argv)
const LilvPlugin* plugin = lilv_plugins_get_by_uri(plugins, plugin_uri);
assert(plugin);
- LilvInstance* instance = lilv_plugin_instantiate(plugin, 48000.0, NULL);
+ const LilvInstance* instance = lilv_plugin_instantiate(plugin, 48000.0, NULL);
assert(!instance);
lilv_node_free(plugin_uri);
diff --git a/test/missing_port.lv2/meson.build b/test/missing_port.lv2/meson.build
new file mode 100644
index 0000000..3bf892b
--- /dev/null
+++ b/test/missing_port.lv2/meson.build
@@ -0,0 +1,37 @@
+# Copyright 2021-2022 David Robillard <d@drobilla.net>
+# SPDX-License-Identifier: 0BSD OR ISC
+
+module = shared_module(
+ 'missing_port',
+ files('missing_port.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', 'missing_port.ttl']
+
+foreach f : ttl_files
+ configure_file(
+ input: files(f + '.in'),
+ output: f,
+ configuration: config,
+ )
+endforeach
+
+test(
+ 'missing_port',
+ executable(
+ 'test_missing_port',
+ files('test_missing_port.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/missing_port.lv2/missing_port.c b/test/missing_port.lv2/missing_port.c
index c567d55..d85af8c 100644
--- a/test/missing_port.lv2/missing_port.c
+++ b/test/missing_port.lv2/missing_port.c
@@ -1,21 +1,7 @@
-/*
- Lilv Test Plugin - Missing port
- 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>
diff --git a/test/missing_port.lv2/test_missing_port.c b/test/missing_port.lv2/test_missing_port.c
index ec6713c..4d5323d 100644
--- a/test/missing_port.lv2/test_missing_port.c
+++ b/test/missing_port.lv2/test_missing_port.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/missing-port"
@@ -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);
diff --git a/test/missing_port_name.lv2/meson.build b/test/missing_port_name.lv2/meson.build
new file mode 100644
index 0000000..68fe629
--- /dev/null
+++ b/test/missing_port_name.lv2/meson.build
@@ -0,0 +1,37 @@
+# Copyright 2021-2022 David Robillard <d@drobilla.net>
+# SPDX-License-Identifier: 0BSD OR ISC
+
+module = shared_module(
+ 'missing_port_name',
+ files('missing_port_name.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', 'missing_port_name.ttl']
+
+foreach f : ttl_files
+ configure_file(
+ input: files(f + '.in'),
+ output: f,
+ configuration: config,
+ )
+endforeach
+
+test(
+ 'missing_port_name',
+ executable(
+ 'test_missing_port_name',
+ files('test_missing_port_name.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/missing_port_name.lv2/missing_port_name.c b/test/missing_port_name.lv2/missing_port_name.c
index 7a00945..6f14ba3 100644
--- a/test/missing_port_name.lv2/missing_port_name.c
+++ b/test/missing_port_name.lv2/missing_port_name.c
@@ -1,21 +1,7 @@
-/*
- Lilv Test Plugin - Missing port name
- 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>
diff --git a/test/missing_port_name.lv2/test_missing_port_name.c b/test/missing_port_name.lv2/test_missing_port_name.c
index 4d017d9..b483b84 100644
--- a/test/missing_port_name.lv2/test_missing_port_name.c
+++ b/test/missing_port_name.lv2/test_missing_port_name.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/missing-port-name"
@@ -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);
diff --git a/test/new_version.lv2/meson.build b/test/new_version.lv2/meson.build
new file mode 100644
index 0000000..bd90443
--- /dev/null
+++ b/test/new_version.lv2/meson.build
@@ -0,0 +1,24 @@
+# Copyright 2021-2022 David Robillard <d@drobilla.net>
+# SPDX-License-Identifier: 0BSD OR ISC
+
+module = shared_module(
+ 'new_version',
+ files('new_version.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', 'new_version.ttl']
+
+foreach f : ttl_files
+ configure_file(
+ input: files(f + '.in'),
+ output: f,
+ configuration: config,
+ )
+endforeach
+
diff --git a/test/new_version.lv2/new_version.c b/test/new_version.lv2/new_version.c
index 4de48e7..3521c6e 100644
--- a/test/new_version.lv2/new_version.c
+++ b/test/new_version.lv2/new_version.c
@@ -1,21 +1,7 @@
-/*
- Lilv Test Plugin - New version
- 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>
diff --git a/test/old_version.lv2/meson.build b/test/old_version.lv2/meson.build
new file mode 100644
index 0000000..09434b1
--- /dev/null
+++ b/test/old_version.lv2/meson.build
@@ -0,0 +1,24 @@
+# Copyright 2021-2022 David Robillard <d@drobilla.net>
+# SPDX-License-Identifier: 0BSD OR ISC
+
+module = shared_module(
+ 'old_version',
+ files('old_version.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', 'old_version.ttl']
+
+foreach f : ttl_files
+ configure_file(
+ input: files(f + '.in'),
+ output: f,
+ configuration: config,
+ )
+endforeach
+
diff --git a/test/old_version.lv2/old_version.c b/test/old_version.lv2/old_version.c
index 7f97dad..3521c6e 100644
--- a/test/old_version.lv2/old_version.c
+++ b/test/old_version.lv2/old_version.c
@@ -1,21 +1,7 @@
-/*
- Lilv Test Plugin - Old version
- 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>
diff --git a/test/test_bad_port_index.c b/test/test_bad_port_index.c
index 985d74e..6177dbb 100644
--- a/test/test_bad_port_index.c
+++ b/test/test_bad_port_index.c
@@ -1,24 +1,11 @@
-/*
- Copyright 2007-2020 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.
-*/
+// Copyright 2007-2020 David Robillard <d@drobilla.net>
+// SPDX-License-Identifier: ISC
#undef NDEBUG
#include "lilv_test_utils.h"
-#include "lilv/lilv.h"
+#include <lilv/lilv.h>
#include <assert.h>
#include <stdint.h>
@@ -38,8 +25,8 @@ static const char* const plugin_ttl = "\
int
main(void)
{
- LilvTestEnv* const env = lilv_test_env_new();
- LilvWorld* const world = env->world;
+ LilvTestEnv* const env = lilv_test_env_new();
+ const LilvWorld* const world = env->world;
if (create_bundle(
env, "bad_port_index.lv2", SIMPLE_MANIFEST_TTL, plugin_ttl)) {
diff --git a/test/test_bad_port_symbol.c b/test/test_bad_port_symbol.c
index ae34ad0..3f01c82 100644
--- a/test/test_bad_port_symbol.c
+++ b/test/test_bad_port_symbol.c
@@ -1,24 +1,11 @@
-/*
- Copyright 2007-2020 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.
-*/
+// Copyright 2007-2020 David Robillard <d@drobilla.net>
+// SPDX-License-Identifier: ISC
#undef NDEBUG
#include "lilv_test_utils.h"
-#include "lilv/lilv.h"
+#include <lilv/lilv.h>
#include <assert.h>
#include <stdint.h>
@@ -38,8 +25,8 @@ static const char* const plugin_ttl = "\
int
main(void)
{
- LilvTestEnv* const env = lilv_test_env_new();
- LilvWorld* const world = env->world;
+ LilvTestEnv* const env = lilv_test_env_new();
+ const LilvWorld* const world = env->world;
if (create_bundle(
env, "bad_port_symbol.lv2", SIMPLE_MANIFEST_TTL, plugin_ttl)) {
diff --git a/test/test_classes.c b/test/test_classes.c
index 332d847..52dd711 100644
--- a/test/test_classes.c
+++ b/test/test_classes.c
@@ -1,24 +1,11 @@
-/*
- Copyright 2007-2020 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.
-*/
+// Copyright 2007-2020 David Robillard <d@drobilla.net>
+// SPDX-License-Identifier: ISC
#undef NDEBUG
#include "lilv_test_utils.h"
-#include "lilv/lilv.h"
+#include <lilv/lilv.h>
#include <assert.h>
#include <string.h>
diff --git a/test/test_discovery.c b/test/test_discovery.c
index f7f30ea..be9cde8 100644
--- a/test/test_discovery.c
+++ b/test/test_discovery.c
@@ -1,24 +1,11 @@
-/*
- Copyright 2007-2020 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.
-*/
+// Copyright 2007-2020 David Robillard <d@drobilla.net>
+// SPDX-License-Identifier: ISC
#undef NDEBUG
#include "lilv_test_utils.h"
-#include "lilv/lilv.h"
+#include <lilv/lilv.h>
#include <assert.h>
#include <string.h>
@@ -56,8 +43,8 @@ discovery_verify_plugin(const LilvTestEnv* env, const LilvPlugin* plugin)
int
main(void)
{
- LilvTestEnv* const env = lilv_test_env_new();
- LilvWorld* const world = env->world;
+ LilvTestEnv* const env = lilv_test_env_new();
+ const LilvWorld* const world = env->world;
if (create_bundle(env, "discovery.lv2", SIMPLE_MANIFEST_TTL, plugin_ttl)) {
return 1;
diff --git a/test/test_filesystem.c b/test/test_filesystem.c
deleted file mode 100644
index 0a4aa4d..0000000
--- a/test/test_filesystem.c
+++ /dev/null
@@ -1,553 +0,0 @@
-/*
- Copyright 2020 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.
-*/
-
-#undef NDEBUG
-
-#include "lilv_internal.h"
-
-#include "../src/filesystem.h"
-
-#include <assert.h>
-#include <errno.h>
-#include <stdbool.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-static bool
-equals(char* string, const char* expected)
-{
- const bool result = !strcmp(string, expected);
- free(string);
- return result;
-}
-
-static void
-test_temp_directory_path(void)
-{
- char* tmpdir = lilv_temp_directory_path();
-
- assert(lilv_is_directory(tmpdir));
-
- free(tmpdir);
-}
-
-static void
-test_path_is_absolute(void)
-{
- assert(lilv_path_is_absolute("/a/b"));
- assert(lilv_path_is_absolute("/a"));
- assert(lilv_path_is_absolute("/"));
-
- assert(!lilv_path_is_absolute("a/b"));
- assert(!lilv_path_is_absolute("a"));
- assert(!lilv_path_is_absolute("."));
-
-#ifdef _WIN32
- assert(lilv_path_is_absolute("C:/a/b"));
- assert(lilv_path_is_absolute("C:\\a\\b"));
- assert(lilv_path_is_absolute("D:/a/b"));
- assert(lilv_path_is_absolute("D:\\a\\b"));
-#endif
-}
-
-static void
-test_path_is_child(void)
-{
- assert(lilv_path_is_child("/a/b", "/a"));
- assert(lilv_path_is_child("/a/b", "/a/"));
- assert(lilv_path_is_child("/a/b/", "/a"));
- assert(lilv_path_is_child("/a/b/", "/a/"));
-
- assert(!lilv_path_is_child("/a/b", "/a/c"));
- assert(!lilv_path_is_child("/a/b", "/a/c/"));
- assert(!lilv_path_is_child("/a/b/", "/a/c"));
- assert(!lilv_path_is_child("/a/b/", "/a/c/"));
-
- assert(!lilv_path_is_child("/a/b", "/c"));
- assert(!lilv_path_is_child("/a/b", "/c/"));
- assert(!lilv_path_is_child("/a/b/", "/c"));
- assert(!lilv_path_is_child("/a/b/", "/c/"));
-}
-
-static void
-test_path_current(void)
-{
- char* cwd = lilv_path_current();
-
- assert(lilv_is_directory(cwd));
-
- free(cwd);
-}
-
-static void
-test_path_absolute(void)
-{
- const char* const short_path = "a";
- const char* const long_path = "a/b/c";
-
- char* const cwd = lilv_path_current();
- char* const expected_short = lilv_path_join(cwd, short_path);
- char* const expected_long = lilv_path_join(cwd, long_path);
-
- assert(equals(lilv_path_absolute(short_path), expected_short));
- assert(equals(lilv_path_absolute(long_path), expected_long));
-
- free(expected_long);
- free(expected_short);
- free(cwd);
-}
-
-static void
-test_path_absolute_child(void)
-{
- const char* const parent = "/parent";
- const char* const short_path = "a";
- const char* const long_path = "a/b/c";
-
- char* const expected_short = lilv_path_join(parent, short_path);
- char* const expected_long = lilv_path_join(parent, long_path);
-
- assert(equals(lilv_path_absolute_child(short_path, parent), expected_short));
-
- assert(equals(lilv_path_absolute_child(long_path, parent), expected_long));
-
- free(expected_long);
- free(expected_short);
-}
-
-static void
-test_path_relative_to(void)
-{
- assert(equals(lilv_path_relative_to("/a/b", "/a/"), "b"));
- assert(equals(lilv_path_relative_to("/a", "/b/c/"), "/a"));
- assert(equals(lilv_path_relative_to("/a/b/c", "/a/b/d/"), "../c"));
- assert(equals(lilv_path_relative_to("/a/b/c", "/a/b/d/e/"), "../../c"));
-
-#ifdef _WIN32
- assert(equals(lilv_path_relative_to("C:/a/b", "C:/a/"), "b"));
- assert(equals(lilv_path_relative_to("C:/a", "C:/b/c/"), "../../a"));
- assert(equals(lilv_path_relative_to("C:/a/b/c", "C:/a/b/d/"), "../c"));
- assert(equals(lilv_path_relative_to("C:/a/b/c", "C:/a/b/d/e/"), "../../c"));
-
- assert(equals(lilv_path_relative_to("C:\\a\\b", "C:\\a\\"), "b"));
- assert(equals(lilv_path_relative_to("C:\\a", "C:\\b\\c\\"), "..\\..\\a"));
- assert(
- equals(lilv_path_relative_to("C:\\a\\b\\c", "C:\\a\\b\\d\\"), "..\\c"));
- assert(equals(lilv_path_relative_to("C:\\a\\b\\c", "C:\\a\\b\\d\\e\\"),
- "..\\..\\c"));
-#endif
-}
-
-static void
-test_path_parent(void)
-{
- assert(equals(lilv_path_parent("/"), "/"));
- assert(equals(lilv_path_parent("//"), "/"));
- assert(equals(lilv_path_parent("/a"), "/"));
- assert(equals(lilv_path_parent("/a/"), "/"));
- assert(equals(lilv_path_parent("/a///b/"), "/a"));
- assert(equals(lilv_path_parent("/a///b//"), "/a"));
- assert(equals(lilv_path_parent("/a/b"), "/a"));
- assert(equals(lilv_path_parent("/a/b/"), "/a"));
- assert(equals(lilv_path_parent("/a/b/c"), "/a/b"));
- assert(equals(lilv_path_parent("/a/b/c/"), "/a/b"));
- assert(equals(lilv_path_parent("a"), "."));
-}
-
-static void
-test_path_filename(void)
-{
- // Cases from cppreference.com for std::filesystem::path::filename
- assert(equals(lilv_path_filename("/foo/bar.txt"), "bar.txt"));
- assert(equals(lilv_path_filename("/foo/.bar"), ".bar"));
- assert(equals(lilv_path_filename("/foo/bar/"), ""));
- assert(equals(lilv_path_filename("/foo/."), "."));
- assert(equals(lilv_path_filename("/foo/.."), ".."));
- assert(equals(lilv_path_filename("."), "."));
- assert(equals(lilv_path_filename(".."), ".."));
- assert(equals(lilv_path_filename("/"), ""));
- assert(equals(lilv_path_filename("//host"), "host"));
-
-#ifdef _WIN32
- assert(equals(lilv_path_filename("C:/foo/bar.txt"), "bar.txt"));
- assert(equals(lilv_path_filename("C:\\foo\\bar.txt"), "bar.txt"));
- assert(equals(lilv_path_filename("foo/bar.txt"), "bar.txt"));
- assert(equals(lilv_path_filename("foo\\bar.txt"), "bar.txt"));
-#endif
-}
-
-static void
-test_path_join(void)
-{
- assert(lilv_path_join(NULL, NULL) == NULL);
- assert(lilv_path_join(NULL, "") == NULL);
-
-#ifdef _WIN32
- assert(equals(lilv_path_join("", NULL), "\\"));
- assert(equals(lilv_path_join("", ""), "\\"));
- assert(equals(lilv_path_join("a", ""), "a\\"));
- assert(equals(lilv_path_join("a", NULL), "a\\"));
- assert(equals(lilv_path_join("a", "b"), "a\\b"));
-#else
- assert(equals(lilv_path_join("", NULL), "/"));
- assert(equals(lilv_path_join("", ""), "/"));
- assert(equals(lilv_path_join("a", ""), "a/"));
- assert(equals(lilv_path_join("a", NULL), "a/"));
- assert(equals(lilv_path_join("a", "b"), "a/b"));
-#endif
-
- assert(equals(lilv_path_join("/a", ""), "/a/"));
- assert(equals(lilv_path_join("/a/b", ""), "/a/b/"));
- assert(equals(lilv_path_join("/a/", ""), "/a/"));
- assert(equals(lilv_path_join("/a/b/", ""), "/a/b/"));
- assert(equals(lilv_path_join("a/b", ""), "a/b/"));
- assert(equals(lilv_path_join("a/", ""), "a/"));
- assert(equals(lilv_path_join("a/b/", ""), "a/b/"));
-
- assert(equals(lilv_path_join("/a", NULL), "/a/"));
- assert(equals(lilv_path_join("/a/b", NULL), "/a/b/"));
- assert(equals(lilv_path_join("/a/", NULL), "/a/"));
- assert(equals(lilv_path_join("/a/b/", NULL), "/a/b/"));
- assert(equals(lilv_path_join("a/b", NULL), "a/b/"));
- assert(equals(lilv_path_join("a/", NULL), "a/"));
- assert(equals(lilv_path_join("a/b/", NULL), "a/b/"));
-
- assert(equals(lilv_path_join("/a", "b"), "/a/b"));
- assert(equals(lilv_path_join("/a/", "b"), "/a/b"));
- assert(equals(lilv_path_join("a/", "b"), "a/b"));
-
- assert(equals(lilv_path_join("/a", "b/"), "/a/b/"));
- assert(equals(lilv_path_join("/a/", "b/"), "/a/b/"));
- assert(equals(lilv_path_join("a", "b/"), "a/b/"));
- assert(equals(lilv_path_join("a/", "b/"), "a/b/"));
-
-#ifdef _WIN32
- assert(equals(lilv_path_join("C:/a", "b"), "C:/a/b"));
- assert(equals(lilv_path_join("C:\\a", "b"), "C:\\a\\b"));
- assert(equals(lilv_path_join("C:/a", "b/"), "C:/a/b/"));
- assert(equals(lilv_path_join("C:\\a", "b\\"), "C:\\a\\b\\"));
-#endif
-}
-
-static void
-test_path_canonical(void)
-{
- char* const temp_dir = lilv_create_temporary_directory("lilvXXXXXX");
- char* const file_path = lilv_path_join(temp_dir, "lilv_test_file");
-
- FILE* f = fopen(file_path, "w");
- fprintf(f, "test\n");
- fclose(f);
-
-#ifndef _WIN32
- // Test symlink resolution
-
- char* const link_path = lilv_path_join(temp_dir, "lilv_test_link");
-
- assert(!lilv_symlink(file_path, link_path));
-
- char* const real_file_path = lilv_path_canonical(file_path);
- char* const real_link_path = lilv_path_canonical(link_path);
-
- assert(!strcmp(real_file_path, real_link_path));
-
- assert(!lilv_remove(link_path));
- free(real_link_path);
- free(real_file_path);
- free(link_path);
-#endif
-
- // Test dot segment resolution
-
- char* const parent_dir_1 = lilv_path_join(temp_dir, "..");
- char* const parent_dir_2 = lilv_path_parent(temp_dir);
- char* const real_parent_dir_1 = lilv_path_canonical(parent_dir_1);
- char* const real_parent_dir_2 = lilv_path_canonical(parent_dir_2);
-
- assert(!strcmp(real_parent_dir_1, real_parent_dir_2));
-
- // Clean everything up
-
- assert(!lilv_remove(file_path));
- assert(!lilv_remove(temp_dir));
-
- free(real_parent_dir_2);
- free(real_parent_dir_1);
- free(parent_dir_2);
- free(parent_dir_1);
- free(file_path);
- free(temp_dir);
-}
-
-static void
-test_path_exists(void)
-{
- char* const temp_dir = lilv_create_temporary_directory("lilvXXXXXX");
- char* const file_path = lilv_path_join(temp_dir, "lilv_test_file");
-
- assert(!lilv_path_exists(file_path));
-
- FILE* f = fopen(file_path, "w");
- fprintf(f, "test\n");
- fclose(f);
-
- assert(lilv_path_exists(file_path));
-
- assert(!lilv_remove(file_path));
- assert(!lilv_remove(temp_dir));
-
- free(file_path);
- free(temp_dir);
-}
-
-static void
-test_is_directory(void)
-{
- char* const temp_dir = lilv_create_temporary_directory("lilvXXXXXX");
- char* const file_path = lilv_path_join(temp_dir, "lilv_test_file");
-
- assert(lilv_is_directory(temp_dir));
- assert(!lilv_is_directory(file_path)); // Nonexistent
-
- FILE* f = fopen(file_path, "w");
- fprintf(f, "test\n");
- fclose(f);
-
- assert(!lilv_is_directory(file_path)); // File
-
- assert(!lilv_remove(file_path));
- assert(!lilv_remove(temp_dir));
-
- free(file_path);
- free(temp_dir);
-}
-
-static void
-test_copy_file(void)
-{
- char* const temp_dir = lilv_create_temporary_directory("lilvXXXXXX");
- char* const file_path = lilv_path_join(temp_dir, "lilv_test_file");
- char* const copy_path = lilv_path_join(temp_dir, "lilv_test_copy");
-
- FILE* f = fopen(file_path, "w");
- fprintf(f, "test\n");
- fclose(f);
-
- assert(!lilv_copy_file(file_path, copy_path));
- assert(lilv_file_equals(file_path, copy_path));
-
- if (lilv_path_exists("/dev/full")) {
- // Copy short file (error after flushing)
- assert(lilv_copy_file(file_path, "/dev/full") == ENOSPC);
-
- // Copy long file (error during writing)
- f = fopen(file_path, "w");
- for (size_t i = 0; i < 4096; ++i) {
- fprintf(f, "test\n");
- }
- fclose(f);
- assert(lilv_copy_file(file_path, "/dev/full") == ENOSPC);
- }
-
- assert(!lilv_remove(copy_path));
- assert(!lilv_remove(file_path));
- assert(!lilv_remove(temp_dir));
-
- free(copy_path);
- free(file_path);
- free(temp_dir);
-}
-
-static void
-test_flock(void)
-{
- char* const temp_dir = lilv_create_temporary_directory("lilvXXXXXX");
- char* const file_path = lilv_path_join(temp_dir, "lilv_test_file");
-
- FILE* const f1 = fopen(file_path, "w");
- FILE* const f2 = fopen(file_path, "w");
-
- assert(!lilv_flock(f1, true, false));
- assert(lilv_flock(f2, true, false));
- assert(!lilv_flock(f1, false, false));
-
- fclose(f2);
- fclose(f1);
- assert(!lilv_remove(file_path));
- assert(!lilv_remove(temp_dir));
- free(file_path);
- free(temp_dir);
-}
-
-typedef struct {
- size_t n_names;
- char** names;
-} FileList;
-
-static void
-visit(const char* const path, const char* const name, void* const data)
-{
- (void)path;
-
- FileList* file_list = (FileList*)data;
-
- file_list->names =
- (char**)realloc(file_list->names, sizeof(char*) * ++file_list->n_names);
-
- file_list->names[file_list->n_names - 1] = lilv_strdup(name);
-}
-
-static void
-test_dir_for_each(void)
-{
- char* const temp_dir = lilv_create_temporary_directory("lilvXXXXXX");
- char* const path1 = lilv_path_join(temp_dir, "lilv_test_1");
- char* const path2 = lilv_path_join(temp_dir, "lilv_test_2");
-
- FILE* const f1 = fopen(path1, "w");
- FILE* const f2 = fopen(path2, "w");
- fprintf(f1, "test\n");
- fprintf(f2, "test\n");
- fclose(f2);
- fclose(f1);
-
- FileList file_list = {0, NULL};
- lilv_dir_for_each(temp_dir, &file_list, visit);
-
- assert((!strcmp(file_list.names[0], "lilv_test_1") &&
- !strcmp(file_list.names[1], "lilv_test_2")) ||
- (!strcmp(file_list.names[0], "lilv_test_2") &&
- !strcmp(file_list.names[1], "lilv_test_1")));
-
- assert(!lilv_remove(path2));
- assert(!lilv_remove(path1));
- assert(!lilv_remove(temp_dir));
-
- free(file_list.names[0]);
- free(file_list.names[1]);
- free(file_list.names);
- free(path2);
- free(path1);
- free(temp_dir);
-}
-
-static void
-test_create_temporary_directory(void)
-{
- char* const path1 = lilv_create_temporary_directory("lilvXXXXXX");
-
- assert(lilv_is_directory(path1));
-
- char* const path2 = lilv_create_temporary_directory("lilvXXXXXX");
-
- assert(strcmp(path1, path2));
- assert(lilv_is_directory(path2));
-
- assert(!lilv_remove(path2));
- assert(!lilv_remove(path1));
- free(path2);
- free(path1);
-}
-
-static void
-test_create_directories(void)
-{
- char* const temp_dir = lilv_create_temporary_directory("lilvXXXXXX");
-
- assert(lilv_is_directory(temp_dir));
-
- char* const child_dir = lilv_path_join(temp_dir, "child");
- char* const grandchild_dir = lilv_path_join(child_dir, "grandchild");
-
- assert(!lilv_create_directories(grandchild_dir));
- assert(lilv_is_directory(grandchild_dir));
- assert(lilv_is_directory(child_dir));
-
- char* const file_path = lilv_path_join(temp_dir, "lilv_test_file");
- FILE* const f = fopen(file_path, "w");
-
- fprintf(f, "test\n");
- fclose(f);
-
- assert(lilv_create_directories(file_path));
-
- assert(!lilv_remove(file_path));
- assert(!lilv_remove(grandchild_dir));
- assert(!lilv_remove(child_dir));
- assert(!lilv_remove(temp_dir));
- free(file_path);
- free(child_dir);
- free(grandchild_dir);
- free(temp_dir);
-}
-
-static void
-test_file_equals(void)
-{
- char* const temp_dir = lilv_create_temporary_directory("lilvXXXXXX");
- char* const path1 = lilv_path_join(temp_dir, "lilv_test_1");
- char* const path2 = lilv_path_join(temp_dir, "lilv_test_2");
-
- FILE* const f1 = fopen(path1, "w");
- FILE* const f2 = fopen(path2, "w");
- fprintf(f1, "test\n");
- fprintf(f2, "test\n");
-
- assert(lilv_file_equals(path1, path2));
-
- fprintf(f2, "diff\n");
- fflush(f2);
-
- assert(!lilv_file_equals(path1, path2));
-
- fclose(f2);
- fclose(f1);
-
- assert(!lilv_remove(path2));
- assert(!lilv_remove(path1));
- assert(!lilv_remove(temp_dir));
-
- free(path2);
- free(path1);
- free(temp_dir);
-}
-
-int
-main(void)
-{
- test_temp_directory_path();
- test_path_is_absolute();
- test_path_is_child();
- test_path_current();
- test_path_absolute();
- test_path_absolute_child();
- test_path_relative_to();
- test_path_parent();
- test_path_filename();
- test_path_join();
- test_path_canonical();
- test_path_exists();
- test_is_directory();
- test_copy_file();
- test_flock();
- test_dir_for_each();
- test_create_temporary_directory();
- test_create_directories();
- test_file_equals();
-
- return 0;
-}
diff --git a/test/test_get_symbol.c b/test/test_get_symbol.c
index 5337c63..2236df8 100644
--- a/test/test_get_symbol.c
+++ b/test/test_get_symbol.c
@@ -1,24 +1,11 @@
-/*
- Copyright 2007-2020 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.
-*/
+// Copyright 2007-2020 David Robillard <d@drobilla.net>
+// SPDX-License-Identifier: ISC
#undef NDEBUG
#include "lilv_test_utils.h"
-#include "lilv/lilv.h"
+#include <lilv/lilv.h>
#include <assert.h>
#include <string.h>
diff --git a/test/test_no_author.c b/test/test_no_author.c
index aa91198..70991c2 100644
--- a/test/test_no_author.c
+++ b/test/test_no_author.c
@@ -1,24 +1,11 @@
-/*
- Copyright 2007-2020 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.
-*/
+// Copyright 2007-2020 David Robillard <d@drobilla.net>
+// SPDX-License-Identifier: ISC
#undef NDEBUG
#include "lilv_test_utils.h"
-#include "lilv/lilv.h"
+#include <lilv/lilv.h>
#include <assert.h>
@@ -60,8 +47,8 @@ static const char* const plugin_ttl = "\
int
main(void)
{
- LilvTestEnv* const env = lilv_test_env_new();
- LilvWorld* const world = env->world;
+ LilvTestEnv* const env = lilv_test_env_new();
+ const LilvWorld* const world = env->world;
if (create_bundle(env, "no_author.lv2", SIMPLE_MANIFEST_TTL, plugin_ttl)) {
return 1;
@@ -74,13 +61,13 @@ main(void)
const LilvPlugin* plug = lilv_plugins_get_by_uri(plugins, env->plugin1_uri);
assert(plug);
- LilvNode* author_name = lilv_plugin_get_author_name(plug);
+ const LilvNode* author_name = lilv_plugin_get_author_name(plug);
assert(!author_name);
- LilvNode* author_email = lilv_plugin_get_author_email(plug);
+ const LilvNode* author_email = lilv_plugin_get_author_email(plug);
assert(!author_email);
- LilvNode* author_homepage = lilv_plugin_get_author_homepage(plug);
+ const LilvNode* author_homepage = lilv_plugin_get_author_homepage(plug);
assert(!author_homepage);
delete_bundle(env);
diff --git a/test/test_no_verify.c b/test/test_no_verify.c
index e71c483..9c63ea2 100644
--- a/test/test_no_verify.c
+++ b/test/test_no_verify.c
@@ -1,24 +1,11 @@
-/*
- Copyright 2007-2020 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.
-*/
+// Copyright 2007-2020 David Robillard <d@drobilla.net>
+// SPDX-License-Identifier: ISC
#undef NDEBUG
#include "lilv_test_utils.h"
-#include "lilv/lilv.h"
+#include <lilv/lilv.h>
#include <assert.h>
@@ -27,8 +14,8 @@ static const char* const plugin_ttl = ":plug a lv2:Plugin .\n";
int
main(void)
{
- LilvTestEnv* const env = lilv_test_env_new();
- LilvWorld* const world = env->world;
+ LilvTestEnv* const env = lilv_test_env_new();
+ const LilvWorld* const world = env->world;
if (create_bundle(env, "no_verify.lv2", SIMPLE_MANIFEST_TTL, plugin_ttl)) {
return 1;
diff --git a/test/test_plugin.c b/test/test_plugin.c
index 2a427dc..0bd1870 100644
--- a/test/test_plugin.c
+++ b/test/test_plugin.c
@@ -1,26 +1,11 @@
-/*
- Copyright 2007-2020 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.
-*/
+// Copyright 2007-2020 David Robillard <d@drobilla.net>
+// SPDX-License-Identifier: ISC
#undef NDEBUG
#include "lilv_test_utils.h"
-#include "../src/lilv_internal.h"
-
-#include "lilv/lilv.h"
+#include <lilv/lilv.h>
#include <assert.h>
#include <float.h>
@@ -114,14 +99,14 @@ main(void)
const LilvNodes* data_uris = lilv_plugin_get_data_uris(plug);
assert(lilv_nodes_size(data_uris) == 2);
- LilvNode* project = lilv_plugin_get_project(plug);
+ const LilvNode* project = lilv_plugin_get_project(plug);
assert(!project);
char* manifest_uri =
- lilv_strjoin(lilv_node_as_string(plug_bundle_uri), "manifest.ttl", NULL);
+ string_concat(lilv_node_as_string(plug_bundle_uri), "manifest.ttl");
char* data_uri =
- lilv_strjoin(lilv_node_as_string(plug_bundle_uri), "plugin.ttl", NULL);
+ string_concat(lilv_node_as_string(plug_bundle_uri), "plugin.ttl");
LilvNode* manifest_uri_val = lilv_new_uri(world, manifest_uri);
assert(lilv_nodes_contains(data_uris, manifest_uri_val));
@@ -231,7 +216,7 @@ main(void)
LilvNode* blank_p = lilv_new_uri(world, "http://example.org/blank");
LilvNodes* blanks = lilv_plugin_get_value(plug, blank_p);
assert(lilv_nodes_size(blanks) == 1);
- LilvNode* blank = lilv_nodes_get_first(blanks);
+ const LilvNode* blank = lilv_nodes_get_first(blanks);
assert(lilv_node_is_blank(blank));
const char* blank_str = lilv_node_as_blank(blank);
char* blank_tok = lilv_node_get_turtle_token(blank);
diff --git a/test/test.lv2/manifest.ttl.in b/test/test_plugin.lv2/manifest.ttl.in
index bc3952c..48b009b 100644
--- a/test/test.lv2/manifest.ttl.in
+++ b/test/test_plugin.lv2/manifest.ttl.in
@@ -3,5 +3,5 @@
<http://example.org/lilv-test-plugin>
a lv2:Plugin ;
- lv2:binary <test@SHLIB_EXT@> ;
- rdfs:seeAlso <test.ttl> .
+ lv2:binary <test_plugin@SHLIB_EXT@> ;
+ rdfs:seeAlso <test_plugin.ttl> .
diff --git a/test/test_plugin.lv2/meson.build b/test/test_plugin.lv2/meson.build
new file mode 100644
index 0000000..e6c54cf
--- /dev/null
+++ b/test/test_plugin.lv2/meson.build
@@ -0,0 +1,24 @@
+# Copyright 2021-2022 David Robillard <d@drobilla.net>
+# SPDX-License-Identifier: 0BSD OR ISC
+
+module = shared_module(
+ 'test_plugin',
+ files('test_plugin.c'),
+ c_args: c_suppressions,
+ dependencies: [lv2_dep, zix_dep],
+ gnu_symbol_visibility: 'hidden',
+ name_prefix: '',
+)
+
+extension = '.' + module.full_path().split('.')[-1]
+config = configuration_data({'SHLIB_EXT': extension})
+ttl_files = ['manifest.ttl', 'test_plugin.ttl']
+
+foreach f : ttl_files
+ configure_file(
+ input: files(f + '.in'),
+ output: f,
+ configuration: config,
+ )
+endforeach
+
diff --git a/test/test.lv2/test.c b/test/test_plugin.lv2/test_plugin.c
index 2be34b4..c8851d4 100644
--- a/test/test.lv2/test.c
+++ b/test/test_plugin.lv2/test_plugin.c
@@ -1,31 +1,12 @@
-/*
- Lilv Test Plugin
- Copyright 2011-2019 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.
-*/
-
-#define _POSIX_C_SOURCE 200809L
-
-#include "lv2/atom/atom.h"
-#include "lv2/core/lv2.h"
-#include "lv2/state/state.h"
-#include "lv2/urid/urid.h"
-
-#ifdef _MSC_VER
-# include <io.h>
-# define mkstemp(pat) _mktemp(pat)
-#endif
+// Copyright 2011-2022 David Robillard <d@drobilla.net>
+// SPDX-License-Identifier: ISC
+
+#include <lv2/atom/atom.h>
+#include <lv2/core/lv2.h>
+#include <lv2/state/state.h>
+#include <lv2/urid/urid.h>
+#include <zix/filesystem.h>
+#include <zix/path.h>
#include <stdint.h>
#include <stdio.h>
@@ -34,8 +15,6 @@
#define TEST_URI "http://example.org/lilv-test-plugin"
-#define TMP_TEMPLATE "lilv_testXXXXXX"
-
enum { TEST_INPUT = 0, TEST_OUTPUT = 1, TEST_CONTROL = 2 };
typedef struct {
@@ -46,7 +25,7 @@ typedef struct {
LV2_URID atom_Float;
} uris;
- char tmp_file_path[sizeof(TMP_TEMPLATE)];
+ char* tmp_dir_path;
char* rec_file_path;
FILE* rec_file;
@@ -67,6 +46,7 @@ cleanup(LV2_Handle instance)
test->free_path->free_path(test->free_path->handle, test->rec_file_path);
}
+ free(test->tmp_dir_path);
free(instance);
}
@@ -104,8 +84,7 @@ instantiate(const LV2_Descriptor* descriptor,
return NULL;
}
- strncpy(test->tmp_file_path, TMP_TEMPLATE, strlen(TMP_TEMPLATE) + 1);
- mkstemp(test->tmp_file_path);
+ test->tmp_dir_path = zix_temp_directory_path(NULL);
LV2_State_Make_Path* make_path = NULL;
@@ -137,8 +116,9 @@ instantiate(const LV2_Descriptor* descriptor,
test->rec_file_path = make_path->path(make_path->handle, "recfile");
if (!(test->rec_file = fopen(test->rec_file_path, "w"))) {
fprintf(stderr, "ERROR: Failed to open rec file\n");
+ } else {
+ fprintf(test->rec_file, "instantiate\n");
}
- fprintf(test->rec_file, "instantiate\n");
}
return (LV2_Handle)test;
@@ -272,15 +252,26 @@ save(LV2_Handle instance,
LV2_STATE_IS_POD | LV2_STATE_IS_PORTABLE);
if (map_path) {
- FILE* file = fopen(plugin->tmp_file_path, "w");
+ const char* const file_name = "temp_file.txt";
+
+ char* const tmp_file_path =
+ zix_path_join(NULL, plugin->tmp_dir_path, file_name);
+
+ FILE* file = fopen(tmp_file_path, "w");
+ if (!file) {
+ fprintf(stderr, "error: Failed to open file %s\n", tmp_file_path);
+ free(tmp_file_path);
+ return LV2_STATE_ERR_UNKNOWN;
+ }
+
fprintf(file, "Hello\n");
fclose(file);
- char* apath =
- map_path->abstract_path(map_path->handle, plugin->tmp_file_path);
- char* apath2 =
- map_path->abstract_path(map_path->handle, plugin->tmp_file_path);
- if (strcmp(apath, apath2)) {
- fprintf(stderr, "ERROR: Path %s != %s\n", apath, apath2);
+
+ char* apath = map_path->abstract_path(map_path->handle, tmp_file_path);
+ char* apath2 = map_path->abstract_path(map_path->handle, tmp_file_path);
+ free(tmp_file_path);
+ if (!!strcmp(apath, apath2)) {
+ fprintf(stderr, "error: Path %s != %s\n", apath, apath2);
}
store(callback_data,
@@ -310,8 +301,10 @@ save(LV2_Handle instance,
if (make_path) {
char* spath = make_path->path(make_path->handle, "save");
FILE* sfile = fopen(spath, "w");
- fprintf(sfile, "save");
- fclose(sfile);
+ if (sfile) {
+ fprintf(sfile, "save");
+ fclose(sfile);
+ }
apath = map_path->abstract_path(map_path->handle, spath);
store(callback_data,
@@ -376,14 +369,16 @@ restore(LV2_Handle instance,
}
if (apath) {
- char* path = map_path->absolute_path(map_path->handle, apath);
- FILE* f = fopen(path, "r");
- char str[8];
- size_t n_read = fread(str, 1, sizeof(str), f);
- fclose(f);
- if (strncmp(str, "Hello\n", n_read)) {
- fprintf(
- stderr, "error: Restored bad file contents `%s' != `Hello'\n", str);
+ char* path = map_path->absolute_path(map_path->handle, apath);
+ FILE* f = fopen(path, "r");
+ if (f) {
+ char str[8] = {'\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0'};
+ size_t n_read = fread(str, 1, 6, f);
+ fclose(f);
+
+ if (!!strncmp(str, "Hello\n", n_read)) {
+ fprintf(stderr, "error: Restored bad file `%s' != `Hello'\n", str);
+ }
}
free_path->free_path(free_path->handle, path);
}
@@ -432,10 +427,5 @@ LV2_SYMBOL_EXPORT
const LV2_Descriptor*
lv2_descriptor(uint32_t index)
{
- switch (index) {
- case 0:
- return &descriptor;
- default:
- return NULL;
- }
+ return index ? NULL : &descriptor;
}
diff --git a/test/test.lv2/test.ttl.in b/test/test_plugin.lv2/test_plugin.ttl.in
index 1c16b4c..1c16b4c 100644
--- a/test/test.lv2/test.ttl.in
+++ b/test/test_plugin.lv2/test_plugin.ttl.in
diff --git a/test/test_port.c b/test/test_port.c
index 3ea0abc..ac115a6 100644
--- a/test/test_port.c
+++ b/test/test_port.c
@@ -1,24 +1,11 @@
-/*
- Copyright 2007-2020 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.
-*/
+// Copyright 2007-2020 David Robillard <d@drobilla.net>
+// SPDX-License-Identifier: ISC
#undef NDEBUG
#include "lilv_test_utils.h"
-#include "lilv/lilv.h"
+#include <lilv/lilv.h>
#include <assert.h>
#include <stdbool.h>
@@ -105,8 +92,8 @@ main(void)
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);
+ LilvNode* num = lilv_new_int(world, 1);
+ const LilvNodes* nothing = lilv_port_get_value(plug, p, num);
assert(!nothing);
lilv_node_free(num);
diff --git a/test/test_preset.c b/test/test_preset.c
index 151b0e6..f282097 100644
--- a/test/test_preset.c
+++ b/test/test_preset.c
@@ -1,25 +1,12 @@
-/*
- Copyright 2007-2020 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.
-*/
+// Copyright 2007-2020 David Robillard <d@drobilla.net>
+// SPDX-License-Identifier: ISC
#undef NDEBUG
#include "lilv_test_utils.h"
-#include "lilv/lilv.h"
-#include "lv2/presets/presets.h"
+#include <lilv/lilv.h>
+#include <lv2/presets/presets.h>
#include <assert.h>
diff --git a/test/test_project.c b/test/test_project.c
index 7da42bd..43a23a2 100644
--- a/test/test_project.c
+++ b/test/test_project.c
@@ -1,24 +1,11 @@
-/*
- Copyright 2007-2020 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.
-*/
+// Copyright 2007-2020 David Robillard <d@drobilla.net>
+// SPDX-License-Identifier: ISC
#undef NDEBUG
#include "lilv_test_utils.h"
-#include "lilv/lilv.h"
+#include <lilv/lilv.h>
#include <assert.h>
#include <string.h>
@@ -66,8 +53,8 @@ static const char* const plugin_ttl = "\
int
main(void)
{
- LilvTestEnv* const env = lilv_test_env_new();
- LilvWorld* const world = env->world;
+ LilvTestEnv* const env = lilv_test_env_new();
+ const LilvWorld* const world = env->world;
if (create_bundle(env, "project.lv2", SIMPLE_MANIFEST_TTL, plugin_ttl)) {
return 1;
diff --git a/test/test_project_no_author.c b/test/test_project_no_author.c
index 3ee9c85..44ce728 100644
--- a/test/test_project_no_author.c
+++ b/test/test_project_no_author.c
@@ -1,24 +1,11 @@
-/*
- Copyright 2007-2020 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.
-*/
+// Copyright 2007-2020 David Robillard <d@drobilla.net>
+// SPDX-License-Identifier: ISC
#undef NDEBUG
#include "lilv_test_utils.h"
-#include "lilv/lilv.h"
+#include <lilv/lilv.h>
#include <assert.h>
@@ -60,8 +47,8 @@ static const char* const plugin_ttl = "\
int
main(void)
{
- LilvTestEnv* const env = lilv_test_env_new();
- LilvWorld* const world = env->world;
+ LilvTestEnv* const env = lilv_test_env_new();
+ const LilvWorld* const world = env->world;
if (create_bundle(
env, "project_no_author.lv2", SIMPLE_MANIFEST_TTL, plugin_ttl)) {
@@ -75,13 +62,13 @@ main(void)
const LilvPlugin* plug = lilv_plugins_get_by_uri(plugins, env->plugin1_uri);
assert(plug);
- LilvNode* author_name = lilv_plugin_get_author_name(plug);
+ const LilvNode* author_name = lilv_plugin_get_author_name(plug);
assert(!author_name);
- LilvNode* author_email = lilv_plugin_get_author_email(plug);
+ const LilvNode* author_email = lilv_plugin_get_author_email(plug);
assert(!author_email);
- LilvNode* author_homepage = lilv_plugin_get_author_homepage(plug);
+ const LilvNode* author_homepage = lilv_plugin_get_author_homepage(plug);
assert(!author_homepage);
delete_bundle(env);
diff --git a/test/test_prototype.c b/test/test_prototype.c
index 10a3657..3225ffa 100644
--- a/test/test_prototype.c
+++ b/test/test_prototype.c
@@ -1,24 +1,11 @@
-/*
- Copyright 2007-2020 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.
-*/
+// Copyright 2007-2020 David Robillard <d@drobilla.net>
+// SPDX-License-Identifier: ISC
#undef NDEBUG
#include "lilv_test_utils.h"
-#include "lilv/lilv.h"
+#include <lilv/lilv.h>
#include <assert.h>
#include <string.h>
@@ -73,8 +60,8 @@ static const char* const plugin_ttl = "\
int
main(void)
{
- LilvTestEnv* const env = lilv_test_env_new();
- LilvWorld* const world = env->world;
+ LilvTestEnv* const env = lilv_test_env_new();
+ const LilvWorld* const world = env->world;
if (create_bundle(env, "prototype.lv2", manifest_ttl, plugin_ttl)) {
return 1;
diff --git a/test/test_reload_bundle.c b/test/test_reload_bundle.c
index a8f9044..779adeb 100644
--- a/test/test_reload_bundle.c
+++ b/test/test_reload_bundle.c
@@ -1,24 +1,11 @@
-/*
- Copyright 2007-2020 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.
-*/
+// Copyright 2007-2020 David Robillard <d@drobilla.net>
+// SPDX-License-Identifier: ISC
#undef NDEBUG
#include "lilv_test_utils.h"
-#include "lilv/lilv.h"
+#include <lilv/lilv.h>
#include <assert.h>
#include <string.h>
diff --git a/test/test_replace_version.c b/test/test_replace_version.c
index 7ec5519..4465e3c 100644
--- a/test/test_replace_version.c
+++ b/test/test_replace_version.c
@@ -1,27 +1,12 @@
-/*
- Copyright 2007-2020 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.
-*/
+// Copyright 2007-2020 David Robillard <d@drobilla.net>
+// SPDX-License-Identifier: ISC
#undef NDEBUG
#include "lilv_test_utils.h"
-#include "../src/lilv_internal.h"
-
-#include "lilv/lilv.h"
-#include "lv2/core/lv2.h"
+#include <lilv/lilv.h>
+#include <lv2/core/lv2.h>
#include <assert.h>
#include <stdlib.h>
@@ -39,7 +24,7 @@ main(void)
LilvNode* minor = NULL;
LilvNode* micro = NULL;
- char* old_bundle_path = lilv_strjoin(LILV_TEST_DIR, "old_version.lv2/", 0);
+ char* old_bundle_path = string_concat(LILV_TEST_DIR, "old_version.lv2/");
// Load plugin from old bundle
LilvNode* old_bundle = lilv_new_file_uri(world, NULL, old_bundle_path);
@@ -57,7 +42,7 @@ main(void)
lilv_node_free(micro);
lilv_node_free(minor);
- char* new_bundle_path = lilv_strjoin(LILV_TEST_DIR, "new_version.lv2/", 0);
+ char* new_bundle_path = string_concat(LILV_TEST_DIR, "new_version.lv2/");
// Load plugin from new bundle
LilvNode* new_bundle = lilv_new_file_uri(world, NULL, new_bundle_path);
diff --git a/test/test_state.c b/test/test_state.c
index 533c3a9..aeb3f02 100644
--- a/test/test_state.c
+++ b/test/test_state.c
@@ -1,38 +1,19 @@
-/*
- Copyright 2007-2020 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.
-*/
+// Copyright 2007-2020 David Robillard <d@drobilla.net>
+// SPDX-License-Identifier: ISC
#undef NDEBUG
#include "lilv_test_uri_map.h"
#include "lilv_test_utils.h"
-#include "../src/filesystem.h"
-
-#include "lilv/lilv.h"
-#include "lv2/core/lv2.h"
-#include "lv2/state/state.h"
-#include "lv2/urid/urid.h"
-#include "serd/serd.h"
-
-#ifdef _WIN32
-# include <direct.h>
-# define mkdir(path, flags) _mkdir(path)
-#else
-# include <sys/stat.h>
-#endif
+#include <lilv/lilv.h>
+#include <lv2/core/lv2.h>
+#include <lv2/state/state.h>
+#include <lv2/urid/urid.h>
+#include <serd/serd.h>
+#include <zix/allocator.h>
+#include <zix/filesystem.h>
+#include <zix/path.h>
#include <assert.h>
#include <stdbool.h>
@@ -128,16 +109,22 @@ create_test_directories(void)
/* On MacOS, temporary directories from mkdtemp involve symlinks, so
resolve it here so that path comparisons in tests work. */
- dirs.top = lilv_path_canonical(top);
- dirs.shared = lilv_path_join(dirs.top, "shared");
- dirs.scratch = lilv_path_join(dirs.shared, "scratch");
- dirs.copy = lilv_path_join(dirs.shared, "copy");
- dirs.link = lilv_path_join(dirs.shared, "link");
+ dirs.top = zix_canonical_path(NULL, top);
+ dirs.shared = zix_path_join(NULL, dirs.top, "shared");
+ dirs.scratch = zix_path_join(NULL, dirs.shared, "scratch");
+ dirs.copy = zix_path_join(NULL, dirs.shared, "copy");
+ dirs.link = zix_path_join(NULL, dirs.shared, "link");
+
+ assert(dirs.top);
+ assert(dirs.shared);
+ assert(dirs.scratch);
+ assert(dirs.copy);
+ assert(dirs.link);
- assert(!mkdir(dirs.shared, 0700));
- assert(!mkdir(dirs.scratch, 0700));
- assert(!mkdir(dirs.copy, 0700));
- assert(!mkdir(dirs.link, 0700));
+ assert(!zix_create_directory(dirs.shared));
+ assert(!zix_create_directory(dirs.scratch));
+ assert(!zix_create_directory(dirs.copy));
+ assert(!zix_create_directory(dirs.link));
free(top);
@@ -157,28 +144,28 @@ remove_file(const char* path, const char* name, void* data)
{
(void)data;
- char* const full_path = lilv_path_join(path, name);
- assert(!lilv_remove(full_path));
+ char* const full_path = zix_path_join(NULL, path, name);
+ assert(!zix_remove(full_path));
free(full_path);
}
static void
cleanup_test_directories(const TestDirectories dirs)
{
- lilv_dir_for_each(dirs.scratch, NULL, remove_file);
- lilv_dir_for_each(dirs.copy, NULL, remove_file);
- lilv_dir_for_each(dirs.link, NULL, remove_file);
-
- assert(!lilv_remove(dirs.link));
- assert(!lilv_remove(dirs.copy));
- assert(!lilv_remove(dirs.scratch));
- assert(!lilv_remove(dirs.shared));
- assert(!lilv_remove(dirs.top));
-
- free(dirs.link);
- free(dirs.copy);
- free(dirs.scratch);
- free(dirs.shared);
+ zix_dir_for_each(dirs.scratch, NULL, remove_file);
+ zix_dir_for_each(dirs.copy, NULL, remove_file);
+ zix_dir_for_each(dirs.link, NULL, remove_file);
+
+ assert(!zix_remove(dirs.link));
+ assert(!zix_remove(dirs.copy));
+ assert(!zix_remove(dirs.scratch));
+ assert(!zix_remove(dirs.shared));
+ assert(!zix_remove(dirs.top));
+
+ zix_free(NULL, dirs.link);
+ zix_free(NULL, dirs.copy);
+ zix_free(NULL, dirs.scratch);
+ zix_free(NULL, dirs.shared);
free(dirs.top);
}
@@ -194,20 +181,24 @@ get_port_value(const char* port_symbol,
*size = sizeof(float);
*type = ctx->atom_Float;
return &ctx->in;
- } else if (!strcmp(port_symbol, "output")) {
+ }
+
+ if (!strcmp(port_symbol, "output")) {
*size = sizeof(float);
*type = ctx->atom_Float;
return &ctx->out;
- } else if (!strcmp(port_symbol, "control")) {
+ }
+
+ if (!strcmp(port_symbol, "control")) {
*size = sizeof(float);
*type = ctx->atom_Float;
return &ctx->control;
- } else {
- fprintf(
- stderr, "error: get_port_value for nonexistent port `%s'\n", port_symbol);
- *size = *type = 0;
- return NULL;
}
+
+ fprintf(
+ stderr, "error: get_port_value for nonexistent port `%s'\n", port_symbol);
+ *size = *type = 0;
+ return NULL;
}
static void
@@ -237,18 +228,16 @@ set_port_value(const char* port_symbol,
static char*
make_scratch_path(LV2_State_Make_Path_Handle handle, const char* path)
{
- TestDirectories* dirs = (TestDirectories*)handle;
+ const TestDirectories* dirs = (TestDirectories*)handle;
- return lilv_path_join(dirs->scratch, path);
+ return zix_path_join(NULL, dirs->scratch, path);
}
static const LilvPlugin*
load_test_plugin(const TestContext* const ctx)
{
LilvWorld* world = ctx->env->world;
- uint8_t* abs_bundle = (uint8_t*)lilv_path_absolute(LILV_TEST_BUNDLE);
- 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, LILV_TEST_BUNDLE);
LilvNode* plugin_uri = lilv_new_uri(world, TEST_PLUGIN_URI);
lilv_world_load_bundle(world, bundle_uri);
@@ -258,8 +247,6 @@ load_test_plugin(const TestContext* const ctx)
lilv_node_free(plugin_uri);
lilv_node_free(bundle_uri);
- serd_node_free(&bundle);
- free(abs_bundle);
assert(plugin);
return plugin;
@@ -565,7 +552,8 @@ count_statements(const char* path)
SerdNode uri = serd_node_new_file_uri((const uint8_t*)path, NULL, NULL, true);
- assert(!serd_reader_read_file(reader, uri.buf));
+ assert(uri.buf);
+ assert(!serd_reader_read_file(reader, (const uint8_t*)uri.buf));
serd_node_free(&uri);
serd_reader_free(reader);
@@ -601,11 +589,11 @@ test_to_files(void)
assert(ctx->out == 1.0);
// Check that the test plugin has made its recording scratch file
- char* const recfile_path = lilv_path_join(dirs.scratch, "recfile");
- assert(lilv_path_exists(recfile_path));
+ char* const recfile_path = zix_path_join(NULL, dirs.scratch, "recfile");
+ assert(zix_file_type(recfile_path) == ZIX_FILE_TYPE_REGULAR);
// Get state
- char* const bundle_1_path = lilv_path_join(dirs.top, "state1.lv2");
+ char* const bundle_1_path = zix_path_join(NULL, dirs.top, "state1.lv2");
LilvState* const state_1 =
state_from_instance(plugin, instance, ctx, &dirs, bundle_1_path);
@@ -613,8 +601,8 @@ test_to_files(void)
assert(lilv_state_get_num_properties(state_1) == 10);
// Check that a snapshop of the recfile was created
- char* const recfile_copy_1 = lilv_path_join(dirs.copy, "recfile");
- assert(lilv_path_exists(recfile_copy_1));
+ char* const recfile_copy_1 = zix_path_join(NULL, dirs.copy, "recfile");
+ assert(zix_file_type(recfile_copy_1) == ZIX_FILE_TYPE_REGULAR);
// Save state to a bundle
assert(!lilv_state_save(ctx->env->world,
@@ -626,24 +614,28 @@ test_to_files(void)
"state.ttl"));
// Check that a manifest exists
- char* const manifest_path = lilv_path_join(bundle_1_path, "manifest.ttl");
- assert(lilv_path_exists(manifest_path));
+ char* const manifest_path =
+ zix_path_join(NULL, bundle_1_path, "manifest.ttl");
+ assert(zix_file_type(manifest_path) == ZIX_FILE_TYPE_REGULAR);
// Check that the expected statements are in the manifest file
assert(count_statements(manifest_path) == 3);
// Check that a link to the recfile exists in the saved bundle
- char* const recfile_link_1 = lilv_path_join(bundle_1_path, "recfile");
- assert(lilv_path_exists(recfile_link_1));
+ char* const recfile_link_1 = zix_path_join(NULL, bundle_1_path, "recfile");
+ assert(zix_file_type(recfile_link_1) == ZIX_FILE_TYPE_REGULAR);
+#ifndef _WIN32
+ assert(zix_symlink_type(recfile_link_1) == ZIX_FILE_TYPE_SYMLINK);
+#endif
// Check that link points to the corresponding copy
- assert(lilv_file_equals(recfile_link_1, recfile_copy_1));
+ assert(zix_file_equals(NULL, recfile_link_1, recfile_copy_1));
// Run plugin again to modify recording file data
lilv_instance_run(instance, 2);
// Get updated state
- char* const bundle_2_path = lilv_path_join(dirs.top, "state2.lv2");
+ char* const bundle_2_path = zix_path_join(NULL, dirs.top, "state2.lv2");
LilvState* const state_2 =
state_from_instance(plugin, instance, ctx, &dirs, bundle_2_path);
@@ -657,33 +649,36 @@ test_to_files(void)
"state.ttl"));
// Check that a new snapshop of the recfile was created
- char* const recfile_copy_2 = lilv_path_join(dirs.copy, "recfile.2");
- assert(lilv_path_exists(recfile_copy_2));
+ char* const recfile_copy_2 = zix_path_join(NULL, dirs.copy, "recfile.2");
+ assert(zix_file_type(recfile_copy_2) == ZIX_FILE_TYPE_REGULAR);
// Check that a link to the recfile exists in the updated bundle
- char* const recfile_link_2 = lilv_path_join(bundle_2_path, "recfile");
- assert(lilv_path_exists(recfile_link_2));
+ char* const recfile_link_2 = zix_path_join(NULL, bundle_2_path, "recfile");
+ assert(zix_file_type(recfile_link_2) == ZIX_FILE_TYPE_REGULAR);
+#ifndef _WIN32
+ assert(zix_symlink_type(recfile_link_2) == ZIX_FILE_TYPE_SYMLINK);
+#endif
// Check that link points to the corresponding copy
- assert(lilv_file_equals(recfile_link_2, recfile_copy_2));
+ assert(zix_file_equals(NULL, recfile_link_2, recfile_copy_2));
lilv_instance_free(instance);
- lilv_dir_for_each(bundle_2_path, NULL, remove_file);
- lilv_dir_for_each(bundle_1_path, NULL, remove_file);
- assert(!lilv_remove(bundle_2_path));
- assert(!lilv_remove(bundle_1_path));
+ zix_dir_for_each(bundle_2_path, NULL, remove_file);
+ zix_dir_for_each(bundle_1_path, NULL, remove_file);
+ assert(!zix_remove(bundle_2_path));
+ assert(!zix_remove(bundle_1_path));
cleanup_test_directories(dirs);
- free(recfile_link_2);
- free(recfile_copy_2);
+ zix_free(NULL, recfile_link_2);
+ zix_free(NULL, recfile_copy_2);
lilv_state_free(state_2);
- free(bundle_2_path);
- free(recfile_link_1);
- free(manifest_path);
- free(recfile_copy_1);
+ zix_free(NULL, bundle_2_path);
+ zix_free(NULL, recfile_link_1);
+ zix_free(NULL, manifest_path);
+ zix_free(NULL, recfile_copy_1);
lilv_state_free(state_1);
- free(bundle_1_path);
- free(recfile_path);
+ zix_free(NULL, bundle_1_path);
+ zix_free(NULL, recfile_path);
test_context_free(ctx);
}
@@ -706,7 +701,7 @@ test_multi_save(void)
assert(instance);
// Get state
- char* const bundle_1_path = lilv_path_join(dirs.top, "state1.lv2");
+ char* const bundle_1_path = zix_path_join(NULL, dirs.top, "state1.lv2");
LilvState* const state_1 =
state_from_instance(plugin, instance, ctx, &dirs, bundle_1_path);
@@ -720,12 +715,13 @@ test_multi_save(void)
"state.ttl"));
// Check that a manifest exists
- char* const manifest_path = lilv_path_join(bundle_1_path, "manifest.ttl");
- assert(lilv_path_exists(manifest_path));
+ char* const manifest_path =
+ zix_path_join(NULL, bundle_1_path, "manifest.ttl");
+ assert(zix_file_type(manifest_path) == ZIX_FILE_TYPE_REGULAR);
// Check that the state file exists
- char* const state_path = lilv_path_join(bundle_1_path, "state.ttl");
- assert(lilv_path_exists(state_path));
+ char* const state_path = zix_path_join(NULL, bundle_1_path, "state.ttl");
+ assert(zix_file_type(state_path) == ZIX_FILE_TYPE_REGULAR);
// Check that the expected statements are in the files
assert(count_statements(manifest_path) == 3);
@@ -741,14 +737,14 @@ test_multi_save(void)
"state.ttl"));
// Check that everything is the same
- assert(lilv_path_exists(manifest_path));
- assert(lilv_path_exists(state_path));
+ assert(zix_file_type(manifest_path) == ZIX_FILE_TYPE_REGULAR);
+ assert(zix_file_type(state_path) == ZIX_FILE_TYPE_REGULAR);
assert(count_statements(manifest_path) == 3);
assert(count_statements(state_path) == 21);
lilv_instance_free(instance);
- lilv_dir_for_each(bundle_1_path, NULL, remove_file);
- lilv_remove(bundle_1_path);
+ zix_dir_for_each(bundle_1_path, NULL, remove_file);
+ assert(!zix_remove(bundle_1_path));
cleanup_test_directories(dirs);
free(state_path);
@@ -786,7 +782,7 @@ test_files_round_trip(void)
assert(ctx->out == 1.0);
// Save first state to a bundle
- char* const bundle_1_1_path = lilv_path_join(dirs.top, "state1_1.lv2");
+ char* const bundle_1_1_path = zix_path_join(NULL, dirs.top, "state1_1.lv2");
LilvState* const state_1_1 =
state_from_instance(plugin, instance, ctx, &dirs, bundle_1_1_path);
@@ -799,7 +795,7 @@ test_files_round_trip(void)
"state.ttl"));
// Save first state to another bundle
- char* const bundle_1_2_path = lilv_path_join(dirs.top, "state1_2.lv2");
+ char* const bundle_1_2_path = zix_path_join(NULL, dirs.top, "state1_2.lv2");
LilvState* const state_1_2 =
state_from_instance(plugin, instance, ctx, &dirs, bundle_1_2_path);
@@ -812,8 +808,10 @@ test_files_round_trip(void)
"state.ttl"));
// Load both first state bundles and check that the results are equal
- char* const state_1_1_path = lilv_path_join(bundle_1_1_path, "state.ttl");
- char* const state_1_2_path = lilv_path_join(bundle_1_2_path, "state.ttl");
+ char* const state_1_1_path =
+ zix_path_join(NULL, bundle_1_1_path, "state.ttl");
+ char* const state_1_2_path =
+ zix_path_join(NULL, bundle_1_2_path, "state.ttl");
LilvState* state_1_1_loaded =
lilv_state_new_from_file(ctx->env->world, &ctx->map, NULL, state_1_1_path);
@@ -829,7 +827,7 @@ test_files_round_trip(void)
lilv_instance_run(instance, 2);
// Save updated state to a bundle
- char* const bundle_2_path = lilv_path_join(dirs.top, "state2.lv2");
+ char* const bundle_2_path = zix_path_join(NULL, dirs.top, "state2.lv2");
LilvState* const state_2 =
state_from_instance(plugin, instance, ctx, &dirs, bundle_2_path);
@@ -842,7 +840,7 @@ test_files_round_trip(void)
"state.ttl"));
// Load updated state bundle and check that it differs from the others
- char* const state_2_path = lilv_path_join(bundle_2_path, "state.ttl");
+ char* const state_2_path = zix_path_join(NULL, bundle_2_path, "state.ttl");
LilvState* state_2_loaded =
lilv_state_new_from_file(ctx->env->world, &ctx->map, NULL, state_2_path);
@@ -851,12 +849,12 @@ test_files_round_trip(void)
assert(!lilv_state_equals(state_1_1_loaded, state_2_loaded));
lilv_instance_free(instance);
- lilv_dir_for_each(bundle_1_1_path, NULL, remove_file);
- lilv_dir_for_each(bundle_1_2_path, NULL, remove_file);
- lilv_dir_for_each(bundle_2_path, NULL, remove_file);
- lilv_remove(bundle_1_1_path);
- lilv_remove(bundle_1_2_path);
- lilv_remove(bundle_2_path);
+ zix_dir_for_each(bundle_1_1_path, NULL, remove_file);
+ zix_dir_for_each(bundle_1_2_path, NULL, remove_file);
+ zix_dir_for_each(bundle_2_path, NULL, remove_file);
+ assert(!zix_remove(bundle_1_1_path));
+ assert(!zix_remove(bundle_1_2_path));
+ assert(!zix_remove(bundle_2_path));
cleanup_test_directories(dirs);
lilv_state_free(state_2_loaded);
@@ -904,7 +902,7 @@ test_world_round_trip(void)
assert(ctx->out == 1.0);
// Save state to a bundle
- char* const bundle_path = lilv_path_join(dirs.top, "state.lv2/");
+ char* const bundle_path = zix_path_join(NULL, dirs.top, "state.lv2/");
LilvState* const start_state =
state_from_instance(plugin, instance, ctx, &dirs, bundle_path);
@@ -969,7 +967,7 @@ test_label_round_trip(void)
lilv_state_set_label(state, "Monopoly on violence");
// Save to a bundle
- char* const bundle_path = lilv_path_join(dirs.top, "state.lv2/");
+ char* const bundle_path = zix_path_join(NULL, dirs.top, "state.lv2/");
assert(!lilv_state_save(ctx->env->world,
&ctx->map,
&ctx->unmap,
@@ -979,7 +977,7 @@ test_label_round_trip(void)
"state.ttl"));
// Load bundle and check the label and that the states are equal
- char* const state_path = lilv_path_join(bundle_path, "state.ttl");
+ char* const state_path = zix_path_join(NULL, bundle_path, "state.ttl");
LilvState* const loaded =
lilv_state_new_from_file(ctx->env->world, &ctx->map, NULL, state_path);
@@ -1005,12 +1003,12 @@ test_bad_subject(void)
TestContext* const ctx = test_context_new();
LilvNode* const string = lilv_new_string(ctx->env->world, "Not a URI");
- LilvState* const file_state = lilv_state_new_from_file(
+ const LilvState* const file_state = lilv_state_new_from_file(
ctx->env->world, &ctx->map, string, "/I/do/not/matter");
assert(!file_state);
- LilvState* const world_state =
+ const LilvState* const world_state =
lilv_state_new_from_world(ctx->env->world, &ctx->map, string);
assert(!world_state);
@@ -1020,6 +1018,18 @@ test_bad_subject(void)
}
static void
+test_missing_path(void)
+{
+ TestContext* const ctx = test_context_new();
+ const LilvState* const state = lilv_state_new_from_file(
+ ctx->env->world, &ctx->map, NULL, "/does/not/exist");
+
+ assert(!state);
+
+ test_context_free(ctx);
+}
+
+static void
count_file(const char* path, const char* name, void* data)
{
(void)path;
@@ -1056,7 +1066,7 @@ test_delete(void)
assert(ctx->out == 1.0);
// Save state to a bundle
- char* const bundle_path = lilv_path_join(dirs.top, "state.lv2/");
+ char* const bundle_path = zix_path_join(NULL, dirs.top, "state.lv2/");
LilvState* const state =
state_from_instance(plugin, instance, ctx, &dirs, bundle_path);
@@ -1070,7 +1080,7 @@ test_delete(void)
// Count the number of shared files before doing anything
unsigned n_shared_files_before = 0;
- lilv_dir_for_each(dirs.shared, &n_shared_files_before, count_file);
+ zix_dir_for_each(dirs.shared, &n_shared_files_before, count_file);
lilv_instance_free(instance);
@@ -1079,11 +1089,11 @@ test_delete(void)
// Ensure the number of shared files is the same after deletion
unsigned n_shared_files_after = 0;
- lilv_dir_for_each(dirs.shared, &n_shared_files_after, count_file);
+ zix_dir_for_each(dirs.shared, &n_shared_files_after, count_file);
assert(n_shared_files_before == n_shared_files_after);
// Ensure the state directory has been deleted
- assert(!lilv_path_exists(bundle_path));
+ assert(zix_file_type(bundle_path) == ZIX_FILE_TYPE_NONE);
cleanup_test_directories(dirs);
@@ -1107,6 +1117,7 @@ main(void)
test_world_round_trip();
test_label_round_trip();
test_bad_subject();
+ test_missing_path();
test_delete();
return 0;
diff --git a/test/test_string.c b/test/test_string.c
deleted file mode 100644
index 2d610bb..0000000
--- a/test/test_string.c
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- Copyright 2007-2020 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.
-*/
-
-#define _POSIX_C_SOURCE 200809L /* for setenv */
-
-#undef NDEBUG
-
-#include "../src/lilv_internal.h"
-
-#ifdef _WIN32
-# include <windows.h>
-# define setenv(n, v, r) SetEnvironmentVariable((n), (v))
-# define unsetenv(n) SetEnvironmentVariable((n), NULL)
-#endif
-
-#include <assert.h>
-#include <stdlib.h>
-#include <string.h>
-
-int
-main(void)
-{
-#ifndef _WIN32
- char* s = NULL;
-
- setenv("LILV_TEST_1", "test", 1);
- char* home_foo = lilv_strjoin(getenv("HOME"), "/foo", NULL);
- assert(!strcmp((s = lilv_expand("$LILV_TEST_1")), "test"));
- free(s);
- assert(!strcmp((s = lilv_expand("~")), getenv("HOME")));
- free(s);
- assert(!strcmp((s = lilv_expand("~foo")), "~foo"));
- free(s);
- assert(!strcmp((s = lilv_expand("~/foo")), home_foo));
- free(s);
- assert(!strcmp((s = lilv_expand("$NOT_A_VAR")), "$NOT_A_VAR"));
- free(s);
- free(home_foo);
- unsetenv("LILV_TEST_1");
-#endif
-
- return 0;
-}
diff --git a/test/test_ui.c b/test/test_ui.c
index d14f54f..73b32fe 100644
--- a/test/test_ui.c
+++ b/test/test_ui.c
@@ -1,24 +1,11 @@
-/*
- Copyright 2007-2020 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.
-*/
+// Copyright 2007-2020 David Robillard <d@drobilla.net>
+// SPDX-License-Identifier: ISC
#undef NDEBUG
#include "lilv_test_utils.h"
-#include "lilv/lilv.h"
+#include <lilv/lilv.h>
#include <assert.h>
#include <stdio.h>
diff --git a/test/test_util.c b/test/test_util.c
index 8c8f36a..3063aa7 100644
--- a/test/test_util.c
+++ b/test/test_util.c
@@ -1,67 +1,40 @@
-/*
- Copyright 2007-2020 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.
-*/
-
-#define _XOPEN_SOURCE 600 /* for mkstemp */
+// Copyright 2007-2022 David Robillard <d@drobilla.net>
+// SPDX-License-Identifier: ISC
#undef NDEBUG
-#ifdef _WIN32
-# include "lilv_internal.h"
-#endif
+#include "lilv_test_utils.h"
-#include "../src/filesystem.h"
-
-#ifdef _WIN32
-# include <io.h>
-# define mkstemp(pat) _mktemp(pat)
-#endif
+#include <lilv/lilv.h>
+#include <zix/filesystem.h>
+#include <zix/path.h>
#include <assert.h>
#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
int
main(void)
{
- assert(!lilv_path_canonical(NULL));
+ char* const dir = lilv_create_temporary_directory("lilv_test_util_XXXXXX");
- char a_path[16];
- char b_path[16];
- strncpy(a_path, "copy_a_XXXXXX", sizeof(a_path));
- strncpy(b_path, "copy_b_XXXXXX", sizeof(b_path));
- mkstemp(a_path);
- mkstemp(b_path);
+ char* const a_path = zix_path_join(NULL, dir, "copy_a_XXXXXX");
+ char* const b_path = zix_path_join(NULL, dir, "copy_b_XXXXXX");
- FILE* fa = fopen(a_path, "w");
- FILE* fb = fopen(b_path, "w");
+ FILE* const fa = fopen(a_path, "w");
+ FILE* const fb = fopen(b_path, "w");
+ assert(fa);
+ assert(fb);
fprintf(fa, "AA\n");
fprintf(fb, "AB\n");
- fclose(fa);
fclose(fb);
+ fclose(fa);
- assert(lilv_copy_file("does/not/exist", "copy"));
- assert(lilv_copy_file(a_path, "not/a/dir/copy"));
- assert(!lilv_copy_file(a_path, "copy_c"));
- assert(!lilv_file_equals(a_path, b_path));
- assert(lilv_file_equals(a_path, a_path));
- assert(lilv_file_equals(a_path, "copy_c"));
- assert(!lilv_file_equals("does/not/exist", b_path));
- assert(!lilv_file_equals(a_path, "does/not/exist"));
- assert(!lilv_file_equals("does/not/exist", "/does/not/either"));
+ assert(!zix_remove(a_path));
+ assert(!zix_remove(b_path));
+ assert(!zix_remove(dir));
+ lilv_free(b_path);
+ lilv_free(a_path);
+ lilv_free(dir);
return 0;
}
diff --git a/test/test_value.c b/test/test_value.c
index 8061029..90d167d 100644
--- a/test/test_value.c
+++ b/test/test_value.c
@@ -1,24 +1,11 @@
-/*
- Copyright 2007-2020 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.
-*/
+// Copyright 2007-2020 David Robillard <d@drobilla.net>
+// SPDX-License-Identifier: ISC
#undef NDEBUG
#include "lilv_test_utils.h"
-#include "lilv/lilv.h"
+#include <lilv/lilv.h>
#include <assert.h>
#include <float.h>
@@ -146,7 +133,7 @@ main(void)
assert(!lilv_node_equals(ival, ifval));
lilv_node_free(ifval);
- LilvNode* nil = NULL;
+ const LilvNode* nil = NULL;
assert(!lilv_node_equals(uval, nil));
assert(!lilv_node_equals(nil, uval));
assert(lilv_node_equals(nil, nil));
diff --git a/test/test_verify.c b/test/test_verify.c
index d20712e..55149c5 100644
--- a/test/test_verify.c
+++ b/test/test_verify.c
@@ -1,24 +1,11 @@
-/*
- Copyright 2007-2020 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.
-*/
+// Copyright 2007-2020 David Robillard <d@drobilla.net>
+// SPDX-License-Identifier: ISC
#undef NDEBUG
#include "lilv_test_utils.h"
-#include "lilv/lilv.h"
+#include <lilv/lilv.h>
#include <assert.h>
@@ -36,8 +23,8 @@ static const char* const plugin_ttl = "\
int
main(void)
{
- LilvTestEnv* const env = lilv_test_env_new();
- LilvWorld* const world = env->world;
+ LilvTestEnv* const env = lilv_test_env_new();
+ const LilvWorld* const world = env->world;
if (create_bundle(env, "verify.lv2", SIMPLE_MANIFEST_TTL, plugin_ttl)) {
return 1;
diff --git a/test/test_world.c b/test/test_world.c
index 762907f..29bfeaf 100644
--- a/test/test_world.c
+++ b/test/test_world.c
@@ -1,24 +1,11 @@
-/*
- Copyright 2007-2020 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.
-*/
+// Copyright 2007-2020 David Robillard <d@drobilla.net>
+// SPDX-License-Identifier: ISC
#undef NDEBUG
#include "lilv_test_utils.h"
-#include "lilv/lilv.h"
+#include <lilv/lilv.h>
#include <assert.h>
#include <stddef.h>
@@ -32,7 +19,7 @@ main(void)
LilvNode* num = lilv_new_int(env->world, 4);
LilvNode* uri = lilv_new_uri(env->world, "http://example.org/object");
- LilvNodes* matches = lilv_world_find_nodes(world, num, NULL, NULL);
+ const LilvNodes* matches = lilv_world_find_nodes(world, num, NULL, NULL);
assert(!matches);
matches = lilv_world_find_nodes(world, NULL, num, NULL);