diff options
-rw-r--r-- | test/lint/meson.build | 40 | ||||
-rw-r--r-- | test/meson.build | 38 |
2 files changed, 41 insertions, 37 deletions
diff --git a/test/lint/meson.build b/test/lint/meson.build new file mode 100644 index 0000000..9aaa339 --- /dev/null +++ b/test/lint/meson.build @@ -0,0 +1,40 @@ +# Copyright 2021-2024 David Robillard <d@drobilla.net> +# SPDX-License-Identifier: 0BSD OR ISC + +all_sources = sources + test_sratom_source + test_headers_source + +# Check licensing metadata +reuse = find_program('reuse', required: false) +if reuse.found() + reuse_args = ['--root', sratom_src_root, 'lint'] + test('REUSE', reuse, args: reuse_args, suite: 'data') +endif + +# Check code formatting +clang_format = find_program('clang-format', required: false) +if clang_format.found() + clang_format_args = ['--Werror', '--dry-run'] + c_headers + all_sources + test('format', clang_format, args: clang_format_args, suite: 'code') +endif + +if not meson.is_subproject() + # Check release metadata + autoship = find_program('autoship', required: false) + if autoship.found() + test('autoship', autoship, args: ['test', sratom_src_root], suite: 'data') + endif + + # Check code with cppcheck + cppcheck = find_program('cppcheck', required: false) + if cppcheck.found() + compdb_path = join_paths(sratom_build_root, 'compile_commands.json') + cppcheck_args = [ + '--enable=warning,style,performance,portability', + '--error-exitcode=1', + '--project=' + compdb_path, + '--suppress=normalCheckLevelMaxBranches', + '-q', + ] + test('cppcheck', cppcheck, args: cppcheck_args, suite: 'code') + endif +endif diff --git a/test/meson.build b/test/meson.build index 1033d2f..55dfcb3 100644 --- a/test/meson.build +++ b/test/meson.build @@ -29,41 +29,5 @@ test( ######## if get_option('lint') - all_sources = sources + test_sratom_source + test_headers_source - - if not meson.is_subproject() - # Check release metadata - autoship = find_program('autoship', required: false) - if autoship.found() - test('autoship', autoship, args: ['test', sratom_src_root], suite: 'data') - endif - - # Check code with cppcheck - cppcheck = find_program('cppcheck', required: false) - if cppcheck.found() - compdb_path = join_paths(sratom_build_root, 'compile_commands.json') - cppcheck_args = [ - '--enable=warning,style,performance,portability', - '--error-exitcode=1', - '--project=' + compdb_path, - '--suppress=normalCheckLevelMaxBranches', - '-q', - ] - test('cppcheck', cppcheck, args: cppcheck_args, suite: 'code') - endif - endif - - # Check licensing metadata - reuse = find_program('reuse', required: false) - if reuse.found() - reuse_args = ['--root', sratom_src_root, 'lint'] - test('REUSE', reuse, args: reuse_args, suite: 'data') - endif - - # Check code formatting - clang_format = find_program('clang-format', required: false) - if clang_format.found() - clang_format_args = ['--Werror', '--dry-run'] + c_headers + all_sources - test('format', clang_format, args: clang_format_args, suite: 'code') - endif + subdir('lint') endif |