From: Aydın Mercan Date: Fri, 10 Jul 2026 09:10:05 +0000 (+0300) Subject: add various project lints as tests to meson X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=3af707d56d6d7d5c35f732b7e497d3e31cdde4e1;p=thirdparty%2Fbind9.git add various project lints as tests to meson The check scripts run in the CI job `misc` is also useful in development enough that it warrants an easy way to execute them all at once. Add these scripts as unit tests with the suite `lint`. --- diff --git a/meson.build b/meson.build index de685524a63..8494b4b9a39 100644 --- a/meson.build +++ b/meson.build @@ -29,6 +29,8 @@ project( }, ) +add_test_setup('default', is_default: true, exclude_suites: ['lint']) + fs = import('fs') ss = import('sourceset') @@ -116,6 +118,17 @@ pytest = find_program( required: false, ) +## Lint +bash = find_program('bash', required: false) +comm = find_program('comm', required: false) +find = find_program('find', required: false) +grep = find_program('grep', required: false) +mktemp = find_program('mktemp', required: false) +sed = find_program('sed', required: false) +sort = find_program('sort', required: false) +tr = find_program('tr', required: false) +xargs = find_program('xargs', required: false) + ## Documentation sphinx_build = find_program('sphinx-build', required: doc_opt) @@ -2150,6 +2163,88 @@ if doc_opt.allowed() endif endif +### +### Project Lints +### + +# meson_version (>=1.11.2) : depends arg in test can take programs +if git.found() + test( + 'gitignore', + sh, + suite: 'lint', + args: ['util/check-gitignore.sh'], + verbose: true, + workdir: meson.project_source_root(), + ) + + test( + 'trailing-whitespace', + sh, + suite: 'lint', + args: ['util/check-trailing-whitespace.sh'], + verbose: true, + workdir: meson.project_source_root(), + ) + + if grep.found() and xargs.found() + test( + 'checklibs', + sh, + suite: 'lint', + args: ['util/checklibs.sh'], + verbose: true, + workdir: meson.project_source_root(), + ) + endif + + if bash.found() and grep.found() and sed.found() + test( + 'unused-headers', + bash, + suite: 'lint', + args: ['util/unused-headers.sh'], + verbose: true, + workdir: meson.project_source_root(), + ) + endif +endif + +if grep.found() and sed.found() and sort.found() and tr.found() + test( + 'categories', + sh, + suite: 'lint', + args: ['util/check-categories.sh'], + verbose: true, + workdir: meson.project_source_root(), + ) +endif + +if bash.found() and comm.found() and grep.found() and mktemp.found() and sed.found() and sort.found() + test( + 'rdata-registration', + bash, + suite: 'lint', + args: ['util/check-rdata-registration.sh', meson.project_build_root()], + verbose: true, + workdir: meson.project_source_root(), + ) +endif + +if find.found() and grep.found() + test( + 'dangling-symlink', + sh, + suite: 'lint', + args: [ + '-c', 'if find . -type l ! -exec test -e {} \\; -print | grep .; then exit 1; fi', + ], + verbose: true, + workdir: meson.project_source_root(), + ) +endif + ### ### Summary ###