diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/headers/meson.build | 2 | ||||
-rw-r--r-- | test/meson.build | 115 |
2 files changed, 65 insertions, 52 deletions
diff --git a/test/headers/meson.build b/test/headers/meson.build index cee8965..1d2162f 100644 --- a/test/headers/meson.build +++ b/test/headers/meson.build @@ -3,7 +3,7 @@ header_c_suppressions = [] -if get_option('strict') +if get_option('warning_level') == 'everything' if cc.get_id() == 'clang' header_c_suppressions += [ '-Wno-cast-align', diff --git a/test/meson.build b/test/meson.build index 630fb0d..b6cf111 100644 --- a/test/meson.build +++ b/test/meson.build @@ -5,51 +5,53 @@ # Data # ######## -# Check for spelling errors -codespell = find_program('codespell', required: get_option('tests')) -if codespell.found() - ignore = [ - lv2_source_root / 'doc' / 'style' / '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 +if get_option('lint') + # Check for spelling errors + codespell = find_program('codespell', required: get_option('tests')) + if codespell.found() + ignore = [ + lv2_source_root / 'doc' / 'style' / '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')) -native_build = not meson.is_cross_build() and host_machine.system() != 'windows' -if serdi.found() and native_build - lv2_check_syntax = files(lv2_source_root / 'scripts' / 'lv2_check_syntax.py') + # Check that specification data is strictly formatted + serdi = find_program('serdi', required: get_option('tests')) + native_build = not meson.is_cross_build() and host_machine.system() != 'windows' + if serdi.found() and native_build + 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 + 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') + # 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 endif ######## @@ -82,11 +84,7 @@ endif # Python # ########## -if get_option('strict') - flake8 = find_program('flake8', required: get_option('tests')) - pylint = find_program('pylint', required: get_option('tests')) - black = find_program('black', required: get_option('tests')) - +if get_option('lint') # Scripts that don't pass with pylint lax_python_scripts = files( '../lv2specgen/lv2docgen.py', @@ -98,17 +96,32 @@ if get_option('strict') all_python_scripts = lax_python_scripts + strict_python_scripts - if is_variable('black') and black.found() + # Check script formatting + black = find_program('black', required: get_option('tests')) + if 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() + # 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') endif - if is_variable('pylint') and pylint.found() - test('pylint', pylint, args: strict_python_scripts, suite: 'scripts') + # 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'], + required: false, + ) + + if lint_py.found() + test('pylint', pylint, args: strict_python_scripts, suite: 'scripts') + endif endif endif |