language: cpp dist: xenial compiler: - gcc - clang env: global: - 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" # 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 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 - 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 # Python 2 modules - travis_retry python2 -m pip install --user pytest==4.6.4 - 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 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 python3 -m pip install --user natsort - cp externals/z3_version_old.h externals/z3_version.h # because travis z3 version is old matrix: # do notify immediately about it when a job of a build fails. fast_finish: true # defined extra jobs that run besides what is configured in the build matrix include: # check a lot of stuff that only needs to be checked in a single configuration - name: "misc" compiler: clang script: - make -j$(nproc) -s # 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$(nproc) - sudo make MATCHCOMPILER=yes FILESDIR=/usr/share/cppcheck install # check if it actually works: - /usr/bin/cppcheck -j$(nproc) ./cli # 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 --suppress=uninitvar --suppress=uninitStructMember --std=c89 misra/misra-test.c - ${CPPCHECK} --dump --suppress=uninitvar --suppress=uninitStructMember --std=c89 misra/misra-test.h - 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 ../.. # bug hunting - name: "bug hunting" compiler: gcc script: - make clean - make USE_Z3=yes -j$(nproc) all - ./testrunner TestExprEngine # FIXME: this is slowish #- 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 script: # fail the entire job as soon as one of the subcommands exits non-zero to save time and resources - set -e # check with TEST_MATHLIB_VALUE enabled - touch lib/mathlib.cpp test/testmathlib.cpp - echo $CXXFLAGS - make -s check -j$(nproc) CPPFLAGS=-DTEST_MATHLIB_VALUE - touch lib/mathlib.cpp test/testmathlib.cpp # compile cppcheck, default build - echo $CXXFLAGS - make -s check -j$(nproc)