Skip to content

Commit e566711

Browse files
committed
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
1 parent 6736fc1 commit e566711

4 files changed

Lines changed: 21 additions & 0 deletions

File tree

.travis.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ script:
4444
- touch /tmp/cppcheck.cppcheck
4545
- ./cppcheck --error-exitcode=1 -Ilib --enable=style,performance,portability,warning,internal --exception-handling --suppressions-list=.travis_suppressions . -j 2 |& tee /tmp/cppcheck.cppcheck
4646
- sh -c "! grep '^\[' /tmp/cppcheck.cppcheck"
47+
# check test/cfg
48+
- make checkcfg
4749
- cd ./gui
4850
# clean rebuild
4951
- git clean -dfx .

Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,9 @@ test: all
248248
check: all
249249
./testrunner -g -q
250250

251+
checkcfg: cppcheck
252+
./test/cfg/runtests.sh
253+
251254
dmake: tools/dmake.o cli/filelister.o lib/path.o
252255
$(CXX) $(CXXFLAGS) -std=c++0x -o dmake tools/dmake.o cli/filelister.o lib/path.o -Ilib $(LDFLAGS)
253256
./dmake

test/cfg/runtests.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/bin/bash
2+
set -e # abort on error
3+
4+
if [[ `pwd` == */test/cfg ]] ; then # we are in test/cfg
5+
CPPCHECK="../../cppcheck"
6+
DIR=""
7+
else # assume we are in repo root
8+
CPPCHECK="./cppcheck"
9+
DIR=./test/cfg/
10+
fi
11+
12+
# std.c
13+
gcc -fsyntax-only ${DIR}std.c
14+
${CPPCHECK} --check-library --enable=information --error-exitcode=1 --inline-suppr ${DIR}std.c

tools/dmake.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -393,6 +393,8 @@ int main(int argc, char **argv)
393393
fout << "\t./testrunner\n\n";
394394
fout << "check:\tall\n";
395395
fout << "\t./testrunner -g -q\n\n";
396+
fout << "checkcfg:\tcppcheck\n";
397+
fout << "\t./test/cfg/runtests.sh\n\n";
396398
fout << "dmake:\ttools/dmake.o cli/filelister.o lib/path.o\n";
397399
fout << "\t$(CXX) $(CXXFLAGS) -std=c++0x -o dmake tools/dmake.o cli/filelister.o lib/path.o -Ilib $(LDFLAGS)\n";
398400
fout << "\t./dmake\n\n";

0 commit comments

Comments
 (0)