From 2cb4c31220660994310054f736227a6ae1d692cd Mon Sep 17 00:00:00 2001 From: David Robillard Date: Fri, 10 Jan 2025 14:39:16 -0500 Subject: Use cppcheck working directory This allows for better analysis, and adds a cache to improve checking times, especially on repeated runs. --- tests/lint/meson.build | 24 ++++++++++++++++++++++++ tests/meson.build | 22 +--------------------- 2 files changed, 25 insertions(+), 21 deletions(-) create mode 100644 tests/lint/meson.build diff --git a/tests/lint/meson.build b/tests/lint/meson.build new file mode 100644 index 00000000..c641cbaa --- /dev/null +++ b/tests/lint/meson.build @@ -0,0 +1,24 @@ +# Copyright 2019-2024 David Robillard +# SPDX-License-Identifier: 0BSD OR GPL-3.0-or-later + +if not meson.is_subproject() + # Check code with cppcheck + cppcheck = find_program('cppcheck', required: false) + if cppcheck.found() + compdb_path = join_paths(ingen_build_root, 'compile_commands.json') + suppress_path = join_paths(ingen_src_root, '.suppress.cppcheck') + test( + 'cppcheck', + cppcheck, + args: [ + '--cppcheck-build-dir=' + meson.current_build_dir(), + '--enable=warning,style,performance,portability', + '--error-exitcode=1', + '--project=' + compdb_path, + '--suppressions-list=' + suppress_path, + '-q', + ], + suite: 'code', + ) + endif +endif diff --git a/tests/meson.build b/tests/meson.build index 39395bae..1637230b 100644 --- a/tests/meson.build +++ b/tests/meson.build @@ -96,25 +96,5 @@ endforeach ######## if get_option('lint') - if not meson.is_subproject() - # Check code with cppcheck - cppcheck = find_program('cppcheck', required: false) - if cppcheck.found() - compdb_path = join_paths(ingen_build_root, 'compile_commands.json') - suppress_path = join_paths(ingen_src_root, '.suppress.cppcheck') - test( - 'cppcheck', - cppcheck, - args: [ - '--enable=warning,style,performance,portability', - '--error-exitcode=1', - '--project=' + compdb_path, - '--suppressions-list=' + suppress_path, - '-q', - ], - suite: 'code', - timeout: 60, - ) - endif - endif + subdir('lint') endif -- cgit v1.2.1