aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/.clang-tidy7
-rw-r--r--test/cpp/.clang-tidy6
-rw-r--r--test/headers/.clang-tidy6
-rw-r--r--test/headers/meson.build1
-rw-r--r--test/meson.build189
5 files changed, 178 insertions, 31 deletions
diff --git a/test/.clang-tidy b/test/.clang-tidy
index ef4d61f..a622e62 100644
--- a/test/.clang-tidy
+++ b/test/.clang-tidy
@@ -3,14 +3,7 @@
Checks: >
-*-else-after-return,
- -bugprone-easily-swappable-parameters,
- -bugprone-multi-level-implicit-pointer-conversion,
-bugprone-suspicious-include,
- -cert-err33-c,
- -clang-diagnostic-unused-parameter,
- -cppcoreguidelines-avoid-non-const-global-variables,
- -llvmlibc-implementation-in-namespace,
- -misc-unused-parameters,
-modernize-use-trailing-return-type,
-readability-function-cognitive-complexity,
InheritParentConfig: true
diff --git a/test/cpp/.clang-tidy b/test/cpp/.clang-tidy
index 1fe1f27..b7981cc 100644
--- a/test/cpp/.clang-tidy
+++ b/test/cpp/.clang-tidy
@@ -2,10 +2,9 @@
# SPDX-License-Identifier: 0BSD OR ISC
Checks: >
- -*-avoid-c-arrays,
- -*-deprecated-headers,
-*-no-malloc,
-*-use-auto,
+ -*-use-nullptr,
-bugprone-reserved-identifier,
-cert-dcl37-c,
-cert-dcl50-cpp,
@@ -17,10 +16,7 @@ Checks: >
-cppcoreguidelines-pro-type-cstyle-cast,
-cppcoreguidelines-pro-type-vararg,
-hicpp-no-array-decay,
- -hicpp-use-nullptr,
-hicpp-vararg,
- -llvmlibc-callee-namespace,
- -modernize-use-nullptr,
-modernize-use-using,
-performance-enum-size,
-readability-implicit-bool-conversion,
diff --git a/test/headers/.clang-tidy b/test/headers/.clang-tidy
index bf971cc..60c4447 100644
--- a/test/headers/.clang-tidy
+++ b/test/headers/.clang-tidy
@@ -1,4 +1,4 @@
-# Copyright 2020-2024 David Robillard <d@drobilla.net>
+# Copyright 2020-2025 David Robillard <d@drobilla.net>
# SPDX-License-Identifier: 0BSD OR ISC
Checks: >
@@ -6,11 +6,9 @@ Checks: >
-*-macro-to-enum,
-*-magic-numbers,
-altera-*,
- -bugprone-assignment-in-if-condition,
-bugprone-easily-swappable-parameters,
-bugprone-macro-parentheses,
- -llvmlibc-restrict-system-libc-headers,
- -performance-no-int-to-ptr,
+ -llvmlibc-*,
-readability-identifier-length,
CheckOptions:
- key: hicpp-uppercase-literal-suffix.NewSuffixes
diff --git a/test/headers/meson.build b/test/headers/meson.build
index b1ec805..89ee4b8 100644
--- a/test/headers/meson.build
+++ b/test/headers/meson.build
@@ -63,6 +63,7 @@ test(
files('test_headers.c'),
c_args: header_c_suppressions,
dependencies: [lv2_dep],
+ implicit_include_directories: false,
),
suite: 'unit',
)
diff --git a/test/meson.build b/test/meson.build
index 2fec667..7144349 100644
--- a/test/meson.build
+++ b/test/meson.build
@@ -6,6 +6,13 @@
########
if get_option('lint')
+ # Check licensing metadata
+ reuse = find_program('reuse', required: false)
+ if reuse.found()
+ reuse_args = ['--root', lv2_source_root, 'lint']
+ test('REUSE', reuse, args: reuse_args, suite: 'data')
+ endif
+
# Check for spelling errors
codespell = find_program('codespell', required: get_option('tests'))
if codespell.found()
@@ -25,7 +32,6 @@ if get_option('lint')
lv2_source_root / 'doc',
lv2_source_root / 'lv2',
lv2_source_root / 'lv2specgen',
- lv2_source_root / 'plugins',
lv2_source_root / 'schemas.lv2',
],
suite: 'data',
@@ -62,6 +68,163 @@ if get_option('lint')
endif
endif
+#############################
+# Compilers and Build Tools #
+#############################
+
+cc = meson.get_compiler('c')
+
+if add_languages(['cpp'], native: false, required: get_option('tests'))
+ cpp = meson.get_compiler('cpp')
+endif
+
+########################
+# Warning Suppressions #
+########################
+
+warning_level = get_option('warning_level')
+
+# C
+test_c_suppressions = []
+if cc.get_id() in ['clang', 'emscripten']
+ if warning_level == 'everything'
+ test_c_suppressions += [
+ '-Wno-cast-align',
+ '-Wno-cast-qual',
+ '-Wno-declaration-after-statement',
+ '-Wno-documentation-unknown-command',
+ '-Wno-double-promotion',
+ '-Wno-float-equal',
+ '-Wno-padded',
+ '-Wno-reserved-id-macro',
+ '-Wno-unsafe-buffer-usage',
+ ]
+
+ if not meson.is_cross_build()
+ test_c_suppressions += ['-Wno-poison-system-directories']
+ endif
+
+ if host_machine.system() == 'windows'
+ test_c_suppressions += ['-Wno-format-nonliteral']
+ endif
+ endif
+
+ if warning_level in ['everything', '3', '2']
+ test_c_suppressions += ['-Wno-unused-parameter']
+ endif
+
+elif cc.get_id() == 'gcc'
+ if warning_level == 'everything'
+ test_c_suppressions += [
+ '-Wno-cast-align',
+ '-Wno-cast-qual',
+ '-Wno-double-promotion',
+ '-Wno-float-equal',
+ '-Wno-inline',
+ '-Wno-padded',
+ '-Wno-suggest-attribute=const',
+ '-Wno-suggest-attribute=malloc',
+ '-Wno-suggest-attribute=pure',
+ '-Wno-unsuffixed-float-constants',
+ '-Wno-unused-const-variable',
+ ]
+
+ if target_machine.system() == 'windows'
+ test_c_suppressions += [
+ '-Wno-sign-conversion',
+ '-Wno-suggest-attribute=format',
+ ]
+ endif
+ endif
+
+ if warning_level in ['everything', '3', '2']
+ test_c_suppressions += ['-Wno-unused-parameter']
+ endif
+
+elif cc.get_id() == 'msvc'
+ if warning_level == 'everything'
+ test_c_suppressions += [
+ '/wd4061', # enumerator in switch is not explicitly handled
+ '/wd4244', # conversion with possible loss of data
+ '/wd4365', # signed/unsigned mismatch
+ '/wd4514', # unreferenced inline function has been removed
+ '/wd4710', # function not inlined
+ '/wd4711', # function selected for automatic inline expansion
+ '/wd4820', # padding added after construct
+ '/wd5045', # will insert Spectre mitigation for memory load
+ ]
+ endif
+
+ if warning_level in ['everything', '3']
+ test_c_suppressions += [
+ '/wd4100', # unreferenced formal parameter
+ ]
+ endif
+
+ if warning_level in ['everything', '3', '2']
+ test_c_suppressions += [
+ '/wd4267', # conversion from size_t to a smaller type
+ ]
+ endif
+endif
+
+test_c_suppressions = cc.get_supported_arguments(test_c_suppressions)
+
+# C++
+if is_variable('cpp')
+ test_cpp_suppressions = []
+
+ if warning_level == 'everything'
+ if cpp.get_id() in ['clang', 'emscripten']
+ test_cpp_suppressions += [
+ '-Wno-c++98-compat',
+ '-Wno-cast-align',
+ '-Wno-cast-qual',
+ '-Wno-documentation-unknown-command',
+ '-Wno-nullability-extension',
+ '-Wno-padded',
+ '-Wno-reserved-id-macro',
+ '-Wno-unsafe-buffer-usage',
+ ]
+
+ if not meson.is_cross_build()
+ test_cpp_suppressions += ['-Wno-poison-system-directories']
+ endif
+
+ if host_machine.system() == 'windows'
+ test_cpp_suppressions += ['-Wno-format-nonliteral']
+ endif
+
+ elif cpp.get_id() == 'gcc'
+ test_cpp_suppressions += [
+ '-Wno-cast-align',
+ '-Wno-cast-qual',
+ '-Wno-inline',
+ '-Wno-padded',
+ '-Wno-unused-const-variable',
+ '-Wno-useless-cast',
+ ]
+
+ if target_machine.system() == 'windows'
+ test_cpp_suppressions += ['-Wno-suggest-attribute=format']
+ endif
+
+ elif cpp.get_id() == 'msvc'
+ test_cpp_suppressions += [
+ '/wd4514', # unreferenced inline function has been removed
+ '/wd4706', # assignment within conditional expression
+ '/wd4710', # function not inlined
+ '/wd4711', # function selected for automatic inline expansion
+ '/wd4820', # padding added after data member
+ '/wd5045', # will insert Spectre mitigation
+ '/wd5264', # const variable is not used
+ ]
+ endif
+ endif
+
+ test_cpp_suppressions = cpp.get_supported_arguments(test_cpp_suppressions)
+endif
+
########
# Code #
########
@@ -72,8 +235,9 @@ test(
executable(
'test_build_c',
files('test_build.c'),
- c_args: c_suppressions,
+ c_args: test_c_suppressions,
dependencies: [lv2_dep],
+ implicit_include_directories: false,
),
suite: 'build',
)
@@ -85,8 +249,9 @@ if is_variable('cpp')
executable(
'test_build_cpp',
files('cpp/test_build.cpp'),
- cpp_args: cpp_suppressions,
+ cpp_args: test_cpp_suppressions,
dependencies: [lv2_dep],
+ implicit_include_directories: false,
),
suite: 'build',
)
@@ -97,17 +262,11 @@ endif
##########
if get_option('lint')
- # Scripts that don't pass with pylint
- lax_python_scripts = files(
+ python_scripts = lv2_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
-
# Check script formatting
black = find_program('black', required: get_option('tests'))
if black.found()
@@ -115,7 +274,7 @@ if get_option('lint')
test(
'black',
black,
- args: black_opts + all_python_scripts,
+ args: black_opts + python_scripts,
suite: 'scripts',
)
endif
@@ -123,13 +282,12 @@ if get_option('lint')
# Check scripts for errors with flake8
flake8 = find_program('flake8', required: get_option('tests'))
if flake8.found()
- test('flake8', flake8, args: all_python_scripts, suite: 'scripts')
+ test('flake8', flake8, args: python_scripts, suite: 'scripts')
endif
# Check scripts for errors with pylint
pylint = find_program('pylint', required: get_option('tests'))
if pylint.found()
- pymod = import('python')
lint_py = pymod.find_installation(
'python3',
modules: ['pygments', 'rdflib'],
@@ -137,7 +295,7 @@ if get_option('lint')
)
if lint_py.found()
- test('pylint', pylint, args: strict_python_scripts, suite: 'scripts')
+ test('pylint', pylint, args: python_scripts, suite: 'scripts')
endif
endif
endif
@@ -169,8 +327,9 @@ foreach test_name : test_names
executable(
test_name,
files('test_@0@.c'.format(test_name)),
- c_args: c_suppressions + atom_test_suppressions,
+ c_args: test_c_suppressions + atom_test_suppressions,
dependencies: [lv2_dep],
+ implicit_include_directories: false,
),
suite: 'unit',
)