cppcheck/.travis.yml

143 lines
7.0 KiB
YAML
Raw Normal View History

2012-09-02 11:37:18 +02:00
language: cpp
dist: trusty
sudo: required
2012-09-02 11:37:18 +02:00
compiler:
- gcc
2017-04-02 19:32:00 +02:00
- clang
env:
global:
# unfortunately we need this to stay within 50min timelimit given by travis.
# this also turns off the debug/warning cxxflags
2018-04-10 06:52:33 +02:00
- 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"
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"
- CXXFLAGS="${CXXFLAGS} -DCHECK_INTERNAL" MAKEFLAGS="HAVE_RULES=yes" SRCDIR=build VERIFY=1
- SRCDIR=build CHECK_CLANG=yes VERIFY=1
- SRCDIR=build CHECK_LLVM=yes VERIFY=1
- CHECK_MAKEFILE_REGEN=true
matrix:
# do notify immediately about it when a job of a build fails.
fast_finish: true
# exclude clang checking with clang binary, not needed
exclude:
- compiler: gcc
env: SRCDIR=build CHECK_CLANG=yes VERIFY=1
- compiler: gcc
env: SRCDIR=build CHECK_LLVM=yes VERIFY=1
- compiler: gcc
env: CHECK_MAKEFILE_REGEN=true
allow_failures:
- compiler: clang
env: CHECK_MAKEFILE_REGEN=true
before_install:
# install needed deps
- sudo apt-get update -qq
2017-07-31 07:12:17 +02:00
- sudo apt-get install -qq python-pygments qt5-default qt5-qmake qtbase5-dev qtcreator libxml2-utils libpcre3 gdb unzip
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
# 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
# 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
2018-02-04 20:53:43 +01:00
- echo "If the following command fails, run 'make dmake; make run-dmake' and commit the resulting change."
- if [[ "$CHECK_MAKEFILE_REGEN" == "true" ]]; then make -s dmake; make -s run-dmake ; git diff --exit-code; exit; fi
2015-07-31 15:33:27 +02:00
# check with TEST_MATHLIB_VALUE enabled
- touch lib/mathlib.cpp test/testmathlib.cpp
- echo $CXXFLAGS
- make -s test -j4 CPPFLAGS=-DTEST_MATHLIB_VALUE
2015-07-31 15:33:27 +02:00
- touch lib/mathlib.cpp test/testmathlib.cpp
# compile cppcheck, default build
- echo $CXXFLAGS
- make -s test -j4
# compile gui
2013-10-07 16:58:53 +02:00
- cd gui
- qmake
- echo $CXXFLAGS
- make -s -j4
# building gui generates some more files that cppcheck can check, so check the repo *after* building gui
- 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
# 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
- sh -c "! grep '^\[' /tmp/cppcheck.cppcheck"
# run extra tests
- tools/generate_and_run_more_tests.sh
# check test/cfg
- make checkcfg
2017-07-23 18:40:16 +02:00
- make validateCFG
- cd ./gui
# clean rebuild
- git clean -dfx .
2018-05-11 23:22:16 +02:00
# can't set this as env flags, so try again with HAVE_RULES=yes
- qmake HAVE_RULES=yes
- echo $CXXFLAGS
- make -s -j4
2013-10-07 16:58:53 +02:00
- cd ../
# note: trusty on travis has python pygments disabled so disable these tests on travis
## check htmlreport stuff
# - ./htmlreport/test_htmlreport.py
# - cd htmlreport
# - ./check.sh
# - cd ../
# check if DESTDIR works TODO: actually execute this
2013-10-07 21:38:03 +02:00
- mkdir install_test
- echo $CXXFLAGS
- make -s DESTDIR=install_test install
# rm everything
- git clean -dfx
# check what happens if we want to install it to some other dir,
- echo $CXXFLAGS
- make -s SRCDIR=build CFGDIR=/usr/share/cppcheck/cfg -j 4
- sudo make SRCDIR=build CFGDIR=/usr/share/cppcheck/cfg install
- sudo mkdir -p /usr/share/cppcheck/cfg
- sudo install -D ./cfg/* -t /usr/share/cppcheck/cfg
# check if it actually works:
- /usr/bin/cppcheck ./cli
# check if reduce tool compiles
- echo $CXXFLAGS
- make -s reduce -j 4
# check if showtime=top5 works
- ./tools/test_showtimetop5.sh
2014-01-07 06:41:27 +01:00
# check the files in cgf dir with xmllint
- xmllint --noout cfg/*
2014-05-25 14:49:38 +02:00
# check matchcompiler
- ./tools/test_matchcompiler.py
2014-07-14 20:17:40 +02:00
# check --dump
- ./cppcheck test/testpreprocessor.cpp --dump
- xmllint --noout test/testpreprocessor.cpp.dump
2017-04-14 12:44:24 +02:00
# check addons/misra.py
2018-05-11 23:22:16 +02:00
- cd addons/test
- ../../cppcheck --dump misc-test.cpp
- python3 ../misc.py -verify misc-test.cpp.dump
- ../../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
# - python3 ../misra.py -verify misra-test.c.dump
- ../../cppcheck --dump misra-test.cpp
- python3 ../misra.py -verify misra-test.cpp.dump
- cd ../../
2013-02-11 19:32:53 +01:00
notifications:
irc:
channels:
- "irc.freenode.org#cppcheck"
template:
- "[%{commit} : %{author}] %{message}"
- "%{build_url}"
skip_join: true