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

Merge branch 'v2.1'

Conflicts:
	.travis.yml
parents 9c308b55 18ebb807
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:
......@@ -26,10 +33,11 @@ install:
# install some package - these are fast, we install them anyway
- sudo apt-get update -qq
- sudo apt-get install -y libmatheval-dev
# this is not needed (will be used in 2.2)
- ./.travis.install.xdrfile
- LIBRARY_PATH="$LIBRARY_PATH:/usr/local/lib"
- LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/local/lib"
# 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
......@@ -56,10 +64,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
......@@ -7,7 +7,7 @@ SUBDIRS := $(SRCDIRS) user-doc developer-doc regtest
SUBDIRSCLEAN:=$(addsuffix .clean,$(SUBDIRS))
.PHONY: all lib clean $(SRCDIRS) doc docclean check
.PHONY: all lib clean $(SRCDIRS) doc docclean check cppcheck
# if machine dependent configuration has been found:
ifdef GCCDEP
......@@ -67,5 +67,8 @@ docclean:
cd user-doc && make clean
cd developer-doc && make clean
cppcheck:
$(MAKE) -C src cppcheck
......@@ -20,13 +20,14 @@ SUBDIRSCLEAN :=$(addsuffix .clean,$(SUBDIRS))
# this is cleaning all subdirectories
clean: $(SUBDIRSCLEAN)
rm -f cppcheck.log cppcheck.fatal
$(SUBDIRSCLEAN): %.clean:
$(MAKE) -C $* clean
.PHONY: cppcheck
cppcheck:
cppcheck --std=c++03 --std=posix -j 4 --platform=unix64 -q --enable=all --force */*.{h,cpp}
maketools/cppcheck
.PHONY: mod-light mod-heavy mod-reset
mod-light:
......
......@@ -98,7 +98,7 @@ install-do:
# copy inc files changing the path
for file in Plumed.inc* Plumed.cmake* ; do sed "s| $(realpath ../../)| $(PLUMED_INSTALL_ROOT)/|g" $$file > $(PLUMED_INSTALL_ROOT)/src/lib/$$file ; done
# modulefile
@sed "s|@_PREFIX_@|$(PLUMED_INSTALL_PREFIX)|" modulefile.in | sed "s|@_SOEXT_@|$(SOEXT)|"> $(PLUMED_INSTALL_ROOT)/src/lib/modulefile
@sed "s|@_PREFIX_@|$(PLUMED_INSTALL_PREFIX)|" modulefile.in | sed "s|@_SOEXT_@|$(SOEXT)|" | sed "s|@_SUFFIX_@|$(PLUMED_INSTALL_LIBSUFFIX)|" > $(PLUMED_INSTALL_ROOT)/src/lib/modulefile
# install links
ln -s $(PLUMED_INSTALL_ROOT)/src/lib/plumed $(PLUMED_INSTALL_PREFIX)/bin/plumed$(PLUMED_INSTALL_LIBSUFFIX)
for file in $(PLUMED_SCRIPTS) ; do ln -s $(PLUMED_INSTALL_ROOT)/src/lib/plumed-$$file $(PLUMED_INSTALL_PREFIX)/bin/plumed$(PLUMED_INSTALL_LIBSUFFIX)-$$file ; done
......
......@@ -7,6 +7,9 @@ set prefix "@_PREFIX_@"
# this is the extension for dynamic libraries
# if set to empty, switches off plumed library
set soext "@_SOEXT_@"
# this is the suffix to plumed executable and library
# could be set to plumed version, but is usually blank
set suffix "@_SUFFIX_@"
# everything past this line should not need any editing
......@@ -36,5 +39,5 @@ if { [module-info mode load] && [ info exists ::env(PLUMED_KERNEL) ] } {
prepend-path LIBRARY_PATH $prefix/lib/
prepend-path LD_LIBRARY_PATH $prefix/lib/
prepend-path DYLD_LIBRARY_PATH $prefix/lib/
setenv PLUMED_KERNEL $prefix/lib/libplumedKernel.$soext
setenv PLUMED_KERNEL $prefix/lib/libplumed${suffix}Kernel.$soext
}
#! /bin/bash
set -e
# I use a "tee" here so that errors qre written both immediately (to see progress)
# and on a file (for later report)
cppcheck --std=c++03 --std=posix -j 4 --platform=unix64 -q \
--template='[{file}:{line}] ({severity}) :{id}: {message}' --enable=all --inline-suppr --force \
*/*.{h,cpp} 2> >(tee cppcheck.log >&2)
## this part could be useful to clean the code
# echo "+++++++ THIS IS A COMPLETE LIST OF ERRORS +++++++"
# cat cppcheck.log
# echo "+++++++++++++++++++++++++++++++++++++"
# echo "summary from cppcheck report:
# for t in error warning performance portability style
# do
# echo "$t: $(cat cppcheck.log | grep "($t)" | wc -l)"
# done
# echo "+++++++++++++++++++++++++++++++++++++"
## I exclude src/molfile which is full of warnings
## I also exclude (style) messages
## perhaps we could keep some of them to make to code cleaner at some point
##
## (the "true" command is necessary so that the script does not fail if some string is not found)
grep -v "(style)" cppcheck.log | grep -v "\[molfile/" > cppcheck.fatal || true
count=$(cat cppcheck.fatal | wc -l)
echo
echo "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"
if ((count==0))
then
echo " cppcheck did not find any fatal error"
echo " (fatal here means: excluding style and excluding molfile/)"
echo "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"
exit 0
fi
echo " cppcheck reported the following fatal errors:"
echo " (fatal here means: excluding style and excluding molfile/)"
echo
cat cppcheck.fatal
echo
echo "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"
echo
exit 1
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