From e56671101e3e3656287fed05ccf78f971d505539 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Kr=C3=BCger?= Date: Tue, 27 Jan 2015 19:31:41 +0100 Subject: [PATCH] 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 --- .travis.yml | 2 ++ Makefile | 3 +++ test/cfg/runtests.sh | 14 ++++++++++++++ tools/dmake.cpp | 2 ++ 4 files changed, 21 insertions(+) create mode 100755 test/cfg/runtests.sh diff --git a/.travis.yml b/.travis.yml index 1096e325c..e2f1ba637 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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 . diff --git a/Makefile b/Makefile index 7bbc5e531..03f84e7be 100644 --- a/Makefile +++ b/Makefile @@ -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 diff --git a/test/cfg/runtests.sh b/test/cfg/runtests.sh new file mode 100755 index 000000000..ee6f9eea5 --- /dev/null +++ b/test/cfg/runtests.sh @@ -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 diff --git a/tools/dmake.cpp b/tools/dmake.cpp index c352ad60e..2b454da1b 100644 --- a/tools/dmake.cpp +++ b/tools/dmake.cpp @@ -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";