2012-09-02 11:37:18 +02:00
language : cpp
2017-07-26 23:24:09 +02:00
dist : trusty
2014-03-17 13:23:29 +01:00
2012-09-02 11:37:18 +02:00
compiler :
2014-03-23 19:14:31 +01:00
- gcc
2017-04-02 19:32:00 +02:00
- clang
2014-03-17 13:23:29 +01:00
2014-01-04 11:37:03 +01:00
env :
global :
2015-11-10 20:44:24 +01:00
# unfortunately we need this to stay within 50min timelimit given by travis.
2014-01-04 11:37:03 +01:00
# this also turns off the debug/warning cxxflags
2018-11-23 22:34:10 +01:00
- ORIGINAL_CXXFLAGS="-pedantic -Wall -Wextra -Wabi -Wcast-qual -Wfloat-equal -Wmissing-declarations -Wmissing-format-attribute -Wno-long-long -Wpacked -Wredundant-decls -Wno-shadow -Wno-missing-field-initializers -Wno-missing-braces -Wno-sign-compare -Wno-multichar -D_GLIBCXX_DEBUG -g "
2017-06-05 23:10:28 +02:00
- CXXFLAGS="${ORIGINAL_CXXFLAGS} -O2 -march=native -Wstrict-aliasing=2 -Werror=strict-aliasing"
2018-05-13 11:08:48 +02:00
- CPPCHECK=${TRAVIS_BUILD_DIR}/cppcheck
2014-01-04 11:37:03 +01:00
matrix :
2014-05-27 21:27:10 +02:00
# 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
2014-05-24 10:22:59 +02:00
- CXXFLAGS="${CXXFLAGS} -DCHECK_INTERNAL"
2017-04-02 19:25:31 +02:00
- CXXFLAGS="${CXXFLAGS} -DCHECK_INTERNAL" MAKEFLAGS="HAVE_RULES=yes" SRCDIR=build VERIFY=1
2014-06-18 23:16:00 +02:00
- SRCDIR=build CHECK_CLANG=yes VERIFY=1
2017-03-26 12:52:46 +02:00
- SRCDIR=build CHECK_LLVM=yes VERIFY=1
2017-11-27 11:49:22 +01:00
- CHECK_MAKEFILE_REGEN=true
2014-03-17 13:23:29 +01:00
2014-01-17 20:46:20 +01:00
matrix :
2014-03-17 13:23:29 +01:00
# do notify immediately about it when a job of a build fails.
2014-01-17 20:46:20 +01:00
fast_finish : true
2014-05-24 10:22:59 +02:00
# exclude clang checking with clang binary, not needed
2014-03-17 13:23:29 +01:00
exclude :
2017-04-02 19:24:24 +02:00
- compiler : gcc
2014-05-24 10:22:59 +02:00
env : SRCDIR=build CHECK_CLANG=yes VERIFY=1
2017-04-02 19:24:24 +02:00
- compiler : gcc
2017-03-26 12:52:46 +02:00
env : SRCDIR=build CHECK_LLVM=yes VERIFY=1
2017-11-27 11:49:22 +01:00
- compiler : gcc
env : CHECK_MAKEFILE_REGEN=true
allow_failures :
- compiler : clang
env : CHECK_MAKEFILE_REGEN=true
2014-03-17 13:23:29 +01:00
2013-10-12 12:40:20 +02:00
before_install :
2014-01-04 11:37:03 +01:00
# install needed deps
2013-10-12 12:40:20 +02:00
- sudo apt-get update -qq
2018-07-12 08:40:26 +02:00
- sudo apt-get install -qq python-pygments qt5-default qt5-qmake qtbase5-dev qtcreator libxml2-utils libpcre3 gdb unzip wx-common xmlstarlet
2014-03-17 13:23:29 +01:00
2012-09-05 07:22:49 +02:00
script :
2017-10-20 19:26:05 +02:00
# fail the entire job as soon as one of the subcommands exits non-zero to save time and resources
2017-10-19 22:44:52 +02:00
- set -e
2019-01-05 11:12:32 +01:00
# Determine CPU count. As of January 2019 it seems to be 2 - so use this for job count in suitable calls to make or cppcheck
- cat /proc/cpuinfo
2014-05-24 10:22:59 +02:00
# download clang git, compile cppcheck, run cppcheck on clang code to look for crashes in cppcheck. if this is done, terminate build
2019-01-05 11:12:32 +01:00
- if [[ "$CHECK_CLANG" == "yes" ]] && [[ "$CC" == "clang" ]]; then wget "https://github.com/llvm-mirror/clang/archive/a1f8bd3778cc5a53236a53500c6ab184e945eefa.zip" & make -j 2 & wait; unzip a1f8bd3778cc5a53236a53500c6ab184e945eefa.zip > /dev/null; touch /tmp/clang.cppcheck; cd ./clang-a1f8bd3778cc5a53236a53500c6ab184e945eefa ; ${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
2016-01-23 12:29:56 +01:00
# check llvm as well
2019-01-05 11:12:32 +01:00
- if [[ "$CHECK_LLVM" == "yes" ]] && [[ "$CC" == "clang" ]]; then wget "https://github.com/llvm-mirror/llvm/archive/6fa6453210fa34c1c28bd73a431d04734549f0d6.zip" & make -j 2 & wait; unzip 6fa6453210fa34c1c28bd73a431d04734549f0d6.zip > /dev/null; touch /tmp/llvm.cppcheck; cd ./llvm-6fa6453210fa34c1c28bd73a431d04734549f0d6 ; ${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
2017-11-27 11:49:22 +01:00
# 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."
2017-11-27 11:49:22 +01:00
- 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
2015-10-14 10:50:53 +02:00
- touch lib/mathlib.cpp test/testmathlib.cpp
2017-06-06 22:54:16 +02:00
- echo $CXXFLAGS
2019-01-05 11:12:32 +01:00
- make -s test -j2 CPPFLAGS=-DTEST_MATHLIB_VALUE
2015-07-31 15:33:27 +02:00
- touch lib/mathlib.cpp test/testmathlib.cpp
2015-10-14 10:50:53 +02:00
# compile cppcheck, default build
2017-06-06 22:54:16 +02:00
- echo $CXXFLAGS
2019-01-05 11:12:32 +01:00
- make -s test -j2
2014-01-04 11:37:03 +01:00
# compile gui
2013-10-07 16:58:53 +02:00
- cd gui
- qmake
2017-06-06 22:54:16 +02:00
- echo $CXXFLAGS
2019-01-05 11:12:32 +01:00
- make -s -j2
2014-01-12 16:30:14 +01:00
# building gui generates some more files that cppcheck can check, so check the repo *after* building gui
- cd ../
2014-05-24 10:22:59 +02:00
# 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
2014-03-18 01:58:43 +01:00
- touch /tmp/cppcheck.cppcheck
2018-11-19 15:11:59 +01:00
- ${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
2017-04-22 21:28:58 +02:00
# check gui with qt settings
2018-05-13 11:08:48 +02:00
- ${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
2014-03-18 17:36:52 +01:00
- sh -c "! grep '^\[' /tmp/cppcheck.cppcheck"
2018-06-18 09:55:43 +02:00
# check naming conventions
2018-07-19 08:43:23 +02:00
- ${CPPCHECK} -i gui/test -j 2 --dump -q gui lib
- find lib gui -maxdepth 1 -name "*.dump" | xargs -n 1 -P 4 python addons/naming.py --private-member-variable='m[A-Z].*'
2015-07-22 13:31:33 +02:00
# run extra tests
- tools/generate_and_run_more_tests.sh
2018-10-22 13:14:48 +02:00
# check for missing CWE entries
- make checkCWEEntries
2019-01-05 11:12:32 +01:00
# check cfg files
2015-01-27 19:31:41 +01:00
- make checkcfg
2019-01-05 11:12:32 +01:00
# check platform files
- make validatePlatforms
# Validate Result XML
2018-09-24 14:27:02 +02:00
- make validateXML
2019-01-05 11:12:32 +01:00
# Build gui
2014-01-12 16:30:14 +01:00
- cd ./gui
# clean rebuild
2014-01-04 11:37:03 +01:00
- 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
2014-01-04 11:37:03 +01:00
- qmake HAVE_RULES=yes
2017-06-06 22:54:16 +02:00
- echo $CXXFLAGS
2019-01-05 11:12:32 +01:00
- make -s -j2
2013-10-07 16:58:53 +02:00
- cd ../
2017-07-26 23:24:09 +02:00
# 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 ../
2014-01-04 11:37:03 +01:00
# check if DESTDIR works TODO: actually execute this
2013-10-07 21:38:03 +02:00
- mkdir install_test
2017-06-06 22:54:16 +02:00
- echo $CXXFLAGS
- make -s DESTDIR=install_test install
2014-01-04 11:37:03 +01:00
# rm everything
- git clean -dfx
# check what happens if we want to install it to some other dir,
2017-06-06 22:54:16 +02:00
- echo $CXXFLAGS
2019-01-05 11:12:32 +01:00
- make -s SRCDIR=build CFGDIR=/usr/share/cppcheck/cfg -j 2
2014-01-04 11:37:03 +01:00
- sudo make SRCDIR=build CFGDIR=/usr/share/cppcheck/cfg install
2013-12-31 15:20:30 +01:00
- sudo mkdir -p /usr/share/cppcheck/cfg
- sudo install -D ./cfg/* -t /usr/share/cppcheck/cfg
2014-01-04 11:37:03 +01:00
# check if it actually works:
2013-12-31 15:20:30 +01:00
- /usr/bin/cppcheck ./cli
2014-01-04 11:37:03 +01:00
# check if reduce tool compiles
2017-06-06 22:54:16 +02:00
- echo $CXXFLAGS
2019-01-05 11:12:32 +01:00
- make -s reduce -j 2
2014-01-04 11:37:03 +01:00
# check if showtime=top5 works
- ./tools/test_showtimetop5.sh
2014-05-25 14:49:38 +02:00
# check matchcompiler
- ./tools/test_matchcompiler.py
2014-07-14 20:17:40 +02:00
# check --dump
2018-05-13 11:08:48 +02:00
- ${CPPCHECK} test/testpreprocessor.cpp --dump
2014-07-14 20:17:40 +02:00
- 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
2018-05-13 11:08:48 +02:00
- ${CPPCHECK} --dump misc-test.cpp
2018-05-11 23:22:16 +02:00
- python3 ../misc.py -verify misc-test.cpp.dump
2018-05-13 11:08:48 +02:00
- ${CPPCHECK} --dump cert-test.c
2018-05-11 23:22:16 +02:00
- python3 ../cert.py -verify cert-test.c.dump
2018-08-24 15:05:50 +02:00
- ${CPPCHECK} --dump cert-test.cpp
- python3 ../cert.py -verify cert-test.cpp.dump
2018-05-16 11:13:25 +02:00
- ${CPPCHECK} --dump misra-test.c
- python3 ../misra.py -verify misra-test.c.dump
2018-05-13 11:08:48 +02:00
- ${CPPCHECK} --dump misra-test.cpp
2018-05-11 23:22:16 +02:00
- python3 ../misra.py -verify misra-test.cpp.dump
- cd ../../
2018-11-06 20:46:07 +01:00
# check addons/namingng.py
- cd addons/test
- ${CPPCHECK} --dump namingng_test.c
- python3 ../namingng.py --configfile ../naming.json --verify namingng_test.c.dump
- cd ../..
2019-01-02 00:01:15 +01:00
# try CMake
- mkdir cmake.output
- cd cmake.output
- cmake -G "Unix Makefiles" ..
- cd ..
2014-03-17 13:23:29 +01:00
2013-02-11 19:32:53 +01:00
notifications :
irc :
channels :
- "irc.freenode.org#cppcheck"
template :
- "[%{commit} : %{author}] %{message}"
- "%{build_url}"
skip_join : true