aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2024-10-06 13:03:14 -0400
committerDavid Robillard <d@drobilla.net>2024-10-06 13:03:14 -0400
commita71df41453f4cb0be273e9dd36000a8791ebde08 (patch)
tree69a5f712408ff8ef64e63d27762021e3c1d22bd1
parent45b1c3aba6661705d08fe4d297317d9dd48ef4d9 (diff)
downloadserd-a71df41453f4cb0be273e9dd36000a8791ebde08.tar.gz
serd-a71df41453f4cb0be273e9dd36000a8791ebde08.tar.bz2
serd-a71df41453f4cb0be273e9dd36000a8791ebde08.zip
Relocate lint test definitions
Towards reusing source lists for checks across all the code (not just the library sources).
-rw-r--r--test/meson.build270
1 files changed, 135 insertions, 135 deletions
diff --git a/test/meson.build b/test/meson.build
index 771158b1..34dd7415 100644
--- a/test/meson.build
+++ b/test/meson.build
@@ -4,141 +4,6 @@
run_suite = find_program('run_suite.py')
wrapper = meson.get_external_property('exe_wrapper', '')
-########################
-# Scripts and Metadata #
-########################
-
-plot_script_paths = [
- '../scripts/serd_bench.py',
-]
-
-simple_script_paths = [
- '../scripts/check_formatting.py',
- 'serd_test_util/__init__.py',
- 'run_suite.py',
- 'test_quiet.py',
- 'test_stdin.py',
- 'test_write_error.py',
-]
-
-ttl_metadata_file_paths = [
- '../serd.ttl',
- 'extra/abbreviate/manifest.ttl',
- 'extra/bad/manifest.ttl',
- 'extra/big/manifest.ttl',
- 'extra/full/manifest.ttl',
- 'extra/good/manifest.ttl',
- 'extra/lax/manifest.ttl',
- 'extra/perfect/manifest.ttl',
- 'extra/prefix/manifest.ttl',
- 'extra/pretty/manifest.ttl',
- 'extra/qualify/manifest.ttl',
- 'extra/root/manifest.ttl',
-]
-
-plot_scripts = files(plot_script_paths)
-simple_scripts = files(simple_script_paths)
-python_script_paths = simple_script_paths + plot_script_paths
-python_scripts = plot_scripts + simple_scripts
-
-if get_option('lint')
- # Check release metadata
- if not meson.is_subproject()
- autoship = find_program('autoship', required: false)
- if autoship.found()
- test('autoship', autoship, args: ['test', serd_src_root], suite: 'data')
- endif
- endif
-
- # Check licensing metadata
- reuse = find_program('reuse', required: false)
- if reuse.found()
- test(
- 'REUSE',
- reuse,
- args: ['--root', serd_src_root, 'lint'],
- suite: 'data',
- )
- endif
-
- # Check code formatting
- clang_format = find_program('clang-format', required: false)
- if clang_format.found()
- test(
- 'format',
- clang_format,
- args: ['--Werror', '--dry-run'] + c_headers + sources,
- suite: 'code',
- )
- endif
-
- # Check code with cppcheck
- if not meson.is_subproject()
- cppcheck = find_program('cppcheck', required: false)
- if cppcheck.found()
- compdb_path = join_paths(serd_build_root, 'compile_commands.json')
- suppress_path = join_paths(serd_src_root, '.suppress.cppcheck')
- test(
- 'cppcheck',
- cppcheck,
- args: [
- '--enable=warning,style,performance,portability',
- '--error-exitcode=1',
- '--project=' + compdb_path,
- '--suppressions-list=' + suppress_path,
- '-q',
- ],
- suite: 'code',
- )
- endif
- endif
-
- # Check script formatting
- black = find_program('black', required: false)
- if black.found()
- black_opts = ['--check', '-q', '-l', '79']
- foreach script_path : python_script_paths
- script = files(script_path)
- name = script_path.underscorify()
- test(name, black, args: black_opts + [script], suite: 'scripts')
- endforeach
- endif
-
- # Check scripts for errors with flake8
- flake8 = find_program('flake8', required: false)
- if flake8.found()
- test('flake8', flake8, args: python_scripts, suite: 'scripts')
- endif
-
- # Check scripts for errors with pylint
- pylint = find_program('pylint', required: false)
- if pylint.found()
- pymod = import('python')
- plot_py = pymod.find_installation(
- 'python3',
- modules: ['matplotlib'],
- required: false,
- )
-
- pylint_args = ['--disable', 'bad-option-value'] + simple_scripts
- if plot_py.found()
- pylint_args += plot_scripts
- endif
-
- test('pylint', pylint, args: pylint_args, suite: 'scripts')
- endif
-
- # Check Turtle formatting with serdi
- foreach ttl_file_path : ttl_metadata_file_paths
- test(
- ttl_file_path.underscorify(),
- check_formatting_py,
- args: [files(ttl_file_path), serdi, '-o', 'turtle'],
- suite: 'data',
- )
- endforeach
-endif
-
###################
# Header Warnings #
###################
@@ -424,3 +289,138 @@ if is_variable('serdi')
)
endforeach
endif
+
+########
+# Lint #
+########
+
+plot_script_paths = [
+ '../scripts/serd_bench.py',
+]
+
+simple_script_paths = [
+ '../scripts/check_formatting.py',
+ 'serd_test_util/__init__.py',
+ 'run_suite.py',
+ 'test_quiet.py',
+ 'test_stdin.py',
+ 'test_write_error.py',
+]
+
+ttl_metadata_file_paths = [
+ '../serd.ttl',
+ 'extra/abbreviate/manifest.ttl',
+ 'extra/bad/manifest.ttl',
+ 'extra/big/manifest.ttl',
+ 'extra/full/manifest.ttl',
+ 'extra/good/manifest.ttl',
+ 'extra/lax/manifest.ttl',
+ 'extra/perfect/manifest.ttl',
+ 'extra/prefix/manifest.ttl',
+ 'extra/pretty/manifest.ttl',
+ 'extra/qualify/manifest.ttl',
+ 'extra/root/manifest.ttl',
+]
+
+plot_scripts = files(plot_script_paths)
+simple_scripts = files(simple_script_paths)
+python_script_paths = simple_script_paths + plot_script_paths
+python_scripts = plot_scripts + simple_scripts
+
+if get_option('lint')
+ # Check release metadata
+ if not meson.is_subproject()
+ autoship = find_program('autoship', required: false)
+ if autoship.found()
+ test('autoship', autoship, args: ['test', serd_src_root], suite: 'data')
+ endif
+ endif
+
+ # Check licensing metadata
+ reuse = find_program('reuse', required: false)
+ if reuse.found()
+ test(
+ 'REUSE',
+ reuse,
+ args: ['--root', serd_src_root, 'lint'],
+ suite: 'data',
+ )
+ endif
+
+ # Check code formatting
+ clang_format = find_program('clang-format', required: false)
+ if clang_format.found()
+ test(
+ 'format',
+ clang_format,
+ args: ['--Werror', '--dry-run'] + c_headers + sources,
+ suite: 'code',
+ )
+ endif
+
+ # Check code with cppcheck
+ if not meson.is_subproject()
+ cppcheck = find_program('cppcheck', required: false)
+ if cppcheck.found()
+ compdb_path = join_paths(serd_build_root, 'compile_commands.json')
+ suppress_path = join_paths(serd_src_root, '.suppress.cppcheck')
+ test(
+ 'cppcheck',
+ cppcheck,
+ args: [
+ '--enable=warning,style,performance,portability',
+ '--error-exitcode=1',
+ '--project=' + compdb_path,
+ '--suppressions-list=' + suppress_path,
+ '-q',
+ ],
+ suite: 'code',
+ )
+ endif
+ endif
+
+ # Check script formatting
+ black = find_program('black', required: false)
+ if black.found()
+ black_opts = ['--check', '-q', '-l', '79']
+ foreach script_path : python_script_paths
+ script = files(script_path)
+ name = script_path.underscorify()
+ test(name, black, args: black_opts + [script], suite: 'scripts')
+ endforeach
+ endif
+
+ # Check scripts for errors with flake8
+ flake8 = find_program('flake8', required: false)
+ if flake8.found()
+ test('flake8', flake8, args: python_scripts, suite: 'scripts')
+ endif
+
+ # Check scripts for errors with pylint
+ pylint = find_program('pylint', required: false)
+ if pylint.found()
+ pymod = import('python')
+ plot_py = pymod.find_installation(
+ 'python3',
+ modules: ['matplotlib'],
+ required: false,
+ )
+
+ pylint_args = ['--disable', 'bad-option-value'] + simple_scripts
+ if plot_py.found()
+ pylint_args += plot_scripts
+ endif
+
+ test('pylint', pylint, args: pylint_args, suite: 'scripts')
+ endif
+
+ # Check Turtle formatting with serdi
+ foreach ttl_file_path : ttl_metadata_file_paths
+ test(
+ ttl_file_path.underscorify(),
+ check_formatting_py,
+ args: [files(ttl_file_path), serdi, '-o', 'turtle'],
+ suite: 'data',
+ )
+ endforeach
+endif