aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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