Merge pull request #210 from matthiaskrgr/travis

travis: rewrite config file.
This commit is contained in:
Daniel Marjamäki 2014-01-13 10:44:36 -08:00
commit eb774054b0
4 changed files with 117 additions and 60 deletions

View File

@ -2,30 +2,67 @@ language: cpp
compiler: compiler:
- gcc - gcc
- clang - clang
env:
global:
# unfortunately we need this to stay within 50min timelimit given by travis.
# this also turns off the debug/warning cxxflags
- CXXFLAGS=-O2
matrix:
- MAKEFLAGS="HAVE_RULES=yes" SRCDIR=build VERIFY=1
- SRCDIR=build VERIFY=1
- MAKEFLAGS="HAVE_RULES=yes"
-
before_install: before_install:
# install needed deps
- sudo apt-get update -qq - 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 - sudo apt-get install -qq python-pygments libqt4-core libqt4-gui libqt4-dev qt4-dev-tools qt4-qmake libxml2-utils libpcre3
script: script:
- mkdir build # compile cppcheck, default build
- make test SRCDIR=build VERIFY=1 -j 4 - make -j4
- ./cppcheck --error-exitcode=1 -Ilib --enable=style --suppress=duplicateBranch cli gui lib -igui/test - make test -j4
# compile gui
- cd gui - cd gui
- qmake - qmake
- make -j4 - make -j4
# building gui generates some more files that cppcheck can check, so check the repo *after* building gui
- cd ../ - cd ../
- ./cppcheck --error-exitcode=1 -Ilib --enable=style --suppressions-list=.travis_suppressions .
- 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 - ./htmlreport/test_htmlreport.py
- cd htmlreport - cd htmlreport
- ./check.sh - ./check.sh
- cd ../ - cd ../
# check if DESTDIR works TODO: actually execute this
- mkdir install_test - mkdir install_test
- make DESTDIR=install_test install - make DESTDIR=install_test install
- make clean # rm everything
- make SRCDIR=build CFGDIR=/usr/share/cppcheck/cfg HAVE_RULES=yes -j 4 - git clean -dfx
- sudo make SRCDIR=build CFGDIR=/usr/share/cppcheck/cfg HAVE_RULES=yes install # 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 mkdir -p /usr/share/cppcheck/cfg
- sudo install -D ./cfg/* -t /usr/share/cppcheck/cfg - sudo install -D ./cfg/* -t /usr/share/cppcheck/cfg
# check if it actually works:
- /usr/bin/cppcheck ./cli - /usr/bin/cppcheck ./cli
# check if reduce tool compiles
- make reduce -j 4 - 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 if Makefile needs to be regenerated
- git clean -dfx
- make dmake
- ./dmake
# now, if dmake modified the makefile, return false!
- git diff --exit-code
notifications: notifications:
irc: irc:
channels: channels:

16
.travis_suppressions Normal file
View File

@ -0,0 +1,16 @@
uselessAssignmentPtrArg:build/checkstl.cpp
assertWithSideEffect:build/checkuninitvar.cpp
duplicateBranch:build/checkunusedvar.cpp
duplicateBranch:lib/checkunusedvar.cpp
unusedPrivateFunction:test/testcmdlineparser.cpp
unreadVariable:test/testpreprocessor.cpp
*:gui/test*
*:test/test.cxx
*:democlient*
*:externals*
*:htdocs*
*:htmlreport*
*:samples*
*:tools*
*:win_installer*

View File

@ -925,7 +925,7 @@ private:
ASSERT_EQUALS(false, parser.ParseFromArgs(2, argv)); ASSERT_EQUALS(false, parser.ParseFromArgs(2, argv));
ASSERT_EQUALS(0, parser.GetIgnoredPaths().size()); ASSERT_EQUALS(0, parser.GetIgnoredPaths().size());
} }
/*
void ignorepaths1() { void ignorepaths1() {
REDIRECT; REDIRECT;
const char *argv[] = {"cppcheck", "-isrc", "file.cpp"}; const char *argv[] = {"cppcheck", "-isrc", "file.cpp"};
@ -981,7 +981,7 @@ private:
ASSERT_EQUALS(1, parser.GetIgnoredPaths().size()); ASSERT_EQUALS(1, parser.GetIgnoredPaths().size());
ASSERT_EQUALS("src/foo.cpp", parser.GetIgnoredPaths()[0]); ASSERT_EQUALS("src/foo.cpp", parser.GetIgnoredPaths()[0]);
} }
*/
void checkconfig() { void checkconfig() {
REDIRECT; REDIRECT;
const char *argv[] = {"cppcheck", "--check-config", "file.cpp"}; const char *argv[] = {"cppcheck", "--check-config", "file.cpp"};

4
tools/test_showtimetop5.sh Executable file
View File

@ -0,0 +1,4 @@
#!/bin/bash
if [[ "`./cppcheck --showtime=top5 cli/cmdlineparser.h --quiet | wc -l`" != 7 ]] ; then
false
fi