summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2025-01-10 14:39:16 -0500
committerDavid Robillard <d@drobilla.net>2025-01-10 14:39:16 -0500
commit2cb4c31220660994310054f736227a6ae1d692cd (patch)
tree4e5e84f29a90355dcdcbbaec4d7c1cd09dd0c837
parent09d245da6339d5c6204e2cf101e207b72fdf4bd6 (diff)
downloadingen-2cb4c31220660994310054f736227a6ae1d692cd.tar.gz
ingen-2cb4c31220660994310054f736227a6ae1d692cd.tar.bz2
ingen-2cb4c31220660994310054f736227a6ae1d692cd.zip
Use cppcheck working directoryHEADmain
This allows for better analysis, and adds a cache to improve checking times, especially on repeated runs.
-rw-r--r--tests/lint/meson.build24
-rw-r--r--tests/meson.build22
2 files changed, 25 insertions, 21 deletions
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 <d@drobilla.net>
+# 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