From: Claudius Heine <[email protected]> This commit adds cppcheck as a travis target. Raised issues are suppressed and should be fixed in further commits.
Signed-off-by: Claudius Heine <[email protected]> --- .travis-build.sh | 43 +++++++++++++++++++++++++++++++++++++++++++ .travis.yml | 1 + 2 files changed, 44 insertions(+) diff --git a/.travis-build.sh b/.travis-build.sh index 56786ab..c1d16cd 100755 --- a/.travis-build.sh +++ b/.travis-build.sh @@ -10,6 +10,21 @@ prepare_build() mkdir build cd build } + +install_cppcheck() +{ + git clone https://github.com/danmar/cppcheck.git + cd cppcheck + git checkout 1.80 + make SRCDIR=build CFGDIR=/usr/share/cppcheck HAVE_RULES=no -j2 + sudo make install + # On travis cppcheck ignores CFGDIR. Instead, it looks in $PWD. Compare + # strace output. + sudo install -m644 ./cfg/* ../ + cd .. + rm -rf cppcheck +} + case "$TARGET" in native) prepare_build @@ -24,6 +39,34 @@ case "$TARGET" in host_alias=i586-linux exec make check ;; + cppcheck) + install_cppcheck + sup_error="" + sup_warn="--suppress=invalidScanfArgType_int:tools/ebgpart.c" + sup_info="" + sup_perf="--suppress=invalidscanf:tools/ebgpart.c" + sup_style="\ + --suppress=unusedFunction:tools/bg_utils.c \ + --suppress=unusedFunction:utils \ + --suppress=unusedFunction:swupdate-adapter/ebgenv.c \ + --suppress=unusedFunction:main.c \ + --suppress=unusedFunction:tools/tests/test_environment.c \ + --suppress=unusedFunction:env/fatvars.c" + suppress="$sup_error $sup_warn $sup_info $sup_perf $sup_style" + enable="--enable=all --check-config" + includes="-I include \ + -I tools \ + -I swupdate-adapter \ + -I /usr/include \ + -I /usr/include/linux \ + -I /usr/include/efi \ + -I /usr/include/efi/x86_64 \ + -I /usr/include/x86_64-linux-gnu" + # Exit code '1' is returned if arguments are not valid or if no input + # files are provided. Compare 'cppcheck --help'. + exec cppcheck -f -q --error-exitcode=2 --std=posix \ + $enable $suppress $includes . + ;; *) exit -1 ;; diff --git a/.travis.yml b/.travis.yml index dae0337..4fa4045 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,6 +14,7 @@ env: matrix: - TARGET=native - TARGET=i586 + - TARGET=cppcheck language: c compiler: -- 2.14.1 -- You received this message because you are subscribed to the Google Groups "EFI Boot Guard" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/efibootguard-dev/20170926132244.1615-3-claudius.heine.ext%40siemens.com. For more options, visit https://groups.google.com/d/optout.
