Skip to content
Snippets Groups Projects
Commit 18ebb807 authored by Giovanni Bussi's avatar Giovanni Bussi
Browse files

Added cppcheck to travis

cppcheck is installed from its github when needed

Notice that the travis test doing cppcheck also does a normal g++ check.
I did to avoid too many if's in the travis script, but should be fixed perhaps
so that the last travis test only does cppcheck

I set this test as "allowed_failures", so that is just gives a warning now
parent 7d980700
No related branches found
No related tags found
No related merge requests found
#! /bin/bash
set -e
set -x
git clone https://github.com/danmar/cppcheck.git
cd cppcheck
if [ -n "$1" ] ; then
echo "installing cppcheck $version"
version=$1
else
echo "installing latest doxygen"
version=$(git tag | tail -n 1)
fi
git checkout $tag
sudo make -j 4 install CFGDIR=/usr/share/cppcheck/
cd ../
......@@ -15,6 +15,13 @@ env:
- PLUMED_CC=clang PLUMED_CXX=clang++ PLUMED_CXXFLAGS=-O3 LAPACK=yes
- PLUMED_CC=gcc PLUMED_CXX=g++ PLUMED_CXXFLAGS=-O3 LAPACK=yes
- PLUMED_CC=mpicc PLUMED_CXX=mpic++ PLUMED_CXXFLAGS=-O3 LAPACK=yes
# cppcheck
# in principle we should make only "cppcheck" here
# to avoid to many if's below, I also make a quick test with -O0 here
- PLUMED_CC=gcc PLUMED_CXX=g++ PLUMED_CXXFLAGS=-O0 CPPCHECK=yes
matrix:
allow_failures:
- env: PLUMED_CC=gcc PLUMED_CXX=g++ PLUMED_CXXFLAGS=-O0 CPPCHECK=yes
# Possible additional variables:
# VALGRIND=yes to make valgrind tests, only when log contains string [valgrind]
install:
......@@ -27,6 +34,8 @@ install:
- sudo apt-get install -y libmatheval-dev
# this is not needed (will be used in 2.2)
# - ./.travis.install.xdrfile
# cppcheck:
- test "$CPPCHECK" == yes && ./.travis.install.cppcheck 1.69 || true
# installation of these packages takes a lot of time
# we do it only when needed
- test "$PLUMED_CXX" == "mpic++" && sudo apt-get install -y libopenmpi1.5-dev openmpi1.5-bin || true
......@@ -53,10 +62,12 @@ script:
- make -j 2
# we install plumed so that it is in the path
- sudo make install
# run static analyzer
- test "$VALGRIND" == yes && OPT=valgrind || OPT=""
- make -C regtest $OPT
- test "$MAKEDOC" == yes && make -C regtest copytodoc || true
- test "$MAKEDOC" == yes && make doc >/dev/null || true
- make -C regtest checkfail
- if test "$CPPCHECK" == yes ; then make cppcheck ; fi
after_success:
- test "$MAKEDOC" == yes && ./.travis.pushdoc
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment