forked from danmar/cppcheck
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
105 lines (99 loc) · 4.64 KB
/
.travis.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
language: cpp
compiler:
- clang
- gcc
env:
global:
# unfortunately we need this to stay within 50min timelimit given by travis.
# this also turns off the debug/warning cxxflags
- CXXFLAGS="-O2 -march=native -mtune=native -Wunreachable-code"
matrix:
# 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
- CXXFLAGS="${CXXFLAGS} -DCHECK_INTERNAL"
- SRCDIR=build CHECK_CLANG=yes VERIFY=1
- CXXFLAGS="${CXXFLAGS} -DCHECK_INTERNAL" MAKEFLAGS="HAVE_RULES=yes" SRCDIR=build VERIFY=1
matrix:
# do notify immediately about it when a job of a build fails.
fast_finish: true
# exclude clang checking with clang binary, not needed
exclude:
- compiler: clang
env: SRCDIR=build CHECK_CLANG=yes VERIFY=1
before_install:
# install needed deps
- sudo apt-get update -qq
- sudo apt-get install -qq python-pygments libqt4-core libqt4-gui libqt4-dev qt4-dev-tools qt4-qmake libxml2-utils libpcre3 gdb unzip
script:
# download clang git, compile cppcheck, run cppcheck on clang code to look for crashes in cppcheck. if this is done, terminate build
- if [[ "$CHECK_CLANG" == "yes" ]] && [[ "$CC" == "gcc" ]]; then wget "https://github.com/llvm-mirror/clang/archive/c2ca783d8b070d01b8d30b6c1d447563a6412af5.zip" & make -j 4 & wait; unzip c2ca783d8b070d01b8d30b6c1d447563a6412af5.zip > /dev/null; touch /tmp/clang.cppcheck; cd ./clang-c2ca783d8b070d01b8d30b6c1d447563a6412af5 ; ../cppcheck . --max-configs=1 --enable=all --inconclusive --exception-handling -iINPUTS -itest/Driver/Inputs/gen-response.c -j 2 |& tee /tmp/clang.cppcheck; cd ../; fi
# check llvm as well
- if [[ "$CHECK_CLANG" == "yes" ]] && [[ "$CC" == "gcc" ]]; then wget "https://github.com/llvm-mirror/llvm/archive/1de675f473fb5c392d06e03cec4e8ee621e544ae.zip"; unzip 1de675f473fb5c392d06e03cec4e8ee621e544ae.zip > /dev/null; touch /tmp/llvm.cppcheck; cd ./llvm-1de675f473fb5c392d06e03cec4e8ee621e544ae ; ../cppcheck . --max-configs=1 --enable=all --inconclusive --exception-handling -j 2 |& tee /tmp/llvm.cppcheck; cd ../ ; echo "LLVM " ; ! grep "process crashed with signal\|Internal error\. compiled" /tmp/llvm.cppcheck; echo "CLANG " ; ! grep "process crashed with signal\|Internal error\. compiled" /tmp/clang.cppcheck; exit; fi
# check with TEST_MATHLIB_VALUE enabled
- touch lib/mathlib.cpp test/testmathlib.cpp
- make test -j4 CPPFLAGS=-DTEST_MATHLIB_VALUE
- touch lib/mathlib.cpp test/testmathlib.cpp
# compile cppcheck, default build
- make test -j4
# compile gui
- cd gui
- qmake
- make -j4
# building gui generates some more files that cppcheck can check, so check the repo *after* building gui
- cd ../
# 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
- touch /tmp/cppcheck.cppcheck
- ./cppcheck --error-exitcode=1 -Ilib --enable=style,performance,portability,warning,internal --exception-handling --suppressions-list=.travis_suppressions -itest/synthetic . -j 2 |& tee /tmp/cppcheck.cppcheck
- sh -c "! grep '^\[' /tmp/cppcheck.cppcheck"
# run extra tests
- tools/generate_and_run_more_tests.sh
# check test/cfg
- make checkcfg
- cd ./gui
# clean rebuild
- git clean -dfx .
# can't set this as env flags, so try again with HAVE_RULES=yes
- qmake HAVE_RULES=yes
- make -j4
- cd ../
# check htmlreport stuff
- ./htmlreport/test_htmlreport.py
- cd htmlreport
- ./check.sh
- cd ../
# check if DESTDIR works TODO: actually execute this
- mkdir install_test
- make DESTDIR=install_test install
# rm everything
- git clean -dfx
# check what happens if we want to install it to some other dir,
- make SRCDIR=build CFGDIR=/usr/share/cppcheck/cfg -j 4
- sudo make SRCDIR=build CFGDIR=/usr/share/cppcheck/cfg install
- sudo mkdir -p /usr/share/cppcheck/cfg
- sudo install -D ./cfg/* -t /usr/share/cppcheck/cfg
# check if it actually works:
- /usr/bin/cppcheck ./cli
# check if reduce tool compiles
- make reduce -j 4
# check if showtime=top5 works
- ./tools/test_showtimetop5.sh
# check the files in cgf dir with xmllint
- xmllint --noout cfg/*
# check matchcompiler
- ./tools/test_matchcompiler.py
# check --dump
- ./cppcheck test/testpreprocessor.cpp --dump
- xmllint --noout test/testpreprocessor.cpp.dump
# check if Makefile needs to be regenerated
- git clean -dfx
- make dmake
- make run-dmake
# now, if dmake modified the makefile, return false!
- git diff --exit-code
notifications:
irc:
channels:
- "irc.freenode.org#cppcheck"
template:
- "[%{commit} : %{author}] %{message}"
- "%{build_url}"
skip_join: true