[S] Change in openvpn[master]: run-cppcheck.sh: Make it more configurable

"flichtenheld \(Code Review\) via Openvpn-devel" <[email protected]>
Newsgroups gmane.network.openvpn.devel
Message-ID <[email protected]>
Attention is currently required from: plaisthos.

Hello plaisthos,

I'd like you to do a code review.
Please visit

    http://gerrit.openvpn.net/c/openvpn/+/1868?usp=email

to review the following change.


Change subject: run-cppcheck.sh: Make it more configurable
......................................................................

run-cppcheck.sh: Make it more configurable

- 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

Change-Id: I65beb37a2d822333aa888de1baf11dfcb8490e90
Signed-off-by: Frank Lichtenheld <[email protected]>
---
M Makefile.am
M dev-tools/run-cppcheck.sh
2 files changed, 19 insertions(+), 3 deletions(-)



  git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/68/1868/1

diff --git a/Makefile.am b/Makefile.am
index feeaabb..d97a982 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -96,4 +96,5 @@
 	BUILD_DIR="$(abs_top_builddir)" \
 	SOURCE_DIR="$(abs_top_srcdir)" \
 	INCLUDE_FLAGS="$(LIBNL_GENL_CFLAGS)" \
+	CPPCHECK_VERBOSITY="$(V)" \
 		"$(top_srcdir)/dev-tools/run-cppcheck.sh"
diff --git a/dev-tools/run-cppcheck.sh b/dev-tools/run-cppcheck.sh
index a7aa3c4..c666bb5 100755
--- a/dev-tools/run-cppcheck.sh
+++ b/dev-tools/run-cppcheck.sh
@@ -2,22 +2,37 @@
 
 set -eu
 
+: ${CPPCHECK_VERBOSITY:=0}
+: ${CPPCHECK_CHECK_LEVEL:=exhaustive}
+
+if [ "${CPPCHECK_VERBOSITY}" -eq 0 ]; then
+    verbosity_arg="-q"
+else
+    verbosity_arg="-v"
+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

-- 
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1868?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email

Gerrit-MessageType: newchange
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I65beb37a2d822333aa888de1baf11dfcb8490e90
Gerrit-Change-Number: 1868
Gerrit-PatchSet: 1
Gerrit-Owner: flichtenheld <[email protected]>
Gerrit-Reviewer: plaisthos <[email protected]>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]>

_______________________________________________
Openvpn-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openvpn-devel
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.