travis: use $CPPCHECK global containing absolute path to cppcheck executable

This commit is contained in:
Matthias Krüger 2018-05-13 11:08:48 +02:00
parent 513cdc144c
commit 547934b5a5
1 changed files with 10 additions and 9 deletions

View File

@ -12,6 +12,7 @@ env:
# this also turns off the debug/warning cxxflags
- ORIGINAL_CXXFLAGS="-pedantic -Wall -Wextra -Wabi -Wcast-qual -Wfloat-equal -Wmissing-declarations -Wmissing-format-attribute -Wno-long-long -Wpacked -Wredundant-decls -Wshadow -Wno-missing-field-initializers -Wno-missing-braces -Wno-sign-compare -Wno-multichar -D_GLIBCXX_DEBUG -g "
- CXXFLAGS="${ORIGINAL_CXXFLAGS} -O2 -march=native -Wstrict-aliasing=2 -Werror=strict-aliasing"
- CPPCHECK=${TRAVIS_BUILD_DIR}/cppcheck
matrix:
# special CXXFLAGS for maximum speed, overrides global CXXFLAGS, CHECK_CLANG is the var that controls if we download and check clang in that travis job
- CXXFLAGS="${CXXFLAGS} -DCHECK_INTERNAL"
@ -44,9 +45,9 @@ script:
# fail the entire job as soon as one of the subcommands exits non-zero to save time and resources
- set -e
# download clang git, compile cppcheck, run cppcheck on clang code to look for crashes in cppcheck. if this is done, terminate build
- if [[ "$CHECK_CLANG" == "yes" ]] && [[ "$CC" == "clang" ]]; then wget "https://github.com/llvm-mirror/clang/archive/3aeb17c0c83af34fee9afb3efe3122bad77f557f.zip" & make -j 4 & wait; unzip 3aeb17c0c83af34fee9afb3efe3122bad77f557f.zip > /dev/null; touch /tmp/clang.cppcheck; cd ./clang-3aeb17c0c83af34fee9afb3efe3122bad77f557f ; ../cppcheck . --max-configs=1 --enable=all --inconclusive --exception-handling --template="{callstack} ({severity}) {message} [{id}]" -iINPUTS -itest/Driver/Inputs/gen-response.c -itest/Index/index-many-logical-ops.c -itest/Sema/many-logical-ops.c --suppressions-list=../.travis_llvmcheck_suppressions -j 2 |& grep -v ".* files checked.*done" |& tee /tmp/clang.cppcheck; cd ../ ; echo "CLANG" ; ! grep "process crashed with signal\|Internal error\. compiled" /tmp/clang.cppcheck; exit; fi
- if [[ "$CHECK_CLANG" == "yes" ]] && [[ "$CC" == "clang" ]]; then wget "https://github.com/llvm-mirror/clang/archive/3aeb17c0c83af34fee9afb3efe3122bad77f557f.zip" & make -j 4 & wait; unzip 3aeb17c0c83af34fee9afb3efe3122bad77f557f.zip > /dev/null; touch /tmp/clang.cppcheck; cd ./clang-3aeb17c0c83af34fee9afb3efe3122bad77f557f ; ${CPPCHECK} . --max-configs=1 --enable=all --inconclusive --exception-handling --template="{callstack} ({severity}) {message} [{id}]" -iINPUTS -itest/Driver/Inputs/gen-response.c -itest/Index/index-many-logical-ops.c -itest/Sema/many-logical-ops.c --suppressions-list=../.travis_llvmcheck_suppressions -j 2 |& grep -v ".* files checked.*done" |& tee /tmp/clang.cppcheck; cd ../ ; echo "CLANG" ; ! grep "process crashed with signal\|Internal error\. compiled" /tmp/clang.cppcheck; exit; fi
# check llvm as well
- if [[ "$CHECK_LLVM" == "yes" ]] && [[ "$CC" == "clang" ]]; then wget "https://github.com/llvm-mirror/llvm/archive/c31146b17944a1d56df72a70a1ed0e3b63795168.zip" & make -j 4 & wait; unzip c31146b17944a1d56df72a70a1ed0e3b63795168.zip > /dev/null; touch /tmp/llvm.cppcheck; cd ./llvm-c31146b17944a1d56df72a70a1ed0e3b63795168 ; ../cppcheck . --max-configs=1 --enable=all --inconclusive --exception-handling --template="{callstack} ({severity}) {message} [{id}]" --suppressions-list=../.travis_llvmcheck_suppressions -j 2 |& grep -v ".* files checked.*done" |& tee /tmp/llvm.cppcheck; cd ../ ; echo "LLVM" ; ! grep "process crashed with signal\|Internal error\. compiled" /tmp/llvm.cppcheck; exit; fi
- if [[ "$CHECK_LLVM" == "yes" ]] && [[ "$CC" == "clang" ]]; then wget "https://github.com/llvm-mirror/llvm/archive/c31146b17944a1d56df72a70a1ed0e3b63795168.zip" & make -j 4 & wait; unzip c31146b17944a1d56df72a70a1ed0e3b63795168.zip > /dev/null; touch /tmp/llvm.cppcheck; cd ./llvm-c31146b17944a1d56df72a70a1ed0e3b63795168 ; ${CPPCHECK} . --max-configs=1 --enable=all --inconclusive --exception-handling --template="{callstack} ({severity}) {message} [{id}]" --suppressions-list=../.travis_llvmcheck_suppressions -j 2 |& grep -v ".* files checked.*done" |& tee /tmp/llvm.cppcheck; cd ../ ; echo "LLVM" ; ! grep "process crashed with signal\|Internal error\. compiled" /tmp/llvm.cppcheck; exit; fi
# check if dmake needs to be rerun but if yes, don't fail the build but notify us.
# to update dmake: "make dmake; ./dmake; and commit
- echo "If the following command fails, run 'make dmake; make run-dmake' and commit the resulting change."
@ -68,9 +69,9 @@ script:
- cd ../
# use same hack as for clang to work around cppchecks broken exit status with -j 2 ; create file, tee everything to the file and stdout, grep for errors in the file
- touch /tmp/cppcheck.cppcheck
- ./cppcheck --error-exitcode=1 --library=cppcheck-lib -Ilib -Iexternals/simplecpp/ -Iexternals/tinyxml/ -Icli --enable=style,performance,portability,warning,internal --exception-handling --suppressions-list=.travis_suppressions -itest/synthetic -iaddons -igui . -j 2 |& tee /tmp/cppcheck.cppcheck
- ${CPPCHECK} --error-exitcode=1 --library=cppcheck-lib -Ilib -Iexternals/simplecpp/ -Iexternals/tinyxml/ -Icli --enable=style,performance,portability,warning,internal --exception-handling --suppressions-list=.travis_suppressions -itest/synthetic -iaddons -igui . -j 2 |& tee /tmp/cppcheck.cppcheck
# check gui with qt settings
- ./cppcheck --library=qt --error-exitcode=1 -Ilib -Iexternals/simplecpp/ -Iexternals/tinyxml/ -Icli --enable=style,performance,portability,warning,internal --exception-handling -j 2 gui --suppressions-list=.travis_suppressions -igui/test |& tee --append /tmp/cppcheck.cppcheck
- ${CPPCHECK} --library=qt --error-exitcode=1 -Ilib -Iexternals/simplecpp/ -Iexternals/tinyxml/ -Icli --enable=style,performance,portability,warning,internal --exception-handling -j 2 gui --suppressions-list=.travis_suppressions -igui/test |& tee --append /tmp/cppcheck.cppcheck
- sh -c "! grep '^\[' /tmp/cppcheck.cppcheck"
# run extra tests
- tools/generate_and_run_more_tests.sh
@ -115,19 +116,19 @@ script:
# check matchcompiler
- ./tools/test_matchcompiler.py
# check --dump
- ./cppcheck test/testpreprocessor.cpp --dump
- ${CPPCHECK} test/testpreprocessor.cpp --dump
- xmllint --noout test/testpreprocessor.cpp.dump
# check addons/misra.py
- cd addons/test
- ../../cppcheck --dump misc-test.cpp
- ${CPPCHECK} --dump misc-test.cpp
- python3 ../misc.py -verify misc-test.cpp.dump
- ../../cppcheck --dump cert-test.c
- ${CPPCHECK} --dump cert-test.c
- python3 ../cert.py -verify cert-test.c.dump
# these are broken right now.
# uncomment as soon as it gets fixed
# - ../../cppcheck --dump misra-test.c
# - ${CPPCHECK} --dump misra-test.c
# - python3 ../misra.py -verify misra-test.c.dump
- ../../cppcheck --dump misra-test.cpp
- ${CPPCHECK} --dump misra-test.cpp
- python3 ../misra.py -verify misra-test.cpp.dump
- cd ../../