[Openvpn-devel,v3] run-cppcheck.sh: Make it more configurable
Commit Message
From: Frank Lichtenheld <frank@lichtenheld.com>
- Allow to easily control verbosity and automatically
adjust to the verbosity of the Make run
- Allow to easily control check level. With exhaustive the
check can take hours (due to options.c), so we couldn't
use that in CI
v3:
- Use AM_V_P instead of V to correctly reflect
AM_DEFAULT_VERBOSITY
Change-Id: I65beb37a2d822333aa888de1baf11dfcb8490e90
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Razvan Cojocaru <razvanc@mailbox.org>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1868
---
This change was reviewed on Gerrit and approved by at least one
developer. I request to merge it to master.
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1868
This mail reflects revision 3 of this Change.
Acked-by according to Gerrit (reflected above):
Razvan Cojocaru <razvanc@mailbox.org>
@@ -96,4 +96,5 @@
BUILD_DIR="$(abs_top_builddir)" \
SOURCE_DIR="$(abs_top_srcdir)" \
INCLUDE_FLAGS="$(LIBNL_GENL_CFLAGS)" \
+ CPPCHECK_VERBOSE="$(AM_V_P)" \
"$(top_srcdir)/dev-tools/run-cppcheck.sh"
@@ -2,22 +2,37 @@
set -eu
+: ${CPPCHECK_VERBOSE:=false}
+: ${CPPCHECK_CHECK_LEVEL:=exhaustive}
+
+if "${CPPCHECK_VERBOSE}"; then
+ verbosity_arg="-v"
+else
+ verbosity_arg="-q"
+fi
+
+disable_arg=
+if [ "${CPPCHECK_CHECK_LEVEL}" != exhaustive ]; then
+ # suppress all the information that we should use exhaustive
+ disable_arg="--disable=information"
+fi
+
SCRIPT_DIR=$(dirname $(readlink -e "${BASH_SOURCE[0]}"))
: ${SOURCE_DIR:=$SCRIPT_DIR/..}
: ${BUILD_DIR:=$PWD}
: ${INCLUDE_FLAGS:=}
CPPCHECK_DIR="${BUILD_DIR}/cppcheck_build_dir"
-COMMON_ARGS="-j$(nproc) -q \
+COMMON_ARGS="-j$(nproc) ${verbosity_arg} \
-DMBEDTLS_SSL_PROTO_TLS1_3 -DMBEDTLS_SSL_KEYING_MATERIAL_EXPORT \
-I./include/ -I./tests/unit_tests/openvpn/ \
-I./src/compat/ -I./src/openvpn/ -I./src/openvpnserv/ -I./src/plugins/auth-pam/ \
-I${BUILD_DIR} -I${BUILD_DIR}/include/ \
- --enable=all \
+ --enable=all ${disable_arg} \
--library=${SCRIPT_DIR}/openvpn-cppcheck-library.cfg \
--library=openssl.cfg \
--suppressions-list=${SCRIPT_DIR}/cppcheck-suppression \
--cppcheck-build-dir=${CPPCHECK_DIR} \
- --check-level=exhaustive --max-configs=10 \
+ --check-level=${CPPCHECK_CHECK_LEVEL} --max-configs=10 \
--error-exitcode=1"
set -x