| 1 |
# Copyright 2021-2024 David Robillard <[email protected]> |
| 2 |
# SPDX-License-Identifier: 0BSD OR ISC |
| 3 |
|
| 4 |
all_sources = sources + unit_test_sources |
| 5 |
|
| 6 |
# Check licensing metadata |
| 7 |
reuse = find_program('reuse', required: false) |
| 8 |
if reuse.found() |
| 9 |
reuse_args = ['--root', sratom_src_root, 'lint'] |
| 10 |
test('REUSE', reuse, args: reuse_args, suite: 'data') |
| 11 |
endif |
| 12 |
|
| 13 |
# Check code formatting |
| 14 |
clang_format = find_program('clang-format', required: false) |
| 15 |
if clang_format.found() |
| 16 |
clang_format_args = ['--Werror', '--dry-run'] + c_headers + all_sources |
| 17 |
test('format', clang_format, args: clang_format_args, suite: 'code') |
| 18 |
endif |
| 19 |
|
| 20 |
if not meson.is_subproject() |
| 21 |
# Check release metadata |
| 22 |
autoship = find_program('autoship', required: false) |
| 23 |
if autoship.found() |
| 24 |
test('autoship', autoship, args: ['test', sratom_src_root], suite: 'data') |
| 25 |
endif |
| 26 |
|
| 27 |
# Check code with cppcheck |
| 28 |
cppcheck = find_program('cppcheck', required: false) |
| 29 |
if cppcheck.found() |
| 30 |
compdb_path = join_paths(sratom_build_root, 'compile_commands.json') |
| 31 |
suppress_path = join_paths(sratom_src_root, '.suppress.cppcheck') |
| 32 |
cppcheck_args = [ |
| 33 |
'--enable=warning,style,performance,portability', |
| 34 |
'--error-exitcode=1', |
| 35 |
'--project=' + compdb_path, |
| 36 |
'--suppressions-list=' + suppress_path, |
| 37 |
'-q', |
| 38 |
] |
| 39 |
test('cppcheck', cppcheck, args: cppcheck_args, suite: 'code') |
| 40 |
endif |
| 41 |
endif |