syncevolution/test/cppcheck-wrapper.sh
Patrick Ohly 69d77b30d2 testing: include cppcheck
The new runtest.py --cppcheck flag can be used in combination with
sources checked out earlier. The source checkout actions then
run cppcheck on each source tree and fail if cppcheck finds any
non-suppressed problems.

A wrapper around cppcheck must be used because --error-exitcode caused
non-zero exit codes also when errors where suppressed, at least in cppcheck
1.61.

We check the SyncEvolution source a bit more thoroughly than the rest because
we can fix or suppress issues inline, which might not be acceptable for
libsynthesis or activesyncd.
2014-01-17 16:15:16 +01:00

9 lines
335 B
Bash
Executable file

#! /bin/bash
set -o pipefail
# We cannot rely on cppcheck --exitcode because it gets triggered by
# suppressed errors. Instead look at the output.
cppcheck '--template={file}:{line}: cppcheck {severity}: {id} - {message}' "$@" 2>&1 | \
perl -e '$res = 0; while (<>) { if (/: cppcheck /) { $res = 1; }; print; }; exit $res;'