Blame .travis.yml

Packit 2035a7
language: cpp
Packit 2035a7
dist: trusty
Packit 2035a7
sudo: required
Packit 2035a7
Packit 2035a7
compiler:
Packit 2035a7
  - gcc
Packit 2035a7
  - clang
Packit 2035a7
Packit 2035a7
env:
Packit 2035a7
  global:
Packit 2035a7
#   unfortunately we need this to stay within 50min timelimit given by travis.
Packit 2035a7
#   this also turns off the debug/warning cxxflags
Packit 2035a7
    - ORIGINAL_CXXFLAGS="-include lib/cxx11emu.h -pedantic -Wall -Wextra -Wabi -Wcast-qual -Wfloat-equal -Wmissing-declarations -Wmissing-format-attribute -Wno-long-long -Wpacked -Wredundant-decls -Wshadow -Wno-missing-field-initializers -Wno-missing-braces -Wno-sign-compare -Wno-multichar -D_GLIBCXX_DEBUG -g "
Packit 2035a7
    - CXXFLAGS="${ORIGINAL_CXXFLAGS} -O2 -march=native -Wstrict-aliasing=2 -Werror=strict-aliasing"
Packit 2035a7
  matrix:
Packit 2035a7
#    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
Packit 2035a7
    - CXXFLAGS="${CXXFLAGS} -DCHECK_INTERNAL"
Packit 2035a7
    - CXXFLAGS="${CXXFLAGS} -DCHECK_INTERNAL" MAKEFLAGS="HAVE_RULES=yes" SRCDIR=build VERIFY=1
Packit 2035a7
    - SRCDIR=build CHECK_CLANG=yes VERIFY=1
Packit 2035a7
    - SRCDIR=build CHECK_LLVM=yes VERIFY=1
Packit 2035a7
    - CHECK_MAKEFILE_REGEN=true
Packit 2035a7
Packit 2035a7
matrix:
Packit 2035a7
# do notify immediately about it when a job of a build fails.
Packit 2035a7
  fast_finish: true
Packit 2035a7
# exclude clang checking with clang binary, not needed
Packit 2035a7
  exclude:
Packit 2035a7
    - compiler: gcc
Packit 2035a7
      env: SRCDIR=build CHECK_CLANG=yes VERIFY=1
Packit 2035a7
    - compiler: gcc
Packit 2035a7
      env: SRCDIR=build CHECK_LLVM=yes VERIFY=1
Packit 2035a7
    - compiler: gcc
Packit 2035a7
      env: CHECK_MAKEFILE_REGEN=true
Packit 2035a7
  allow_failures:
Packit 2035a7
    - compiler: clang
Packit 2035a7
      env: CHECK_MAKEFILE_REGEN=true
Packit 2035a7
Packit 2035a7
before_install:
Packit 2035a7
# install needed deps
Packit 2035a7
 - sudo apt-get update -qq
Packit 2035a7
 - sudo apt-get install -qq python-pygments qt5-default qt5-qmake qtbase5-dev qtcreator libxml2-utils libpcre3 gdb unzip
Packit 2035a7
Packit 2035a7
script:
Packit 2035a7
# fail the entire job as soon as one of the subcommands exits non-zero to save time and resources
Packit 2035a7
  - set -e
Packit 2035a7
# download clang git, compile cppcheck, run cppcheck on clang code to look for crashes in cppcheck. if this is done, terminate build
Packit 2035a7
  - if [[ "$CHECK_CLANG" == "yes" ]] && [[ "$CC" == "clang" ]]; then wget "https://github.com/llvm-mirror/clang/archive/bcaf7f2abe47b0dab055f1a0ec011ed9c2a3d3ea.zip" & make -j 4 & wait; unzip bcaf7f2abe47b0dab055f1a0ec011ed9c2a3d3ea.zip > /dev/null; touch /tmp/clang.cppcheck; cd ./clang-bcaf7f2abe47b0dab055f1a0ec011ed9c2a3d3ea ; ../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 -j 2 |& tee /tmp/clang.cppcheck; cd ../ ; echo "CLANG" ; ! grep "process crashed with signal\|Internal error\. compiled" /tmp/clang.cppcheck; exit; fi
Packit 2035a7
# check llvm as well
Packit 2035a7
  - if [[  "$CHECK_LLVM" == "yes" ]] && [[ "$CC" == "clang" ]]; then wget "https://github.com/llvm-mirror/llvm/archive/7733e74e5454d6f18da28c06be917c1e73d12d01.zip"  & make -j 4 & wait; unzip 7733e74e5454d6f18da28c06be917c1e73d12d01.zip > /dev/null;  touch /tmp/llvm.cppcheck;  cd ./llvm-7733e74e5454d6f18da28c06be917c1e73d12d01 ; ../cppcheck . --max-configs=1 --enable=all --inconclusive --exception-handling --template="{callstack} ({severity}) {message} [{id}]" -j 2 |& tee /tmp/llvm.cppcheck; cd ../ ; echo "LLVM"  ; ! grep "process crashed with signal\|Internal error\. compiled" /tmp/llvm.cppcheck; exit; fi
Packit 2035a7
# check if dmake needs to be rerun but if yes, don't fail the build but notify us.
Packit 2035a7
# to update dmake: "make dmake; ./dmake; and commit
Packit 2035a7
  - echo "If the following command fails, run 'make dmake; make run-dmake' and commit the resulting change."
Packit 2035a7
  - if [[ "$CHECK_MAKEFILE_REGEN" == "true" ]]; then make -s dmake; make -s run-dmake ; git diff --exit-code; exit; fi
Packit 2035a7
# check with TEST_MATHLIB_VALUE enabled
Packit 2035a7
  - touch lib/mathlib.cpp test/testmathlib.cpp
Packit 2035a7
  - echo $CXXFLAGS
Packit 2035a7
  - make -s test -j4 CPPFLAGS=-DTEST_MATHLIB_VALUE
Packit 2035a7
  - touch lib/mathlib.cpp test/testmathlib.cpp
Packit 2035a7
# compile cppcheck, default build
Packit 2035a7
  - echo $CXXFLAGS
Packit 2035a7
  - make -s test -j4
Packit 2035a7
# compile gui
Packit 2035a7
  - cd gui
Packit 2035a7
  - qmake
Packit 2035a7
  - echo $CXXFLAGS
Packit 2035a7
  - make -s -j4
Packit 2035a7
# building gui generates some more files that cppcheck can check, so check the repo *after* building gui
Packit 2035a7
  - cd ../
Packit 2035a7
# 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
Packit 2035a7
  - touch /tmp/cppcheck.cppcheck
Packit 2035a7
  - ./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
Packit 2035a7
# check gui with qt settings
Packit 2035a7
  - ./cppcheck --library=qt  --error-exitcode=1  -Ilib -Iexternals/simplecpp/ -Iexternals/tinyxml/ -Icli --enable=style,performance,portability,warning,internal  --exception-handling -j 2 gui -igui/test |& tee --append /tmp/cppcheck.cppcheck
Packit 2035a7
  - sh -c "! grep '^\[' /tmp/cppcheck.cppcheck"
Packit 2035a7
# run extra tests
Packit 2035a7
  - tools/generate_and_run_more_tests.sh
Packit 2035a7
# check test/cfg
Packit 2035a7
  - make checkcfg
Packit 2035a7
  - make validateCFG
Packit 2035a7
  - cd ./gui
Packit 2035a7
# clean rebuild
Packit 2035a7
  - git clean -dfx .
Packit 2035a7
#     can't set this as env flags, so try again with HAVE_RULES=yes
Packit 2035a7
  - qmake HAVE_RULES=yes
Packit 2035a7
  - echo $CXXFLAGS
Packit 2035a7
  - make -s -j4
Packit 2035a7
  - cd ../
Packit 2035a7
# note: trusty on travis has python pygments disabled so disable these tests on travis
Packit 2035a7
## check htmlreport stuff
Packit 2035a7
#  - ./htmlreport/test_htmlreport.py
Packit 2035a7
#  - cd htmlreport
Packit 2035a7
#  - ./check.sh
Packit 2035a7
#  - cd ../
Packit 2035a7
# check if DESTDIR works  TODO: actually execute this
Packit 2035a7
  - mkdir install_test
Packit 2035a7
  - echo $CXXFLAGS
Packit 2035a7
  - make -s DESTDIR=install_test install
Packit 2035a7
# rm everything
Packit 2035a7
  - git clean -dfx
Packit 2035a7
# check what happens if we want to install it to some other dir,
Packit 2035a7
  - echo $CXXFLAGS
Packit 2035a7
  - make -s SRCDIR=build CFGDIR=/usr/share/cppcheck/cfg -j 4
Packit 2035a7
  - sudo make SRCDIR=build CFGDIR=/usr/share/cppcheck/cfg install
Packit 2035a7
  - sudo mkdir -p /usr/share/cppcheck/cfg
Packit 2035a7
  - sudo install -D ./cfg/* -t /usr/share/cppcheck/cfg
Packit 2035a7
# check if it actually works:
Packit 2035a7
  - /usr/bin/cppcheck ./cli
Packit 2035a7
# check if reduce tool compiles
Packit 2035a7
  - echo $CXXFLAGS
Packit 2035a7
  - make -s reduce -j 4
Packit 2035a7
# check if showtime=top5 works
Packit 2035a7
  - ./tools/test_showtimetop5.sh
Packit 2035a7
# check the files in cgf dir with xmllint
Packit 2035a7
  - xmllint --noout cfg/*
Packit 2035a7
# check matchcompiler
Packit 2035a7
  - ./tools/test_matchcompiler.py
Packit 2035a7
# check --dump
Packit 2035a7
  - ./cppcheck test/testpreprocessor.cpp --dump
Packit 2035a7
  - xmllint --noout test/testpreprocessor.cpp.dump
Packit 2035a7
# check addons/misra.py
Packit 2035a7
#  - ./cppcheck --dump addons/misra-test.c
Packit 2035a7
#  - python addons/misra.py -verify addons/misra-test.c.dump
Packit 2035a7
Packit 2035a7
notifications:
Packit 2035a7
  irc:
Packit 2035a7
    channels:
Packit 2035a7
      - "irc.freenode.org#cppcheck"
Packit 2035a7
    template:
Packit 2035a7
      - "[%{commit} : %{author}] %{message}"
Packit 2035a7
      - "%{build_url}"
Packit 2035a7
    skip_join: true