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 | 66 +++++++++++++++++++++++++++++++++++++++++++++++++++++++- .travis.yml | 1 + 2 files changed, 66 insertions(+), 1 deletion(-) diff --git a/.travis-build.sh b/.travis-build.sh index 56786ab..cb2e250 100755 --- a/.travis-build.sh +++ b/.travis-build.sh @@ -7,23 +7,87 @@ TARGET="${TARGET-"$1"}" prepare_build() { autoreconf -fi - mkdir build +} + + +enter_build() +{ + mkdir -p build cd build } + +install_cppcheck() +{ + git clone https://github.com/danmar/cppcheck.git + git -C cppcheck checkout 1.80 + make -C cppcheck SRCDIR=build \ + CFGDIR=/usr/share/cppcheck \ + HAVE_RULES=no -j2 || \ + return -1 + sudo make -C cppcheck install >/dev/null \ + || return -1 + # On travis cppcheck ignores CFGDIR. Instead, it looks in $PWD. Compare + # strace output. + sudo install -m644 ./cppcheck/cfg/* ./ || return -1 + rm -rf cppcheck +} + case "$TARGET" in native) prepare_build + enter_build ../configure exec make check ;; + i586) sudo apt-get install --no-install-recommends \ --target-release xenial libcmocka-dev:i386 prepare_build + enter_build ../configure --with-gnuefi-lib-dir=/usr/lib32 CFLAGS=-m32 \ host_alias=i586-linux exec make check ;; + + cppcheck) + echo "Building and installing cppcheck..." + if ! install_cppcheck >cppcheck_build.log 2>&1 + then + cat cppcheck_build.log + exit -1 + fi + prepare_build + ./configure + + suppress="" + # Justified suppressions: + # Not part of the project: + suppress+=" --suppress=variableScope:/usr/include/bits/stdlib-bsearch.h" + # Function 'efi_main' is called by efi: + suppress+=" --suppress=unusedFunction:main.c" + + enable="--enable=warning \ + --enable=style \ + --enable=performance \ + --enable=portability \ + --enable=unusedFunction" + + includes="-I . \ + -I include \ + -I /usr/include \ + -I /usr/include/linux \ + -I /usr/include/efi \ + -I /usr/include/efi/x86_64 \ + -I /usr/include/x86_64-linux-gnu \ + -I /usr/lib/gcc/x86_64-linux-gnu/4.8/include" + + cpp_conf="-U__WINT_TYPE__" + # 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 $cpp_conf $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/20170928074358.1110-2-claudius.heine.ext%40siemens.com. For more options, visit https://groups.google.com/d/optout.
