aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2022-07-07 18:59:06 -0400
committerDavid Robillard <d@drobilla.net>2022-07-17 18:13:53 -0400
commitd4a970f6962dda28133290194832b726b566ddab (patch)
treecfe9747042d55388705371a8ce95505ffb702470 /test
parent7f3a2651a3635232d94f7bf9ce23d6b575735732 (diff)
downloadlv2-d4a970f6962dda28133290194832b726b566ddab.tar.xz
Switch to meson build system
Diffstat (limited to 'test')
-rw-r--r--test/.clang-tidy15
-rw-r--r--test/meson.build110
-rw-r--r--test/test_build.c52
-rw-r--r--test/test_build.cpp67
4 files changed, 244 insertions, 0 deletions
diff --git a/test/.clang-tidy b/test/.clang-tidy
new file mode 100644
index 0000000..7846913
--- /dev/null
+++ b/test/.clang-tidy
@@ -0,0 +1,15 @@
+Checks: >
+ *,
+ -*-magic-numbers,
+ -*-uppercase-literal-suffix,
+ -altera-*,
+ -bugprone-easily-swappable-parameters,
+ -bugprone-macro-parentheses,
+ -llvm-header-guard,
+ -llvmlibc-implementation-in-namespace,
+ -llvmlibc-restrict-system-libc-headers,
+ -modernize-use-trailing-return-type,
+ -performance-no-int-to-ptr,
+WarningsAsErrors: '*'
+HeaderFilterRegex: '.*'
+FormatStyle: file
diff --git a/test/meson.build b/test/meson.build
new file mode 100644
index 0000000..0b8339a
--- /dev/null
+++ b/test/meson.build
@@ -0,0 +1,110 @@
+# Copyright 2022 David Robillard <d@drobilla.net>
+# SPDX-License-Identifier: CC0-1.0 OR ISC
+
+########
+# Data #
+########
+
+# Check for spelling errors
+codespell = find_program('codespell', required: get_option('tests'))
+if codespell.found()
+ ignore = [
+ lv2_source_root / 'doc' / 'pygments.css',
+ lv2_source_root / 'lv2specgen' / 'DTD',
+ lv2_source_root / 'schemas.lv2' / 'doap.ttl',
+ ]
+
+ test(
+ 'codespell',
+ codespell,
+ args: [
+ '-d',
+ '-q', '3',
+ '-S', ','.join(ignore),
+ lv2_source_root / 'doc',
+ lv2_source_root / 'lv2',
+ lv2_source_root / 'lv2specgen',
+ lv2_source_root / 'plugins',
+ lv2_source_root / 'schemas.lv2',
+ ],
+ suite: 'data',
+ )
+endif
+
+# Check that specification data is strictly formatted
+serdi = find_program('serdi', required: get_option('tests'))
+if serdi.found()
+ lv2_check_syntax = files(lv2_source_root / 'scripts' / 'lv2_check_syntax.py')
+
+ test('syntax',
+ lv2_check_syntax,
+ args: ['--serdi', serdi.full_path()] + spec_files + schema_data,
+ suite: 'data')
+endif
+
+# Check that specification data validates
+sord_validate = find_program('sord_validate', required: get_option('tests'))
+if sord_validate.found()
+ test('valid',
+ sord_validate,
+ args: spec_files + schema_data,
+ suite: 'data')
+endif
+
+########
+# Code #
+########
+
+# Check that all the headers compile cleanly in C
+test('c',
+ executable(
+ 'test_build_c',
+ files('test_build.c'),
+ c_args: c_suppressions,
+ dependencies: lv2_dep,
+ ),
+ suite: 'build')
+
+# Check that all the headers compile cleanly in C++
+if is_variable('cpp')
+ test('cpp',
+ executable(
+ 'test_build_cpp',
+ files('test_build.cpp'),
+ cpp_args: cpp_suppressions,
+ dependencies: lv2_dep,
+ ),
+ suite: 'build')
+endif
+
+##########
+# Python #
+##########
+
+flake8 = find_program('flake8', required: get_option('tests'))
+pylint = find_program('pylint', required: get_option('tests'))
+black = find_program('black', required: get_option('tests'))
+
+# Scripts that don't pass with pylint
+lax_python_scripts = files(
+ '../lv2specgen/lv2docgen.py',
+ '../lv2specgen/lv2specgen.py',
+)
+
+# Scripts that pass with everything including pylint
+strict_python_scripts = lv2_scripts + files('../plugins/literasc.py')
+
+all_python_scripts = lax_python_scripts + strict_python_scripts
+
+if is_variable('black') and black.found()
+ black_opts = ['-l', '79', '-q', '--check']
+ test('black', black, args: black_opts + all_python_scripts, suite: 'scripts')
+endif
+
+if is_variable('flake8') and flake8.found()
+ test('flake8', flake8, args: all_python_scripts, suite: 'scripts')
+endif
+
+if is_variable('pylint') and pylint.found()
+ test('pylint', pylint, args: strict_python_scripts, suite: 'scripts')
+endif
diff --git a/test/test_build.c b/test/test_build.c
new file mode 100644
index 0000000..146ad71
--- /dev/null
+++ b/test/test_build.c
@@ -0,0 +1,52 @@
+/*
+ Copyright 2022 David Robillard <d@drobilla.net>
+
+ Permission to use, copy, modify, and/or distribute this software for any
+ purpose with or without fee is hereby granted, provided that the above
+ copyright notice and this permission notice appear in all copies.
+
+ THIS SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+*/
+
+#include "lv2/atom/atom.h" // IWYU pragma: keep
+#include "lv2/atom/forge.h" // IWYU pragma: keep
+#include "lv2/atom/util.h" // IWYU pragma: keep
+#include "lv2/buf-size/buf-size.h" // IWYU pragma: keep
+#include "lv2/core/attributes.h" // IWYU pragma: keep
+#include "lv2/core/lv2.h" // IWYU pragma: keep
+#include "lv2/core/lv2_util.h" // IWYU pragma: keep
+#include "lv2/data-access/data-access.h" // IWYU pragma: keep
+#include "lv2/dynmanifest/dynmanifest.h" // IWYU pragma: keep
+#include "lv2/event/event-helpers.h" // IWYU pragma: keep
+#include "lv2/event/event.h" // IWYU pragma: keep
+#include "lv2/instance-access/instance-access.h" // IWYU pragma: keep
+#include "lv2/log/log.h" // IWYU pragma: keep
+#include "lv2/log/logger.h" // IWYU pragma: keep
+#include "lv2/midi/midi.h" // IWYU pragma: keep
+#include "lv2/morph/morph.h" // IWYU pragma: keep
+#include "lv2/options/options.h" // IWYU pragma: keep
+#include "lv2/parameters/parameters.h" // IWYU pragma: keep
+#include "lv2/patch/patch.h" // IWYU pragma: keep
+#include "lv2/port-groups/port-groups.h" // IWYU pragma: keep
+#include "lv2/port-props/port-props.h" // IWYU pragma: keep
+#include "lv2/presets/presets.h" // IWYU pragma: keep
+#include "lv2/resize-port/resize-port.h" // IWYU pragma: keep
+#include "lv2/state/state.h" // IWYU pragma: keep
+#include "lv2/time/time.h" // IWYU pragma: keep
+#include "lv2/ui/ui.h" // IWYU pragma: keep
+#include "lv2/units/units.h" // IWYU pragma: keep
+#include "lv2/uri-map/uri-map.h" // IWYU pragma: keep
+#include "lv2/urid/urid.h" // IWYU pragma: keep
+#include "lv2/worker/worker.h" // IWYU pragma: keep
+
+int
+main(void)
+{
+ return 0;
+}
diff --git a/test/test_build.cpp b/test/test_build.cpp
new file mode 100644
index 0000000..dc269a6
--- /dev/null
+++ b/test/test_build.cpp
@@ -0,0 +1,67 @@
+/*
+ Copyright 2022 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.
+*/
+
+#if defined(__clang__)
+_Pragma("clang diagnostic push")
+_Pragma("clang diagnostic ignored \"-Wold-style-cast\"")
+_Pragma("clang diagnostic ignored \"-Wzero-as-null-pointer-constant\"")
+#elif defined(__GNUC__)
+_Pragma("GCC diagnostic push")
+_Pragma("GCC diagnostic ignored \"-Wsuggest-attribute=const\"")
+#endif
+
+#include "lv2/atom/atom.h" // IWYU pragma: keep
+#include "lv2/atom/forge.h" // IWYU pragma: keep
+#include "lv2/atom/util.h" // IWYU pragma: keep
+#include "lv2/buf-size/buf-size.h" // IWYU pragma: keep
+#include "lv2/core/attributes.h" // IWYU pragma: keep
+#include "lv2/core/lv2.h" // IWYU pragma: keep
+#include "lv2/core/lv2_util.h" // IWYU pragma: keep
+#include "lv2/data-access/data-access.h" // IWYU pragma: keep
+#include "lv2/dynmanifest/dynmanifest.h" // IWYU pragma: keep
+#include "lv2/event/event-helpers.h" // IWYU pragma: keep
+#include "lv2/event/event.h" // IWYU pragma: keep
+#include "lv2/instance-access/instance-access.h" // IWYU pragma: keep
+#include "lv2/log/log.h" // IWYU pragma: keep
+#include "lv2/log/logger.h" // IWYU pragma: keep
+#include "lv2/midi/midi.h" // IWYU pragma: keep
+#include "lv2/morph/morph.h" // IWYU pragma: keep
+#include "lv2/options/options.h" // IWYU pragma: keep
+#include "lv2/parameters/parameters.h" // IWYU pragma: keep
+#include "lv2/patch/patch.h" // IWYU pragma: keep
+#include "lv2/port-groups/port-groups.h" // IWYU pragma: keep
+#include "lv2/port-props/port-props.h" // IWYU pragma: keep
+#include "lv2/presets/presets.h" // IWYU pragma: keep
+#include "lv2/resize-port/resize-port.h" // IWYU pragma: keep
+#include "lv2/state/state.h" // IWYU pragma: keep
+#include "lv2/time/time.h" // IWYU pragma: keep
+#include "lv2/ui/ui.h" // IWYU pragma: keep
+#include "lv2/units/units.h" // IWYU pragma: keep
+#include "lv2/uri-map/uri-map.h" // IWYU pragma: keep
+#include "lv2/urid/urid.h" // IWYU pragma: keep
+#include "lv2/worker/worker.h" // IWYU pragma: keep
+
+int
+main()
+{
+ return 0;
+}
+
+#if defined(__clang__)
+_Pragma("clang diagnostic pop")
+#elif defined(__GNUC__)
+_Pragma("GCC diagnostic pop")
+#endif