cppcheck/.travis.yml

265 lines
11 KiB
YAML
Raw Normal View History

2012-09-02 11:37:18 +02:00
language: cpp
dist: xenial
2012-09-02 11:37:18 +02:00
compiler:
- gcc
2017-04-02 19:32:00 +02:00
- clang
env:
global:
2019-04-10 19:10:05 +02: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 "
# unfortunately we need this to stay within 50min timelimit given by travis.
- CXXFLAGS="${ORIGINAL_CXXFLAGS} -O2 -march=native -Wstrict-aliasing=2 -Werror=strict-aliasing"
- CPPCHECK=${TRAVIS_BUILD_DIR}/cppcheck
- ASAN_OPTIONS=detect_stack_use_after_return=1
- UBSAN_OPTIONS=print_stacktrace=1
matrix:
- CXXFLAGS="${CXXFLAGS} -DCHECK_INTERNAL"
- CXXFLAGS="${CXXFLAGS} -DCHECK_INTERNAL" MAKEFLAGS="HAVE_RULES=yes" MATCHCOMPILER=yes VERIFY=1
before_install:
# install needed deps
- travis_retry sudo apt-get update -qq
2020-02-05 15:53:50 +01:00
- travis_retry sudo apt-get install -qq python3-pip qt5-default qt5-qmake qtbase5-dev qtcreator libxml2-utils libpcre3 gdb unzip wx-common xmlstarlet python3-dev liblua5.3-dev libcurl3 libcairo2-dev libsigc++-2.0-dev tidy libopencv-dev libz3-dev
# Python 2 modules
- travis_retry python2 -m pip install --user pytest==4.6.4
- travis_retry python2 -m pip install --user pylint
- travis_retry python2 -m pip install --user unittest2
- travis_retry python2 -m pip install --user pexpect # imported by tools/ci.py
- travis_retry python2 -m pip install --user pygments
# Python 3 modules
- travis_retry python3 -m pip install --user setuptools --upgrade
- travis_retry python3 -m pip install --user pytest
- travis_retry python3 -m pip install --user pylint
- travis_retry python3 -m pip install --user unittest2
- travis_retry python3 -m pip install --user pexpect # imported by tools/ci.py
- travis_retry python3 -m pip install --user requests # imported by tools/pr.py
- travis_retry python3 -m pip install --user pygments
- travis_retry sudo python3 -m pip install demjson # installs jsonlint => sudo required
- travis_retry python3 -m pip install --user natsort
matrix:
# do notify immediately about it when a job of a build fails.
fast_finish: true
allow_failures:
- name: "rerun dmake?"
compiler: clang
# defined extra jobs that run besides what is configured in the build matrix
include:
# -fsanitize=undefined
- name: "undefined behaviour sanitizers"
compiler: gcc
script:
- CXXFLAGS="-fsanitize=undefined -fno-sanitize-recover=all -Og -g3" make cppcheck check checkcfg -j 2 -s
# -fsanitize=address
- name: "address sanitizers"
compiler: gcc
script:
- CXXFLAGS="-fsanitize=address -Og -g3" make cppcheck check checkcfg -j 2 -s
# check a lot of stuff that only needs to be checked in a single configuration
- name: "misc"
compiler: clang
script:
- make -j 2 -s
# run extra tests
- tools/generate_and_run_more_tests.sh
# check for missing CWE entries
- make checkCWEEntries
# check cfg files
- make checkcfg
# check platform files
- make validatePlatforms
# Validate Result XML
- make validateXML
2019-09-21 21:42:13 +02:00
# Validate rule files
- make validateRules
# check htmlreport stuff
- ./htmlreport/test_htmlreport.py
- cd htmlreport
- ./check.sh
- cd ../
# check if DESTDIR works TODO: actually execute this
- mkdir install_test
- echo $CXXFLAGS
- make -s DESTDIR=install_test FILESDIR=/usr/share/cppcheck install
# rm everything
- git clean -dfx
# check what happens if we want to install it to some other dir,
- echo $CXXFLAGS
- make -s MATCHCOMPILER=yes FILESDIR=/usr/share/cppcheck -j 2
- sudo make MATCHCOMPILER=yes FILESDIR=/usr/share/cppcheck install
# check if it actually works:
- /usr/bin/cppcheck ./cli
# check if showtime=top5 works
- ./tools/test_showtimetop5.sh
# check matchcompiler
- ./tools/test_matchcompiler.py
# check --dump
- ${CPPCHECK} test/testpreprocessor.cpp --dump
- xmllint --noout test/testpreprocessor.cpp.dump
# check python syntax by compiling all addon scripts
- python -m compileall ./addons
- python3 -m compileall ./addons
# run pylint
- pylint --rcfile=pylintrc_travis addons/*.py
- pylint --rcfile=pylintrc_travis htmlreport/cppcheck-htmlreport
- pylint --rcfile=pylintrc_travis htmlreport/*.py
- pylint --rcfile=pylintrc_travis --ignore=donate-cpu-server.py --ignore=donate-cpu.py --ignore=donate_cpu_lib.py --ignore=test-my-pr.py tools/*.py
- python3 -m pylint --rcfile=pylintrc_travis addons/*.py
- python3 -m pylint --rcfile=pylintrc_travis htmlreport/cppcheck-htmlreport
- python3 -m pylint --rcfile=pylintrc_travis htmlreport/*.py
- python3 -m pylint --rcfile=pylintrc_travis tools/*.py
# check python syntax by compiling some selected scripts
- python3 -m py_compile ./tools/donate-cpu.py
- python3 -m py_compile ./tools/donate-cpu-server.py
# check addons/misc.py
- cd addons/test
- ${CPPCHECK} --dump misc-test.cpp
- python3 ../misc.py -verify misc-test.cpp.dump
- cd ../../
# check addons/cert.py
- cd addons/test
- ${CPPCHECK} --dump cert-test.c
- python3 ../cert.py -verify cert-test.c.dump
- ${CPPCHECK} --dump cert-test.cpp
- python3 ../cert.py -verify cert-test.cpp.dump
- cd ../../
# check addons/misra.py
- cd addons/test
# We'll force C89 standard to enable an additional verification for
# rules 5.4 and 5.5 which have standard-dependent options.
- ${CPPCHECK} --dump misra/misra-test.c --std=c89
- python3 ../misra.py -verify misra/misra-test.c.dump
- ${CPPCHECK} --dump misra/misra-test.cpp
- python3 ../misra.py -verify misra/misra-test.cpp.dump
- python ../misra.py --rule-texts=misra/misra2012_rules_dummy_ascii.txt -verify misra/misra-test.cpp.dump
- python3 ../misra.py --rule-texts=misra/misra2012_rules_dummy_ascii.txt -verify misra/misra-test.cpp.dump
- python ../misra.py --rule-texts=misra/misra2012_rules_dummy_utf8.txt -verify misra/misra-test.cpp.dump
- python3 ../misra.py --rule-texts=misra/misra2012_rules_dummy_utf8.txt -verify misra/misra-test.cpp.dump
- python ../misra.py --rule-texts=misra/misra2012_rules_dummy_windows1250.txt -verify misra/misra-test.cpp.dump
- python3 ../misra.py --rule-texts=misra/misra2012_rules_dummy_windows1250.txt -verify misra/misra-test.cpp.dump
- cd ../../
# check addons/naming.py
- cd addons/test
- ${CPPCHECK} --dump naming_test.c
- python3 ../naming.py --var='[a-z].*' --function='[a-z].*' naming_test.c.dump
- ${CPPCHECK} --dump naming_test.cpp
- python3 ../naming.py --var='[a-z].*' --function='[a-z].*' naming_test.cpp.dump
- cd ../..
# check addons/namingng.py
- cd addons/test
- ${CPPCHECK} --dump namingng_test.c
- python3 ../namingng.py --configfile ../naming.json --verify namingng_test.c.dump
- cd ../..
# try CMake
- mkdir cmake.output
- cd cmake.output
- cmake -G "Unix Makefiles" -DBUILD_TESTS=On ..
- make -j2 check
- cd ..
# -funsigned-char
- make clean
- make -j2 CXXFLAGS=-funsigned-char testrunner
- ./testrunner TestSymbolDatabase
# check .json files
- find . -name '*.json' -not -path '*/\.*' | xargs jsonlint -s
# check if dmake needs to be rerun (this job may fail)
- name: "rerun dmake?"
compiler: clang
# we don't need to install any deps for dmake so skip it explicitly
before_install:
- true
script:
- echo "If the following command fails, run 'make dmake; make run-dmake' and commit the resulting change."
- make -s dmake -j2
- make -s run-dmake
- git diff --exit-code
# check if cppcheck builds on trusty
- name: "make ubuntu 14.04 trusty"
compiler: gcc
dist: trusty
before_install:
- travis_retry sudo apt-get update -qq
- travis_retry sudo apt-get install libxml2-utils libpcre3
script:
- CXX=g++ CXXFLAGS="${ORIGINAL_CXXFLAGS}" make cppcheck check -j 2 -s
- make clean
- CXX=clang++ CXXFLAGS="${ORIGINAL_CXXFLAGS}" make cppcheck check -j 2 -s
2019-01-12 21:35:01 +01:00
# check if cppcheck builds on osx
- name: "make osx"
os: osx
before_install:
- true
script:
- CXX=g++ CXXFLAGS="${ORIGINAL_CXXFLAGS}" make cppcheck check -j 2 -s
2019-01-12 21:35:01 +01:00
- make clean
- CXX=clang++ CXXFLAGS="${ORIGINAL_CXXFLAGS}" make cppcheck check -j 2 -s
script:
# fail the entire job as soon as one of the subcommands exits non-zero to save time and resources
- set -e
# 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
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 check -j2 CPPFLAGS=-DTEST_MATHLIB_VALUE
2015-07-31 15:33:27 +02:00
- touch lib/mathlib.cpp test/testmathlib.cpp
2019-07-14 22:49:37 +02:00
# syntax checking of cppcheck source code with -DNONNEG
- ls lib/*.cpp | xargs -n 1 -P 2 g++ -fsyntax-only -std=c++0x -Ilib -Iexternals -Iexternals/simplecpp -Iexternals/tinyxml -DNONNEG
# compile cppcheck, default build
- echo $CXXFLAGS
- make -s check -j2
# compile gui
2013-10-07 16:58:53 +02:00
- cd gui
- qmake
- echo $CXXFLAGS
- make -s -j2
# building gui generates some more files that cppcheck can check, so check the repo *after* building gui
- cd ../
# self check lib/cli
- mkdir b1
- ${CPPCHECK} -q -j2 --template=gcc --cppcheck-build-dir=b1 -D__CPPCHECK__ --error-exitcode=1 --inline-suppr --suppressions-list=.travis_suppressions --library=cppcheck-lib --addon=naming.json -Ilib -Iexternals/simplecpp/ -Iexternals/tinyxml/ -Icli --inconclusive --enable=style,performance,portability,warning,internal --exception-handling cli lib
# check gui with qt settings
- mkdir b2
- ${CPPCHECK} -q -j2 --template=gcc --cppcheck-build-dir=b2 -D__CPPCHECK__ -DQT_VERSION=0x050000 --error-exitcode=1 --inline-suppr --suppressions-list=.travis_suppressions --library=qt --addon=naming.json -Ilib -Iexternals/simplecpp/ -Iexternals/tinyxml/ --enable=style,performance,portability,warning,internal --exception-handling gui/*.cpp
# self check test and tools
- ${CPPCHECK} -q -j2 --template=gcc -D__CPPCHECK__ --error-exitcode=1 --inline-suppr --suppressions-list=.travis_suppressions --library=cppcheck-lib -Ilib -Iexternals/simplecpp/ -Iexternals/tinyxml/ -Icli --inconclusive --enable=style,performance,portability,warning,internal --exception-handling test/*.cpp tools
# Build gui
- 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 -j2
2013-10-07 16:58:53 +02:00
- cd ../
2019-04-19 07:56:10 +02:00
# Build gui/test
2019-04-20 19:07:14 +02:00
- cd gui/test/projectfile
- qmake && make -s -j2 && ./test-projectfile
2019-04-20 19:07:14 +02:00
- cd -
# Build triage
- cd ./tools/triage
- git clean -dfx .
- qmake
- make -s -j2
- cd ../../
# Testing cli
2019-06-22 19:20:15 +02:00
- cp -R . ../cppcheck\ 2
- cd ../cppcheck\ 2/test/cli # path with space
2019-04-17 09:04:51 +02:00
- python -m pytest test-*.py
2019-06-22 19:20:15 +02:00
- cd -
# Testing addons
- python -m pytest addons/test/test-*.py
- PYTHONPATH=./addons python3 -m pytest addons/test/test-*.py
2013-02-11 19:32:53 +01:00
notifications:
irc:
channels:
- "irc.freenode.org#cppcheck"
template:
- "[%{commit} : %{author}] %{message}"
- "%{build_url}"
skip_join: true