diff options
-rw-r--r-- | test/meson.build | 81 |
1 files changed, 36 insertions, 45 deletions
diff --git a/test/meson.build b/test/meson.build index 360d61d..6aa4e95 100644 --- a/test/meson.build +++ b/test/meson.build @@ -1,64 +1,55 @@ # Copyright 2020-2024 David Robillard <d@drobilla.net> # SPDX-License-Identifier: 0BSD OR ISC -if not meson.is_subproject() and get_option('lint') - # Check release metadata - autoship = find_program('autoship', required: get_option('tests')) - if autoship.found() - test( - 'autoship', - autoship, - args: ['test', zix_src_root], - suite: 'data', - ) +######## +# Lint # +######## + +if get_option('lint') + if not meson.is_subproject() + # Check release metadata + autoship = find_program('autoship', required: get_option('tests')) + if autoship.found() + test('autoship', autoship, args: ['test', zix_src_root], suite: 'data') + endif + + # Check code with cppcheck + cppcheck = find_program('cppcheck', required: false) + if cppcheck.found() + compdb_path = join_paths(zix_build_root, 'compile_commands.json') + cppcheck_args = [ + '--enable=warning,style,performance,portability', + '--error-exitcode=1', + '--project=' + compdb_path, + '--suppress=constParameterCallback', + '--suppress=constParameterPointer', + '--suppress=normalCheckLevelMaxBranches', + '--suppress=unreadVariable', + '-q', + ] + test('cppcheck', cppcheck, args: cppcheck_args, suite: 'code') + endif endif # Check licensing metadata reuse = find_program('reuse', required: get_option('tests')) if reuse.found() - test( - 'REUSE', - reuse, - args: ['--root', zix_src_root, 'lint'], - suite: 'data', - ) + reuse_args = ['--root', zix_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() - 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(zix_build_root, 'compile_commands.json') - test( - 'cppcheck', - cppcheck, - args: [ - '--enable=warning,style,performance,portability', - '--error-exitcode=1', - '--project=' + compdb_path, - '--suppress=constParameterCallback', - '--suppress=constParameterPointer', - '--suppress=normalCheckLevelMaxBranches', - '--suppress=unreadVariable', - '-q', - ], - suite: 'code', - ) - endif + clang_format_args = ['--Werror', '--dry-run'] + c_headers + sources + test('format', clang_format, args: clang_format_args, suite: 'code') endif endif +############## +# Unit Tests # +############## + # Set warning suppression flags specific to tests test_suppressions = [] if host_machine.system() == 'windows' |