From: Eric Bollengier Date: Mon, 11 Dec 2023 14:51:32 +0000 (+0100) Subject: regress: Improve cppcheck-test X-Git-Tag: Beta-15.0.1~27 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=70e93fe2466bdbe9bd11785018f9068f94ebaf8d;p=thirdparty%2Fbacula.git regress: Improve cppcheck-test --- diff --git a/regress/tests/cppcheck-test b/regress/tests/cppcheck-test index 6d4e8fc8a..58f6fbf28 100755 --- a/regress/tests/cppcheck-test +++ b/regress/tests/cppcheck-test @@ -7,4 +7,18 @@ # Run cppcheck # -cppcheck --quiet --enable=all --std=c++11 --force --suppress=unreadVariable --suppress=cstyleCast --language=c++ ../bacula/src +TARGET=$1 + +if [ "$TARGET" == ALL ]; then + cppcheck --quiet --enable=all --std=c++11 --force --suppress=unreadVariable --suppress=cstyleCast --language=c++ ../bacula/src + exit $? +fi + +if [ "$TARGET" != "" ]; then + cd .. + git diff-tree --no-commit-id --name-only -r ${TARGET}..HEAD > /tmp/file.list.$$ + if grep -E c$ /tmp/file.list.$$ > /dev/null + then + grep -E '[ch]$' /tmp/file.list.$$ | xargs cppcheck --quiet --enable=all --std=c++11 --force --suppress=unreadVariable --suppress=cstyleCast --language=c++ + fi +fi