2012-09-02 11:37:18 +02:00
|
|
|
language: cpp
|
2019-03-20 15:30:01 +01:00
|
|
|
dist: xenial
|
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:
|
2020-04-08 14:56:12 +02:00
|
|
|
- ORIGINAL_CXXFLAGS="-pedantic -Wall -Wextra -Wcast-qual -Wno-deprecated-declarations -Wfloat-equal -Wmissing-declarations -Wmissing-format-attribute -Wno-long-long -Wpacked -Wredundant-decls -Wundef -Wno-shadow -Wno-missing-field-initializers -Wno-missing-braces -Wno-sign-compare -Wno-multichar -D_GLIBCXX_DEBUG -g "
|
2015-11-10 20:44:24 +01:00
|
|
|
# unfortunately we need this to stay within 50min timelimit given by travis.
|
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
|
2019-10-16 13:46:23 +02:00
|
|
|
- ASAN_OPTIONS=detect_stack_use_after_return=1
|
|
|
|
- UBSAN_OPTIONS=print_stacktrace=1
|
2014-01-04 11:37:03 +01:00
|
|
|
matrix:
|
2014-05-24 10:22:59 +02:00
|
|
|
- CXXFLAGS="${CXXFLAGS} -DCHECK_INTERNAL"
|
2019-06-23 13:43:09 +02:00
|
|
|
- CXXFLAGS="${CXXFLAGS} -DCHECK_INTERNAL" MAKEFLAGS="HAVE_RULES=yes" MATCHCOMPILER=yes VERIFY=1
|
2014-03-17 13:23:29 +01:00
|
|
|
|
2019-01-12 16:30:47 +01:00
|
|
|
before_install:
|
|
|
|
# install needed deps
|
2019-03-21 13:51:14 +01:00
|
|
|
- travis_retry sudo apt-get update -qq
|
2020-09-05 18:29:19 +02:00
|
|
|
- travis_retry sudo apt-get install -qq python3-pip 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
|
2019-09-19 20:46:16 +02:00
|
|
|
# Python 2 modules
|
2019-07-26 15:40:25 +02:00
|
|
|
- travis_retry python2 -m pip install --user pytest==4.6.4
|
2019-07-18 20:51:58 +02:00
|
|
|
- travis_retry python2 -m pip install --user pylint
|
2019-07-24 21:09:53 +02:00
|
|
|
- travis_retry python2 -m pip install --user unittest2
|
2019-10-26 21:10:21 +02:00
|
|
|
- travis_retry python2 -m pip install --user pexpect # imported by tools/ci.py
|
2019-11-01 09:10:10 +01:00
|
|
|
- travis_retry python2 -m pip install --user pygments
|
2019-09-19 20:46:16 +02:00
|
|
|
# Python 3 modules
|
2019-10-26 21:10:21 +02:00
|
|
|
- travis_retry python3 -m pip install --user setuptools --upgrade
|
2019-09-19 20:46:16 +02:00
|
|
|
- travis_retry python3 -m pip install --user pytest
|
2019-10-26 21:10:21 +02:00
|
|
|
- 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
|
2019-11-01 09:10:10 +01:00
|
|
|
- travis_retry python3 -m pip install --user pygments
|
2020-01-26 18:39:37 +01:00
|
|
|
- travis_retry python3 -m pip install --user natsort
|
2020-05-13 04:45:18 +02:00
|
|
|
- cp externals/z3_version_old.h externals/z3_version.h # because travis z3 version is old
|
2019-01-12 16:30:47 +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
|
2017-11-27 11:49:22 +01:00
|
|
|
allow_failures:
|
2019-01-09 09:54:46 +01:00
|
|
|
- name: "rerun dmake?"
|
|
|
|
compiler: clang
|
2019-01-11 19:47:17 +01:00
|
|
|
# defined extra jobs that run besides what is configured in the build matrix
|
2019-01-09 09:54:46 +01:00
|
|
|
include:
|
2020-05-07 18:55:22 +02:00
|
|
|
|
2019-01-09 09:54:46 +01:00
|
|
|
# check a lot of stuff that only needs to be checked in a single configuration
|
|
|
|
- name: "misc"
|
|
|
|
compiler: clang
|
|
|
|
script:
|
2020-01-12 08:10:06 +01:00
|
|
|
- make -j 2 -s
|
2019-01-09 09:54:46 +01:00
|
|
|
# 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
|
2019-10-30 18:01:39 +01:00
|
|
|
# check htmlreport stuff
|
2020-11-04 21:03:46 +01:00
|
|
|
- python2 htmlreport/test_htmlreport.py
|
|
|
|
- python3 htmlreport/test_htmlreport.py
|
2019-10-30 18:01:39 +01:00
|
|
|
- cd htmlreport
|
2020-11-04 21:03:46 +01:00
|
|
|
- PYTHON=python2 ./check.sh
|
|
|
|
- PYTHON=python3 ./check.sh
|
2019-10-30 18:01:39 +01:00
|
|
|
- cd ../
|
2019-01-09 09:54:46 +01:00
|
|
|
# check if DESTDIR works TODO: actually execute this
|
|
|
|
- mkdir install_test
|
|
|
|
- echo $CXXFLAGS
|
2019-08-17 17:25:41 +02:00
|
|
|
- make -s DESTDIR=install_test FILESDIR=/usr/share/cppcheck install
|
2019-01-09 09:54:46 +01:00
|
|
|
# rm everything
|
|
|
|
- git clean -dfx
|
|
|
|
# check what happens if we want to install it to some other dir,
|
|
|
|
- echo $CXXFLAGS
|
2019-08-17 10:53:07 +02:00
|
|
|
- make -s MATCHCOMPILER=yes FILESDIR=/usr/share/cppcheck -j 2
|
|
|
|
- sudo make MATCHCOMPILER=yes FILESDIR=/usr/share/cppcheck install
|
2019-01-09 09:54:46 +01:00
|
|
|
# check if it actually works:
|
|
|
|
- /usr/bin/cppcheck ./cli
|
|
|
|
# check if showtime=top5 works
|
|
|
|
- ./tools/test_showtimetop5.sh
|
|
|
|
# check matchcompiler
|
2020-05-16 07:33:55 +02:00
|
|
|
- python2 tools/test_matchcompiler.py
|
|
|
|
- python3 tools/test_matchcompiler.py
|
2019-01-09 09:54:46 +01:00
|
|
|
# check --dump
|
|
|
|
- ${CPPCHECK} test/testpreprocessor.cpp --dump
|
|
|
|
- xmllint --noout test/testpreprocessor.cpp.dump
|
2020-08-21 19:43:19 +02:00
|
|
|
# run pylint -- FIXME these are temporarily commented out because there is a syntax error in 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
|
2019-02-25 16:11:14 +01:00
|
|
|
# check python syntax by compiling some selected scripts
|
|
|
|
- python3 -m py_compile ./tools/donate-cpu.py
|
2019-02-28 13:34:23 +01:00
|
|
|
- python3 -m py_compile ./tools/donate-cpu-server.py
|
2019-03-14 14:49:02 +01:00
|
|
|
# check addons/misc.py
|
2019-01-09 09:54:46 +01:00
|
|
|
- cd addons/test
|
|
|
|
- ${CPPCHECK} --dump misc-test.cpp
|
|
|
|
- python3 ../misc.py -verify misc-test.cpp.dump
|
2019-03-14 14:49:02 +01:00
|
|
|
- cd ../../
|
|
|
|
# check addons/cert.py
|
|
|
|
- cd addons/test
|
2019-01-09 09:54:46 +01:00
|
|
|
- ${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
|
2019-03-14 14:49:02 +01:00
|
|
|
- cd ../../
|
|
|
|
# check addons/misra.py
|
|
|
|
- cd addons/test
|
2020-01-31 23:38:42 +01:00
|
|
|
# We'll force C89 standard to enable an additional verification for
|
|
|
|
# rules 5.4 and 5.5 which have standard-dependent options.
|
2020-05-20 18:30:29 +02:00
|
|
|
- ${CPPCHECK} --dump --suppress=uninitvar --suppress=uninitStructMember --std=c89 misra/misra-test.c
|
2019-07-26 06:38:03 +02:00
|
|
|
- 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
|
2019-01-09 09:54:46 +01:00
|
|
|
- cd ../../
|
2019-03-26 18:54:09 +01:00
|
|
|
# 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
|
2019-11-18 18:41:57 +01:00
|
|
|
- ${CPPCHECK} --dump naming_test.cpp
|
|
|
|
- python3 ../naming.py --var='[a-z].*' --function='[a-z].*' naming_test.cpp.dump
|
2019-03-26 18:54:09 +01:00
|
|
|
- cd ../..
|
2019-01-09 09:54:46 +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 ../..
|
2020-09-05 18:29:19 +02:00
|
|
|
|
|
|
|
# bug hunting
|
|
|
|
- name: "bug hunting"
|
|
|
|
compiler: gcc
|
|
|
|
script:
|
2019-10-06 12:05:58 +02:00
|
|
|
- make clean
|
2020-09-05 18:29:19 +02:00
|
|
|
- make USE_Z3=yes -j2 all
|
|
|
|
- ./testrunner TestExprEngine
|
|
|
|
- python3 test/bug-hunting/cve.py
|
|
|
|
- git clone https://github.com/regehr/itc-benchmarks.git ~/itc
|
|
|
|
- python3 test/bug-hunting/itc.py
|
|
|
|
- mkdir ~/juliet
|
|
|
|
- curl https://samate.nist.gov/SARD/testsuites/juliet/Juliet_Test_Suite_v1.3_for_C_Cpp.zip -o ~/juliet/juliet.zip
|
|
|
|
- cd ~/juliet
|
|
|
|
- unzip -qq ~/juliet/juliet.zip
|
|
|
|
- cd -
|
|
|
|
- python3 test/bug-hunting/juliet.py
|
2014-03-17 13:23:29 +01:00
|
|
|
|
2019-01-09 09:54:46 +01:00
|
|
|
# check if dmake needs to be rerun (this job may fail)
|
|
|
|
- name: "rerun dmake?"
|
|
|
|
compiler: clang
|
2019-01-11 19:47:17 +01:00
|
|
|
# we don't need to install any deps for dmake so skip it explicitly
|
|
|
|
before_install:
|
|
|
|
- true
|
2019-01-09 09:54:46 +01:00
|
|
|
script:
|
|
|
|
- echo "If the following command fails, run 'make dmake; make run-dmake' and commit the resulting change."
|
2019-01-11 19:47:17 +01:00
|
|
|
- make -s dmake -j2
|
2019-01-09 09:54:46 +01:00
|
|
|
- make -s run-dmake
|
|
|
|
- git diff --exit-code
|
2019-03-20 15:30:01 +01:00
|
|
|
# check if cppcheck builds on trusty
|
|
|
|
- name: "make ubuntu 14.04 trusty"
|
|
|
|
compiler: gcc
|
|
|
|
dist: trusty
|
|
|
|
before_install:
|
2019-03-21 13:51:14 +01:00
|
|
|
- travis_retry sudo apt-get update -qq
|
|
|
|
- travis_retry sudo apt-get install libxml2-utils libpcre3
|
2019-03-20 15:30:01 +01:00
|
|
|
script:
|
2020-01-12 08:10:06 +01:00
|
|
|
- CXX=g++ CXXFLAGS="${ORIGINAL_CXXFLAGS}" make cppcheck check -j 2 -s
|
2019-03-20 15:30:01 +01:00
|
|
|
- make clean
|
2020-01-12 08:10:06 +01:00
|
|
|
- CXX=clang++ CXXFLAGS="${ORIGINAL_CXXFLAGS}" make cppcheck check -j 2 -s
|
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
|
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
|
2020-01-12 08:10:06 +01:00
|
|
|
- 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
|
2020-11-16 09:11:08 +01:00
|
|
|
- ls lib/*.cpp | xargs -n 1 -P 2 g++ -fsyntax-only -std=c++0x -Ilib -Iexternals -Iexternals/picojson -Iexternals/simplecpp -Iexternals/tinyxml2 -DNONNEG
|
2015-10-14 10:50:53 +02:00
|
|
|
# compile cppcheck, default build
|
2017-06-06 22:54:16 +02:00
|
|
|
- echo $CXXFLAGS
|
2020-01-12 08:10:06 +01:00
|
|
|
- make -s check -j2
|
2019-04-14 12:49:43 +02:00
|
|
|
# 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 -
|
2019-06-17 21:17:29 +02:00
|
|
|
# Testing addons
|
|
|
|
- python -m pytest addons/test/test-*.py
|
2019-09-19 20:46:16 +02:00
|
|
|
- PYTHONPATH=./addons python3 -m pytest addons/test/test-*.py
|
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
|