tests: add a script which runs test/cfg tests.

add new make target (checkcfg) which builds cppcheck and executes the script
       make travis run checkcfg
This commit is contained in:
Matthias Krüger 2015-01-27 19:31:41 +01:00
parent 6736fc1b18
commit e56671101e
4 changed files with 21 additions and 0 deletions

View File

@ -44,6 +44,8 @@ script:
- touch /tmp/cppcheck.cppcheck
- ./cppcheck --error-exitcode=1 -Ilib --enable=style,performance,portability,warning,internal --exception-handling --suppressions-list=.travis_suppressions . -j 2 |& tee /tmp/cppcheck.cppcheck
- sh -c "! grep '^\[' /tmp/cppcheck.cppcheck"
# check test/cfg
- make checkcfg
- cd ./gui
# clean rebuild
- git clean -dfx .

View File

@ -248,6 +248,9 @@ test: all
check: all
./testrunner -g -q
checkcfg: cppcheck
./test/cfg/runtests.sh
dmake: tools/dmake.o cli/filelister.o lib/path.o
$(CXX) $(CXXFLAGS) -std=c++0x -o dmake tools/dmake.o cli/filelister.o lib/path.o -Ilib $(LDFLAGS)
./dmake

14
test/cfg/runtests.sh Executable file
View File

@ -0,0 +1,14 @@
#!/bin/bash
set -e # abort on error
if [[ `pwd` == */test/cfg ]] ; then # we are in test/cfg
CPPCHECK="../../cppcheck"
DIR=""
else # assume we are in repo root
CPPCHECK="./cppcheck"
DIR=./test/cfg/
fi
# std.c
gcc -fsyntax-only ${DIR}std.c
${CPPCHECK} --check-library --enable=information --error-exitcode=1 --inline-suppr ${DIR}std.c

View File

@ -393,6 +393,8 @@ int main(int argc, char **argv)
fout << "\t./testrunner\n\n";
fout << "check:\tall\n";
fout << "\t./testrunner -g -q\n\n";
fout << "checkcfg:\tcppcheck\n";
fout << "\t./test/cfg/runtests.sh\n\n";
fout << "dmake:\ttools/dmake.o cli/filelister.o lib/path.o\n";
fout << "\t$(CXX) $(CXXFLAGS) -std=c++0x -o dmake tools/dmake.o cli/filelister.o lib/path.o -Ilib $(LDFLAGS)\n";
fout << "\t./dmake\n\n";