1language: cpp 2dist: xenial 3 4compiler: 5 - gcc 6 - clang 7 8env: 9 global: 10 - 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" 11# unfortunately we need this to stay within 50min timelimit given by travis. 12 - CXXFLAGS="${ORIGINAL_CXXFLAGS} -O2 -march=native -Wstrict-aliasing=2 -Werror=strict-aliasing" 13 - CPPCHECK=${TRAVIS_BUILD_DIR}/cppcheck 14 matrix: 15 - CXXFLAGS="${CXXFLAGS} -DCHECK_INTERNAL" 16 - CXXFLAGS="${CXXFLAGS} -DCHECK_INTERNAL" MAKEFLAGS="HAVE_RULES=yes" MATCHCOMPILER=yes VERIFY=1 17 18before_install: 19# install needed deps 20 - travis_retry sudo apt-get update -qq 21 - 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 22# Python 2 modules 23 - travis_retry python2 -m pip install --user pytest==4.6.4 24 - travis_retry python2 -m pip install --user unittest2 25 - travis_retry python2 -m pip install --user pexpect # imported by tools/ci.py 26 - travis_retry python2 -m pip install --user pygments 27# Python 3 modules 28 - travis_retry python3 -m pip install --user setuptools --upgrade 29 - travis_retry python3 -m pip install --user pytest 30 - travis_retry python3 -m pip install --user unittest2 31 - travis_retry python3 -m pip install --user pexpect # imported by tools/ci.py 32 - travis_retry python3 -m pip install --user requests # imported by tools/pr.py 33 - travis_retry python3 -m pip install --user pygments 34 - travis_retry python3 -m pip install --user natsort 35 - cp externals/z3_version_old.h externals/z3_version.h # because travis z3 version is old 36 37matrix: 38# do notify immediately about it when a job of a build fails. 39 fast_finish: true 40# defined extra jobs that run besides what is configured in the build matrix 41 include: 42 43# check a lot of stuff that only needs to be checked in a single configuration 44 - name: "misc" 45 compiler: clang 46 script: 47 - make -j$(nproc) -s 48# check if DESTDIR works TODO: actually execute this 49 - mkdir install_test 50 - echo $CXXFLAGS 51 - make -s DESTDIR=install_test FILESDIR=/usr/share/cppcheck install 52# rm everything 53 - git clean -dfx 54# check what happens if we want to install it to some other dir, 55 - echo $CXXFLAGS 56 - make -s MATCHCOMPILER=yes FILESDIR=/usr/share/cppcheck -j$(nproc) 57 - sudo make MATCHCOMPILER=yes FILESDIR=/usr/share/cppcheck install 58# check if it actually works: 59 - /usr/bin/cppcheck -j$(nproc) ./cli 60# check addons/misc.py 61 - cd addons/test 62 - ${CPPCHECK} --dump misc-test.cpp 63 - python3 ../misc.py -verify misc-test.cpp.dump 64 - cd ../../ 65# check addons/cert.py 66 - cd addons/test 67 - ${CPPCHECK} --dump cert-test.c 68 - python3 ../cert.py -verify cert-test.c.dump 69 - ${CPPCHECK} --dump cert-test.cpp 70 - python3 ../cert.py -verify cert-test.cpp.dump 71 - cd ../../ 72# check addons/misra.py 73 - cd addons/test 74 # We'll force C89 standard to enable an additional verification for 75 # rules 5.4 and 5.5 which have standard-dependent options. 76 - ${CPPCHECK} --dump -DDUMMY --suppress=uninitvar --suppress=uninitStructMember --std=c89 misra/misra-test.c 77 - ${CPPCHECK} --dump -DDUMMY --suppress=uninitvar --suppress=uninitStructMember --std=c89 misra/misra-test.h 78 - python3 ../misra.py -verify misra/misra-test.c.dump 79 - ${CPPCHECK} --dump misra/misra-test.cpp 80 - python3 ../misra.py -verify misra/misra-test.cpp.dump 81 - python ../misra.py --rule-texts=misra/misra2012_rules_dummy_ascii.txt -verify misra/misra-test.cpp.dump 82 - python3 ../misra.py --rule-texts=misra/misra2012_rules_dummy_ascii.txt -verify misra/misra-test.cpp.dump 83 - python ../misra.py --rule-texts=misra/misra2012_rules_dummy_utf8.txt -verify misra/misra-test.cpp.dump 84 - python3 ../misra.py --rule-texts=misra/misra2012_rules_dummy_utf8.txt -verify misra/misra-test.cpp.dump 85 - python ../misra.py --rule-texts=misra/misra2012_rules_dummy_windows1250.txt -verify misra/misra-test.cpp.dump 86 - python3 ../misra.py --rule-texts=misra/misra2012_rules_dummy_windows1250.txt -verify misra/misra-test.cpp.dump 87 - cd ../../ 88# check addons/naming.py 89 - cd addons/test 90 - ${CPPCHECK} --dump naming_test.c 91 - python3 ../naming.py --var='[a-z].*' --function='[a-z].*' naming_test.c.dump 92 - ${CPPCHECK} --dump naming_test.cpp 93 - python3 ../naming.py --var='[a-z].*' --function='[a-z].*' naming_test.cpp.dump 94 - cd ../.. 95# check addons/namingng.py 96 - cd addons/test 97 - ${CPPCHECK} --dump namingng_test.c 98 - python3 ../namingng.py --configfile ../naming.json --verify namingng_test.c.dump 99 - cd ../.. 100 101# bug hunting 102 - name: "bug hunting" 103 compiler: gcc 104 script: 105 - make clean 106 - make USE_Z3=yes -j$(nproc) all 107 - ./testrunner TestExprEngine 108 # FIXME: this is slowish 109 #- python3 test/bug-hunting/cve.py 110 #- git clone https://github.com/regehr/itc-benchmarks.git ~/itc 111 #- python3 test/bug-hunting/itc.py 112 #- mkdir ~/juliet 113 #- curl https://samate.nist.gov/SARD/testsuites/juliet/Juliet_Test_Suite_v1.3_for_C_Cpp.zip -o ~/juliet/juliet.zip 114 #- cd ~/juliet 115 #- unzip -qq ~/juliet/juliet.zip 116 #- cd - 117 #- python3 test/bug-hunting/juliet.py 118 119script: 120# fail the entire job as soon as one of the subcommands exits non-zero to save time and resources 121 - set -e 122# check with TEST_MATHLIB_VALUE enabled 123 - touch lib/mathlib.cpp test/testmathlib.cpp 124 - echo $CXXFLAGS 125 - make -s check -j$(nproc) CPPFLAGS=-DTEST_MATHLIB_VALUE 126 - touch lib/mathlib.cpp test/testmathlib.cpp 127# compile cppcheck, default build 128 - echo $CXXFLAGS 129 - make -s check -j$(nproc) 130