From 18ebb807a3e1e55cba60d9ac4c5700d6c6a353f5 Mon Sep 17 00:00:00 2001 From: Giovanni Bussi <giovanni.bussi@gmail.com> Date: Wed, 3 Jun 2015 08:54:58 +0200 Subject: [PATCH] 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 --- .travis.install.cppcheck | 23 +++++++++++++++++++++++ .travis.yml | 11 +++++++++++ 2 files changed, 34 insertions(+) create mode 100755 .travis.install.cppcheck diff --git a/.travis.install.cppcheck b/.travis.install.cppcheck new file mode 100755 index 000000000..aa8383441 --- /dev/null +++ b/.travis.install.cppcheck @@ -0,0 +1,23 @@ +#! /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 ../ + + diff --git a/.travis.yml b/.travis.yml index cb4f621e0..b390c3332 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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 -- GitLab